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