]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/CreateBootDisk.bat
MdePkg: add missing #defines for decoding PCIe 2.1 extended capability structures
[mirror_edk2.git] / DuetPkg / CreateBootDisk.bat
CommitLineData
e4c0074b 1@REM ## @file\r
2@REM #\r
7708d081 3@REM # Copyright (c) 2010 - 2011, 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
7708d081 15@REM Set up environment at first.\r
6d3f7723 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
7708d081
RN
21@set STEP=1\r
22@call %WORKSPACE%\DuetPkg\GetVariables.bat\r
6d3f7723 23\r
e843cdd7 24@echo on\r
6d3f7723 25\r
26@if "%1"=="" goto Help\r
27@if "%2"=="" goto Help\r
28@if "%3"=="" goto Help\r
7708d081
RN
29@if "%4"=="" goto Set_BootDisk\r
30@if "%4"=="step2" (@set STEP=2) else @set TARGET_ARCH=%4\r
31@if "%5"=="step2" @set STEP=2\r
32:Set_BootDisk\r
6d3f7723 33@set EFI_BOOT_DISK=%2\r
7708d081
RN
34@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32\r
35@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64\r
e843cdd7 36@if %PROCESSOR%=="" goto WrongArch\r
7708d081 37@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
ab9cb4b1 38\r
6d3f7723 39@if "%1"=="floppy" goto CreateFloppy\r
e25803f0 40@if "%1"=="file" goto CreateFile\r
6d3f7723 41@if "%1"=="usb" goto CreateUsb\r
42@if "%1"=="ide" goto CreateIde\r
e843cdd7 43\r
6d3f7723 44goto Help\r
45\r
46:CreateFloppy\r
47@if NOT "%3"=="FAT12" goto WrongFATType\r
48@echo Start to create floppy boot disk ...\r
49@echo Format %EFI_BOOT_DISK% ...\r
50@echo.> FormatCommandInput.txt\r
51@echo.n>> FormatCommandInput.txt\r
52@format /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
53@del FormatCommandInput.txt\r
54@echo Create boot sector ...\r
55%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com\r
e88f3056 56%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BOOTSECTOR_BIN_DIR%\Bootsect.com -f\r
6d3f7723 57@REM @del FDBS.com\r
e88f3056 58%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bootsect.com\r
6d3f7723 59@echo Done.\r
60copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%\r
61mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 62@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
63@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
6d3f7723 64@goto end\r
65\r
e25803f0 66:CreateFile\r
67@if NOT "%3"=="FAT12" goto WrongFATType\r
68@echo Start to create file boot disk ...\r
69@echo Create boot sector ...\r
70%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com\r
e88f3056 71%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BOOTSECTOR_BIN_DIR%\Bootsect.com -f\r
e25803f0 72@REM @del FDBS.com\r
e88f3056 73%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bootsect.com\r
e25803f0 74@echo Done.\r
75@goto end\r
76\r
6d3f7723 77:CreateUsb\r
78@echo Start to create usb boot disk ...\r
79@if "%3"=="FAT16" goto CreateUsb_FAT16\r
80@if "%3"=="FAT32" goto CreateUsb_FAT32\r
81@if "%3"=="FAT12" goto WrongFATType\r
82\r
83:CreateUsb_FAT16\r
7708d081 84@if "%STEP%"=="2" goto CreateUsb_FAT16_step2\r
6d3f7723 85@echo Format %EFI_BOOT_DISK% ...\r
86@echo.> FormatCommandInput.txt\r
87@format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
88@del FormatCommandInput.txt\r
89@echo Create boot sector ...\r
90@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs16.com\r
e88f3056 91@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs16.com %BOOTSECTOR_BIN_DIR%\Bs16.com -f\r
92@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bs16.com\r
93@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com\r
e25803f0 94@echo Done.\r
95@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!\r
96@goto end\r
97\r
98:CreateUsb_FAT16_step2\r
6d3f7723 99@copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%\r
100@mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 101@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
102@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
6d3f7723 103@goto end\r
104\r
105:CreateUsb_FAT32\r
7708d081 106@if "%STEP%"=="2" goto CreateUsb_FAT32_step2\r
6d3f7723 107@echo Format %EFI_BOOT_DISK% ...\r
108@echo.> FormatCommandInput.txt\r
109@format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
110@del FormatCommandInput.txt\r
111@echo Create boot sector ...\r
112@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs32.com\r
e88f3056 113@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs32.com %BOOTSECTOR_BIN_DIR%\Bs32.com -f\r
6d3f7723 114@del UsbBs32.com\r
e88f3056 115@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Bs32.com\r
116@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com\r
6d3f7723 117@echo Done.\r
118@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!\r
119@goto end \r
120\r
b0e441b5 121:CreateUsb_FAT32_step2\r
122@copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%\r
123@mkdir %EFI_BOOT_DISK%\efi\boot\r
e843cdd7 124@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
125@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
b0e441b5 126@goto end\r
127\r
6d3f7723 128:CreateIde\r
129@goto end\r
130\r
e843cdd7 131:CreateBootFileForIA32\r
132copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\IA32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
133@goto end\r
134\r
135:CreateBootFileForX64\r
136copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootx64.efi /y\r
137@goto end\r
138\r
6d3f7723 139:WrongFATType\r
140@echo Wrong FAT type %3 for %1\r
141@goto end\r
142\r
e843cdd7 143:WrongArch\r
144@echo Error! Wrong architecture.\r
145@goto Help\r
146\r
6d3f7723 147:Help\r
e843cdd7 148@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]"\r
6d3f7723 149:end\r
150@echo on