VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/PackDriversForSubmission.cmd

Last change on this file was 106856, checked in by vboxsync, 3 weeks ago

PackDriversForSubmission.cmd: We don't have video drivers for win.arm64 yet, so skip those. jiraref:VBP-1440

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 15.8 KB
Line 
1@echo off
2rem $Id: PackDriversForSubmission.cmd 106856 2024-11-06 15:12:55Z vboxsync $
3rem rem @file
4rem Windows NT batch script for preparing for signing submission.
5rem
6
7rem
8rem Copyright (C) 2018-2024 Oracle and/or its affiliates.
9rem
10rem This file is part of VirtualBox base platform packages, as
11rem available from https://www.virtualbox.org.
12rem
13rem This program is free software; you can redistribute it and/or
14rem modify it under the terms of the GNU General Public License
15rem as published by the Free Software Foundation, in version 3 of the
16rem License.
17rem
18rem This program is distributed in the hope that it will be useful, but
19rem WITHOUT ANY WARRANTY; without even the implied warranty of
20rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21rem General Public License for more details.
22rem
23rem You should have received a copy of the GNU General Public License
24rem along with this program; if not, see <https://www.gnu.org/licenses>.
25rem
26rem SPDX-License-Identifier: GPL-3.0-only
27rem
28
29
30setlocal ENABLEEXTENSIONS
31setlocal
32
33rem
34rem Parse arguments.
35rem
36set _MY_OPT_BINDIR=..\bin
37set _MY_OPT_PDBDIR=
38set _MY_OPT_GADIR=
39set _MY_OPT_WITH_MAIN=1
40set _MY_OPT_WITH_PDB=1
41set _MY_OPT_EXTPACK=
42set _MY_OPT_NO_EXTRACT=0
43set _MY_OPT_WITH_EXTPACK=1
44set _MY_OPT_WITH_GA=0
45set _MY_OPT_OUTPUT=
46set _MY_OPT_DDF_FILE=
47set _MY_OPT_ARCH=amd64
48
49:argument_loop
50if ".%1" == "." goto no_more_arguments
51
52if ".%1" == ".-h" goto opt_h
53if ".%1" == ".-?" goto opt_h
54if ".%1" == "./h" goto opt_h
55if ".%1" == "./H" goto opt_h
56if ".%1" == "./?" goto opt_h
57if ".%1" == ".-help" goto opt_h
58if ".%1" == ".--help" goto opt_h
59
60if ".%1" == ".-a" goto opt_a
61if ".%1" == ".--arch" goto opt_a
62if ".%1" == ".-b" goto opt_b
63if ".%1" == ".--bindir" goto opt_b
64if ".%1" == ".-d" goto opt_d
65if ".%1" == ".--ddf" goto opt_d
66if ".%1" == ".-e" goto opt_e
67if ".%1" == ".--extpack" goto opt_e
68if ".%1" == ".--no-main" goto opt_m
69if ".%1" == ".-n" goto opt_n
70if ".%1" == ".--no-pdb" goto opt_n
71if ".%1" == ".-o" goto opt_o
72if ".%1" == ".--output" goto opt_o
73if ".%1" == ".-p" goto opt_p
74if ".%1" == ".--pdb" goto opt_p
75if ".%1" == ".-t" goto opt_p
76if ".%1" == ".--no-extract" goto opt_t
77if ".%1" == ".-x" goto opt_x
78if ".%1" == ".--no-extpack" goto opt_x
79if ".%1" == ".-g" goto opt_g
80if ".%1" == ".--ga" goto opt_g
81if ".%1" == ".--additions" goto opt_g
82echo syntax error: Unknown option: %1
83echo Try --help to list valid options.
84goto end_failed
85
86:argument_loop_next_with_value
87shift
88shift
89goto argument_loop
90
91:opt_a
92if ".%~2" == "." goto syntax_error_missing_value
93if not "%2" == "x86" if not "%2" == "amd64" if not "%2" == "arm64" goto syntax_error_unknown_arch
94set _MY_OPT_ARCH=%~2
95goto argument_loop_next_with_value
96
97:opt_b
98if ".%~2" == "." goto syntax_error_missing_value
99set _MY_OPT_BINDIR=%~2
100goto argument_loop_next_with_value
101
102:opt_d
103if ".%~2" == "." goto syntax_error_missing_value
104set _MY_OPT_DDF_FILE=%~2
105goto argument_loop_next_with_value
106
107:opt_e
108if ".%~2" == "." goto syntax_error_missing_value
109set _MY_OPT_EXTPACK=%~2
110goto argument_loop_next_with_value
111
112:opt_h
113echo This script creates a .cab file containing all drivers needing blessing from
114echo Microsoft to run on recent Windows 10 installations.
115echo .
116echo Usage: PackDriversForSubmission.cmd [-b bindir] [-p pdbdir] [--no-main] [-n/--no-pdb] [-e expack]
117echo [-x/--no-extpack] [-g/--ga/--additions] [-o output.cab] [-p output.ddf] [-a x86/amd64/arm64]
118echo .
119echo Warning! This script should normally be invoked from the repack directory w/o any parameters.
120goto end_failed
121
122:opt_m
123set _MY_OPT_WITH_MAIN=0
124shift
125goto argument_loop
126
127:opt_n
128set _MY_OPT_WITH_PDB=0
129shift
130goto argument_loop
131
132:opt_p
133if ".%~2" == "." goto syntax_error_missing_value
134set _MY_OPT_PDBDIR=%~2
135goto argument_loop_next_with_value
136
137:opt_o
138if ".%~2" == "." goto syntax_error_missing_value
139set _MY_OPT_OUTPUT=%~2
140goto argument_loop_next_with_value
141
142:opt_t
143set _MY_OPT_NO_EXTRACT=1
144shift
145goto argument_loop
146
147:opt_x
148set _MY_OPT_WITH_EXTPACK=0
149shift
150goto argument_loop
151
152:opt_g
153set _MY_OPT_WITH_GA=1
154shift
155goto argument_loop
156
157:syntax_error_missing_value
158echo syntax error: missing or empty option value after %1
159goto end_failed
160
161:syntax_error_unknown_arch
162echo syntax error: Unknown architecture: %2
163goto end_failed
164
165:error_bindir_does_not_exist
166echo syntax error: Specified BIN directory does not exist: "%_MY_OPT_BINDIR%"
167goto end_failed
168
169:error_pdbdir_does_not_exist
170echo syntax error: Specified PDB directory does not exist: "%_MY_OPT_PDBDIR%"
171goto end_failed
172
173:error_extpack_does_not_exist
174echo syntax error: Specified extension pack does not exist: "%_MY_OPT_EXTPACK%"
175goto end_failed
176
177:error_additions_does_not_exist
178echo syntax error: Specified guest additions does not exist: "%_MY_OPT_GADIR%"
179goto end_failed
180
181
182:error_output_exists
183echo error: The output file already exist: "%_MY_OPT_OUTPUT%"
184goto end_failed
185
186:error_ddf_exists
187echo error: The DDF file already exist: "%_MY_OPT_DDF_FILE%"
188goto end_failed
189
190:no_more_arguments
191rem validate specified options
192if not exist "%_MY_OPT_BINDIR%" goto error_bindir_does_not_exist
193
194if "%_MY_OPT_WITH_PDB%" == "0" goto no_pdbdir_validation
195if ".%_MY_OPT_PDBDIR%" == "." set _MY_OPT_PDBDIR=%_MY_OPT_BINDIR%\..\stage\debug\bin
196if not exist "%_MY_OPT_PDBDIR%" goto error_pdbdir_does_not_exist
197:no_pdbdir_validation
198
199if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_validation
200if "%_MY_OPT_NO_EXTRACT%" == "1" goto no_extpack_validation
201if ".%_MY_OPT_EXTPACK%" == "." set _MY_OPT_EXTPACK=%_MY_OPT_BINDIR%\Oracle_VirtualBox_Extension_Pack.vbox-extpack
202if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_does_not_exist
203:no_extpack_validation
204
205if "%_MY_OPT_WITH_GA%" == "0" goto no_additions_validation
206if ".%_MY_OPT_GADIR%" == "." set _MY_OPT_GADIR=%_MY_OPT_BINDIR%\additions
207if not exist "%_MY_OPT_GADIR%" goto error_additions_does_not_exist
208:no_additions_validation
209
210if ".%_MY_OPT_OUTPUT%" == "." set _MY_OPT_OUTPUT=VBoxDrivers-@VBOX_VERSION_STRING@r@VBOX_SVN_REV@-%_MY_OPT_ARCH%.cab
211if exist "%_MY_OPT_OUTPUT%" goto error_output_exists
212
213if ".%_MY_OPT_DDF_FILE%" == "." set _MY_OPT_DDF_FILE=%_MY_OPT_OUTPUT%.ddf
214if exist "%_MY_OPT_DDF_FILE%" goto error_ddf_exists
215
216
217rem
218rem Unpack the extension pack.
219rem We unpack it into the bin directory in the usual location.
220rem
221rem Note! Modify the path a little to ensure windows utilities are used before
222rem cygwin ones, and that we can use stuff from bin\tools if we like.
223rem
224set PATH=%SystemRoot%\System32;%PATH%;%_MY_OPT_BINDIR%
225if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_unpack
226set _MY_EXTPACK_DIR=%_MY_OPT_BINDIR%\ExtensionPacks\Oracle_VirtualBox_Extension_Pack
227if not exist "%_MY_OPT_BINDIR%\ExtensionPacks" ( mkdir "%_MY_OPT_BINDIR%\ExtensionPacks" || goto end_failed )
228if not exist "%_MY_EXTPACK_DIR%" ( mkdir "%_MY_EXTPACK_DIR%" || goto end_failed )
229if "%_MY_OPT_NO_EXTRACT%" == "1" goto no_extpack_unpack
230"%_MY_OPT_BINDIR%\tools\RTTar.exe" -xzf "%_MY_OPT_EXTPACK%" -C "%_MY_EXTPACK_DIR%" || goto end_failed
231:no_extpack_unpack
232
233rem
234rem Create the DDF file for makecab.
235rem
236echo .OPTION EXPLICIT> "%_MY_OPT_DDF_FILE%" || goto end_failed
237echo .Set CabinetFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
238echo .Set FolderFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
239echo .Set FolderSizeThreshold=0 >> "%_MY_OPT_DDF_FILE%"
240echo .Set MaxCabinetSize=0 >> "%_MY_OPT_DDF_FILE%"
241echo .Set MaxDiskFileCount=0 >> "%_MY_OPT_DDF_FILE%"
242echo .Set MaxDiskSize=0 >> "%_MY_OPT_DDF_FILE%"
243echo .Set Cabinet=on>> "%_MY_OPT_DDF_FILE%"
244echo .Set CompressionType=MSZIP>> "%_MY_OPT_DDF_FILE%"
245echo .Set Compress=on>> "%_MY_OPT_DDF_FILE%"
246echo .Set DiskDirectoryTemplate= >> "%_MY_OPT_DDF_FILE%"
247echo .Set CabinetNameTemplate=%_MY_OPT_OUTPUT%>> "%_MY_OPT_DDF_FILE%"
248echo .Set InfFileName=%_MY_OPT_OUTPUT%.inf>> "%_MY_OPT_DDF_FILE%"
249echo .Set RptFileName=%_MY_OPT_OUTPUT%.rpt>> "%_MY_OPT_DDF_FILE%"
250
251if %_MY_OPT_WITH_MAIN% == 0 goto skip_main_package
252echo .Set DestinationDir=VBoxSup>> "%_MY_OPT_DDF_FILE%"
253echo %_MY_OPT_BINDIR%\VBoxSup.inf VBoxSup.inf>> "%_MY_OPT_DDF_FILE%"
254echo %_MY_OPT_BINDIR%\VBoxSup.sys VBoxSup.sys>> "%_MY_OPT_DDF_FILE%"
255if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxSup.pdb VBoxSup.pdb>> "%_MY_OPT_DDF_FILE%"
256
257echo .Set DestinationDir=VBoxNetAdp6>> "%_MY_OPT_DDF_FILE%"
258echo %_MY_OPT_BINDIR%\VBoxNetAdp6.inf VBoxNetAdp6.inf>> "%_MY_OPT_DDF_FILE%"
259echo %_MY_OPT_BINDIR%\VBoxNetAdp6.sys VBoxNetAdp6.sys>> "%_MY_OPT_DDF_FILE%"
260if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetAdp6.pdb VBoxNetAdp6.pdb>> "%_MY_OPT_DDF_FILE%"
261
262echo .Set DestinationDir=VBoxNetLwf>> "%_MY_OPT_DDF_FILE%"
263echo %_MY_OPT_BINDIR%\VBoxNetLwf.inf VBoxNetLwf.inf>> "%_MY_OPT_DDF_FILE%"
264echo %_MY_OPT_BINDIR%\VBoxNetLwf.sys VBoxNetLwf.sys>> "%_MY_OPT_DDF_FILE%"
265if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetLwf.pdb VBoxNetLwf.pdb>> "%_MY_OPT_DDF_FILE%"
266
267echo .Set DestinationDir=VBoxUSB>> "%_MY_OPT_DDF_FILE%"
268echo %_MY_OPT_BINDIR%\VBoxUSB.inf VBoxUSB.inf>> "%_MY_OPT_DDF_FILE%"
269echo %_MY_OPT_BINDIR%\VBoxUSB.sys VBoxUSB.sys>> "%_MY_OPT_DDF_FILE%"
270if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSB.pdb VBoxUSB.pdb>> "%_MY_OPT_DDF_FILE%"
271
272echo .Set DestinationDir=VBoxUSBMon>> "%_MY_OPT_DDF_FILE%"
273echo %_MY_OPT_BINDIR%\VBoxUSBMon.inf VBoxUSBMon.inf>> "%_MY_OPT_DDF_FILE%"
274echo %_MY_OPT_BINDIR%\VBoxUSBMon.sys VBoxUSBMon.sys>> "%_MY_OPT_DDF_FILE%"
275if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSBMon.pdb VBoxUSBMon.pdb>> "%_MY_OPT_DDF_FILE%"
276
277echo .Set DestinationDir=VMMR0>> "%_MY_OPT_DDF_FILE%"
278echo .\VMMR0.inf VMMR0.inf>> "%_MY_OPT_DDF_FILE%"
279echo %_MY_OPT_BINDIR%\VMMR0.r0 VMMR0.r0>> "%_MY_OPT_DDF_FILE%"
280if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VMMR0.pdb VMMR0.pdb>> "%_MY_OPT_DDF_FILE%"
281echo %_MY_OPT_BINDIR%\VBoxDDR0.r0 VBoxDDR0.r0>> "%_MY_OPT_DDF_FILE%"
282if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDDR0.pdb VBoxDDR0.pdb>> "%_MY_OPT_DDF_FILE%"
283:skip_main_package
284
285if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_ddf
286echo .Set DestinationDir=VBoxExtPackPuel>> "%_MY_OPT_DDF_FILE%"
287echo .\VBoxExtPackPuel.inf VBoxExtPackPuel.inf>> "%_MY_OPT_DDF_FILE%"
288rem echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxEhciR0.r0 VBoxEhciR0.r0>> "%_MY_OPT_DDF_FILE%"
289echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxNvmeR0.r0 VBoxNvmeR0.r0>> "%_MY_OPT_DDF_FILE%"
290rem echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxPciRawR0.r0 VBoxPciRawR0.r0>> "%_MY_OPT_DDF_FILE%"
291:no_extpack_ddf
292
293if "%_MY_OPT_WITH_GA%" == "0" goto no_additions_ddf
294echo .Set DestinationDir=VBoxGuestAdditions>> "%_MY_OPT_DDF_FILE%"
295echo %_MY_OPT_GADIR%\VBoxGuest.inf>> "%_MY_OPT_DDF_FILE%"
296echo %_MY_OPT_GADIR%\VBoxGuest.sys>> "%_MY_OPT_DDF_FILE%"
297echo %_MY_OPT_GADIR%\VBoxTray.exe>> "%_MY_OPT_DDF_FILE%"
298echo %_MY_OPT_GADIR%\VBoxControl.exe>> "%_MY_OPT_DDF_FILE%"
299echo %_MY_OPT_GADIR%\VBoxMouse.inf>> "%_MY_OPT_DDF_FILE%"
300echo %_MY_OPT_GADIR%\VBoxMouse.sys>> "%_MY_OPT_DDF_FILE%"
301rem rem @todo win.arm64: Temporarily skipping video drivers as they're not building.
302if "%_MY_OPT_ARCH%" == "arm64" goto skip_video_files
303rem VBoxVideo files are excluded from attestation signing.
304rem echo %_MY_OPT_GADIR%\VBoxVideo.inf>> "%_MY_OPT_DDF_FILE%"
305rem echo %_MY_OPT_GADIR%\VBoxVideo.sys>> "%_MY_OPT_DDF_FILE%"
306echo %_MY_OPT_GADIR%\VBoxWddm.inf>> "%_MY_OPT_DDF_FILE%"
307echo %_MY_OPT_GADIR%\VBoxWddm.sys>> "%_MY_OPT_DDF_FILE%"
308echo %_MY_OPT_GADIR%\VBoxDX.dll>> "%_MY_OPT_DDF_FILE%"
309echo %_MY_OPT_GADIR%\VBoxDisp.dll>> "%_MY_OPT_DDF_FILE%"
310echo %_MY_OPT_GADIR%\VBoxDispD3D.dll>> "%_MY_OPT_DDF_FILE%"
311echo %_MY_OPT_GADIR%\VBoxNine.dll>> "%_MY_OPT_DDF_FILE%"
312echo %_MY_OPT_GADIR%\VBoxSVGA.dll>> "%_MY_OPT_DDF_FILE%"
313echo %_MY_OPT_GADIR%\VBoxGL.dll>> "%_MY_OPT_DDF_FILE%"
314:skip_video_files
315echo %_MY_OPT_GADIR%\VBoxMRXNP.dll>> "%_MY_OPT_DDF_FILE%"
316echo %_MY_OPT_GADIR%\VBoxSF.sys>> "%_MY_OPT_DDF_FILE%"
317if not ".%_MY_OPT_ARCH%" == ".amd64" goto skip_amd64_files
318echo %_MY_OPT_GADIR%\VBoxDX-x86.dll>> "%_MY_OPT_DDF_FILE%"
319echo %_MY_OPT_GADIR%\VBoxDispD3D-x86.dll>> "%_MY_OPT_DDF_FILE%"
320echo %_MY_OPT_GADIR%\VBoxNine-x86.dll>> "%_MY_OPT_DDF_FILE%"
321echo %_MY_OPT_GADIR%\VBoxSVGA-x86.dll>> "%_MY_OPT_DDF_FILE%"
322echo %_MY_OPT_GADIR%\VBoxGL-x86.dll>> "%_MY_OPT_DDF_FILE%"
323:skip_amd64_files
324
325:no_additions_ddf
326
327rem
328rem Create the cabient file.
329rem Note! MakeCab is shipped on W10, so we ASSUME it's in the PATH.
330rem
331MakeCab.exe /v2 /F "%_MY_OPT_DDF_FILE%" || goto end_failed
332
333rem
334rem EV sign the cabient file.
335rem
336if not exist "sign-ev.cmd" goto end
337echo info: Now signing the created CAB file. Can take a few minutes...
338call sign-ev.cmd "%_MY_OPT_OUTPUT%" || goto end_failed
339
340goto end
341
342:end_failed
343@endlocal
344@endlocal
345@exit /b 1
346
347:end
348@endlocal
349@endlocal
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette