]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/CreateBootDisk.bat
Update the copyright notice format
[mirror_edk2.git] / DuetPkg / CreateBootDisk.bat
CommitLineData
e4c0074b 1@REM ## @file\r
2@REM #\r
b1f700a8 3@REM # Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
e4c0074b 4@REM #\r
5@REM # This program and the accompanying materials\r
6@REM # are licensed and made available under the terms and conditions of the BSD License\r
7@REM # which accompanies this distribution. The full text of the license may be found at\r
8@REM # http://opensource.org/licenses/bsd-license.php\r
9@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11@REM #\r
12@REM #\r
13@REM ##\r
6d3f7723 14\r
15@REM Set up environment at fisrt.\r
16\r
2a5ef1fc 17@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32\r
e88f3056 18@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
6d3f7723 19@set DISK_LABEL=DUET\r
e843cdd7 20@set PROCESSOR=""\r
6d3f7723 21\r
e843cdd7 22@echo on\r
6d3f7723 23\r
24@if "%1"=="" goto Help\r
25@if "%2"=="" goto Help\r
26@if "%3"=="" goto Help\r
e843cdd7 27@if "%4"=="" goto NoArch\r
6d3f7723 28@set EFI_BOOT_DISK=%2\r
e843cdd7 29@if "%4"=="IA32" set PROCESSOR=IA32\r
30@if "%4"=="X64" set PROCESSOR=X64\r
31@if %PROCESSOR%=="" goto WrongArch\r
ab9cb4b1 32@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\DEBUG_MYTOOLS\r
33\r
6d3f7723 34@if "%1"=="floppy" goto CreateFloppy\r
e25803f0 35@if "%1"=="file" goto CreateFile\r
6d3f7723 36@if "%1"=="usb" goto CreateUsb\r
37@if "%1"=="ide" goto CreateIde\r
e843cdd7 38\r
6d3f7723 39goto Help\r
40\r
41:CreateFloppy\r
42@if NOT "%3"=="FAT12" goto WrongFATType\r
43@echo Start to create floppy boot disk ...\r
44@echo Format %EFI_BOOT_DISK% ...\r
45@echo.> FormatCommandInput.txt\r
46@echo.n>> FormatCommandInput.txt\r
47@format /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
48@del FormatCommandInput.txt\r
49@echo Create boot sector ...\r
50%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com\r
e88f3056 51%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BOOTSECTOR_BIN_DIR%\Bootsect.com -f\r
6d3f7723 52@REM @del FDBS.com\r
e88f3056 53%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bootsect.com\r
6d3f7723 54@echo Done.\r
55copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%\r
56mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 57@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
58@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
6d3f7723 59@goto end\r
60\r
e25803f0 61:CreateFile\r
62@if NOT "%3"=="FAT12" goto WrongFATType\r
63@echo Start to create file boot disk ...\r
64@echo Create boot sector ...\r
65%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com\r
e88f3056 66%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BOOTSECTOR_BIN_DIR%\Bootsect.com -f\r
e25803f0 67@REM @del FDBS.com\r
e88f3056 68%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bootsect.com\r
e25803f0 69@echo Done.\r
70@goto end\r
71\r
6d3f7723 72:CreateUsb\r
73@echo Start to create usb boot disk ...\r
74@if "%3"=="FAT16" goto CreateUsb_FAT16\r
75@if "%3"=="FAT32" goto CreateUsb_FAT32\r
76@if "%3"=="FAT12" goto WrongFATType\r
77\r
78:CreateUsb_FAT16\r
e843cdd7 79@if "%5"=="step2" goto CreateUsb_FAT16_step2\r
6d3f7723 80@echo Format %EFI_BOOT_DISK% ...\r
81@echo.> FormatCommandInput.txt\r
82@format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
83@del FormatCommandInput.txt\r
84@echo Create boot sector ...\r
85@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs16.com\r
e88f3056 86@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs16.com %BOOTSECTOR_BIN_DIR%\Bs16.com -f\r
87@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bs16.com\r
88@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com\r
e25803f0 89@echo Done.\r
90@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!\r
91@goto end\r
92\r
93:CreateUsb_FAT16_step2\r
6d3f7723 94@copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%\r
95@mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 96@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
97@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
6d3f7723 98@goto end\r
99\r
100:CreateUsb_FAT32\r
e843cdd7 101@if "%5"=="step2" goto CreateUsb_FAT32_step2\r
6d3f7723 102@echo Format %EFI_BOOT_DISK% ...\r
103@echo.> FormatCommandInput.txt\r
104@format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
105@del FormatCommandInput.txt\r
106@echo Create boot sector ...\r
107@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs32.com\r
e88f3056 108@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs32.com %BOOTSECTOR_BIN_DIR%\Bs32.com -f\r
6d3f7723 109@del UsbBs32.com\r
e88f3056 110@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bs32.com\r
111@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com\r
6d3f7723 112@echo Done.\r
113@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!\r
114@goto end \r
115\r
b0e441b5 116:CreateUsb_FAT32_step2\r
117@copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%\r
118@mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 119@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
120@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
b0e441b5 121@goto end\r
122\r
6d3f7723 123:CreateIde\r
124@goto end\r
125\r
e843cdd7 126:CreateBootFileForIA32\r
127copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\IA32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
128@goto end\r
129\r
130:CreateBootFileForX64\r
131copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootx64.efi /y\r
132@goto end\r
133\r
6d3f7723 134:WrongFATType\r
135@echo Wrong FAT type %3 for %1\r
136@goto end\r
137\r
e843cdd7 138:NoArch\r
139@echo Error! Please specific the architecture.\r
140@goto Help\r
141\r
142:WrongArch\r
143@echo Error! Wrong architecture.\r
144@goto Help\r
145\r
6d3f7723 146:Help\r
e843cdd7 147@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]"\r
6d3f7723 148:end\r
149@echo on