3 @REM Set up environment at fisrt.
\r
5 @set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
\r
6 @set BUILD_DIR=%WORKSPACE%\Build\DuetPkg\DEBUG_MYTOOLS
\r
11 @if "%1"=="" goto Help
\r
12 @if "%2"=="" goto Help
\r
13 @if "%3"=="" goto Help
\r
14 @set EFI_BOOT_DISK=%2
\r
15 @if "%1"=="floppy" goto CreateFloppy
\r
16 @if "%1"=="file" goto CreateFile
\r
17 @if "%1"=="usb" goto CreateUsb
\r
18 @if "%1"=="ide" goto CreateIde
\r
22 @if NOT "%3"=="FAT12" goto WrongFATType
\r
23 @echo Start to create floppy boot disk ...
\r
24 @echo Format %EFI_BOOT_DISK% ...
\r
25 @echo.> FormatCommandInput.txt
\r
26 @echo.n>> FormatCommandInput.txt
\r
27 @format /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
\r
28 @del FormatCommandInput.txt
\r
29 @echo Create boot sector ...
\r
30 %BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
\r
31 %BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com -f
\r
33 %BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com
\r
35 copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%
\r
36 mkdir %EFI_BOOT_DISK%\efi\boot
\r
37 copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
\r
41 @if NOT "%3"=="FAT12" goto WrongFATType
\r
42 @echo Start to create file boot disk ...
\r
43 @echo Create boot sector ...
\r
44 %BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
\r
45 %BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com -f
\r
47 %BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com
\r
52 @echo Start to create usb boot disk ...
\r
53 @if "%3"=="FAT16" goto CreateUsb_FAT16
\r
54 @if "%3"=="FAT32" goto CreateUsb_FAT32
\r
55 @if "%3"=="FAT12" goto WrongFATType
\r
58 @if "%4"=="step2" goto CreateUsb_FAT16_step2
\r
59 @echo Format %EFI_BOOT_DISK% ...
\r
60 @echo.> FormatCommandInput.txt
\r
61 @format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
\r
62 @del FormatCommandInput.txt
\r
63 @echo Create boot sector ...
\r
64 @%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs16.com
\r
65 @%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs16.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs16.com -f
\r
66 @%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs16.com
\r
67 @%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Mbr.com
\r
69 @echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
\r
72 :CreateUsb_FAT16_step2
\r
73 @copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%
\r
74 @mkdir %EFI_BOOT_DISK%\efi\boot
\r
75 @copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
\r
79 @if "%4"=="step2" goto CreateUsb_FAT32_step2
\r
80 @echo Format %EFI_BOOT_DISK% ...
\r
81 @echo.> FormatCommandInput.txt
\r
82 @format /FS:FAT32 /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 UsbBs32.com
\r
86 @%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs32.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs32.com -f
\r
88 @%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs32.com
\r
89 @%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Mbr.com
\r
91 @echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
\r
94 :CreateUsb_FAT32_step2
\r
95 @copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%
\r
96 @mkdir %EFI_BOOT_DISK%\efi\boot
\r
97 @copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
\r
104 @echo Wrong FAT type %3 for %1
\r
108 @echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32]"
\r