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