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