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