]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/CreateBootDisk.bat
Using sizeof(EFO_BLOCK_IO_MEDIA) replace Macro.
[mirror_edk2.git] / DuetPkg / CreateBootDisk.bat
1 @REM
2
3 @REM Set up environment at fisrt.
4
5 @set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
6 @set BUILD_DIR=%WORKSPACE%\Build\DuetPkg\DEBUG_MYTOOLS
7 @set DISK_LABEL=DUET
8 @echo on
9
10
11 @if "%1"=="" goto Help
12 @if "%2"=="" goto Help
13 @if "%3"=="" goto Help
14 @set EFI_BOOT_DISK=%2
15 @if "%1"=="floppy" goto CreateFloppy
16 @if "%1"=="file" goto CreateFile
17 @if "%1"=="usb" goto CreateUsb
18 @if "%1"=="ide" goto CreateIde
19 goto Help
20
21 :CreateFloppy
22 @if NOT "%3"=="FAT12" goto WrongFATType
23 @echo Start to create floppy boot disk ...
24 @echo Format %EFI_BOOT_DISK% ...
25 @echo.> FormatCommandInput.txt
26 @echo.n>> FormatCommandInput.txt
27 @format /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
28 @del FormatCommandInput.txt
29 @echo Create boot sector ...
30 %BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
31 %BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com -f
32 @REM @del FDBS.com
33 %BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com
34 @echo Done.
35 copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%
36 mkdir %EFI_BOOT_DISK%\efi\boot
37 copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
38 @goto end
39
40 :CreateFile
41 @if NOT "%3"=="FAT12" goto WrongFATType
42 @echo Start to create file boot disk ...
43 @echo Create boot sector ...
44 %BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
45 %BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com -f
46 @REM @del FDBS.com
47 %BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bootsect.com
48 @echo Done.
49 @goto end
50
51 :CreateUsb
52 @echo Start to create usb boot disk ...
53 @if "%3"=="FAT16" goto CreateUsb_FAT16
54 @if "%3"=="FAT32" goto CreateUsb_FAT32
55 @if "%3"=="FAT12" goto WrongFATType
56
57 :CreateUsb_FAT16
58 @if "%4"=="step2" goto CreateUsb_FAT16_step2
59 @echo Format %EFI_BOOT_DISK% ...
60 @echo.> FormatCommandInput.txt
61 @format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
62 @del FormatCommandInput.txt
63 @echo Create boot sector ...
64 @%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs16.com
65 @%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs16.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs16.com -f
66 @%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs16.com
67 @%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Mbr.com
68 @echo Done.
69 @echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
70 @goto end
71
72 :CreateUsb_FAT16_step2
73 @copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%
74 @mkdir %EFI_BOOT_DISK%\efi\boot
75 @copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
76 @goto end
77
78 :CreateUsb_FAT32
79 @if "%4"=="step2" goto CreateUsb_FAT32_step2
80 @echo Format %EFI_BOOT_DISK% ...
81 @echo.> FormatCommandInput.txt
82 @format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
83 @del FormatCommandInput.txt
84 @echo Create boot sector ...
85 @%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs32.com
86 @%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs32.com %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs32.com -f
87 @del UsbBs32.com
88 @%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Bs32.com
89 @%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT\Mbr.com
90 @echo Done.
91 @echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
92 @goto end
93
94 :CreateUsb_FAT32_step2
95 @copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%
96 @mkdir %EFI_BOOT_DISK%\efi\boot
97 @copy %WORKSPACE%\EdkShellBinPkg\bin\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
98 @goto end
99
100 :CreateIde
101 @goto end
102
103 :WrongFATType
104 @echo Wrong FAT type %3 for %1
105 @goto end
106
107 :Help
108 @echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32]"
109 :end
110 @echo on