4 @REM # Copyright
(c
) 2010 - 2014, Intel Corporation. All rights reserved.
<BR
>
6 @REM # This program and the accompanying materials
7 @REM # are licensed and made available under the terms and conditions of the BSD License
8 @REM # which accompanies this distribution. The full text of the license may be found at
9 @REM # http
://opensource.org
/licenses
/bsd
-license.php
10 @REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
"AS IS" BASIS
,
11 @REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND
, EITHER EXPRESS OR IMPLIED.
16 @REM
Set up environment at first.
18 set BASETOOLS_DIR
=%WORKSPACE_TOOLS_PATH%\Bin\Win32
19 set BOOTSECTOR_BIN_DIR
=%WORKSPACE%\DuetPkg\BootSector
\bin
23 call %WORKSPACE%\DuetPkg\GetVariables.bat
30 if "%4"=="" goto Set_BootDisk
31 if "%4"=="step2" (@
set STEP
=2) else @
set TARGET_ARCH
=%4
32 if "%5"=="step2" @
set STEP
=2
35 if "%TARGET_ARCH%"=="IA32" set PROCESSOR
=IA32
36 if "%TARGET_ARCH%"=="X64" set PROCESSOR
=X64
37 if %PROCESSOR%=="" goto WrongArch
38 set BUILD_DIR
=%WORKSPACE%\Build\DuetPkg
%PROCESSOR%\
%TARGET%_
%TOOL_CHAIN_TAG%
40 if "%1"=="floppy" goto CreateFloppy
41 if "%1"=="file" goto CreateFile
42 if "%1"=="usb" goto CreateUsb
43 if "%1"=="ide" goto CreateIde
48 if NOT "%3"=="FAT12" goto WrongFATType
49 echo Start to create floppy
boot disk ...
50 echo Format %EFI_BOOT_DISK% ...
51 echo.
> FormatCommandInput.txt
52 echo.n
>> FormatCommandInput.txt
53 format /v
:%DISK_LABEL% /q
%EFI_BOOT_DISK% < FormatCommandInput.txt
> NUL
54 del FormatCommandInput.txt
55 echo Create
boot sector ...
56 %BASETOOLS_DIR%\Genbootsector.exe
-i
%EFI_BOOT_DISK% -o FDBs.com
57 copy %BOOTSECTOR_BIN_DIR%\Bootsect.com FDBs
-1.com
58 %BASETOOLS_DIR%\Bootsectimage.exe
-g FDBs.com FDBs
-1.com
-f
60 %BASETOOLS_DIR%\Genbootsector.exe
-o
%EFI_BOOT_DISK% -i FDBs
-1.com
63 copy %BUILD_DIR%\FV\EfiLdr
%EFI_BOOT_DISK%
67 if NOT "%3"=="FAT12" goto WrongFATType
68 echo Start to create file
boot disk ...
69 echo Create
boot sector ...
70 %BASETOOLS_DIR%\Genbootsector.exe
-i
%EFI_BOOT_DISK% -o FDBs.com
71 copy %BOOTSECTOR_BIN_DIR%\Bootsect.com FDBs
-1.com
72 %BASETOOLS_DIR%\Bootsectimage.exe
-g FDBs.com FDBs
-1.com
-f
74 %BASETOOLS_DIR%\Genbootsector.exe
-o
%EFI_BOOT_DISK% -i FDBs
-1.com
80 echo Start to create usb
boot disk ...
81 if "%3"=="FAT16" goto CreateUsb_FAT16
82 if "%3"=="FAT32" goto CreateUsb_FAT32
83 if "%3"=="FAT12" goto WrongFATType
86 if "%STEP%"=="2" goto CreateUsb_FAT16_step2
87 echo Format %EFI_BOOT_DISK% ...
88 echo.
> FormatCommandInput.txt
89 format /FS
:FAT /v
:%DISK_LABEL% /q
%EFI_BOOT_DISK% < FormatCommandInput.txt
> NUL
90 del FormatCommandInput.txt
91 echo Create
boot sector ...
92 %BASETOOLS_DIR%\Genbootsector.exe
-i
%EFI_BOOT_DISK% -o UsbBs16.com
93 copy %BOOTSECTOR_BIN_DIR%\Bs16.com Bs16
-1.com
94 %BASETOOLS_DIR%\Bootsectimage.exe
-g UsbBs16.com Bs16
-1.com
-f
95 %BASETOOLS_DIR%\Genbootsector.exe
-o
%EFI_BOOT_DISK% -i Bs16
-1.com
97 %BASETOOLS_DIR%\Genbootsector.exe
-m
-o
%EFI_BOOT_DISK% -i
%BOOTSECTOR_BIN_DIR%\Mbr.com
99 echo PLEASE UNPLUG USB
, THEN PLUG IT AGAIN
!
102 :CreateUsb_FAT16_step2
103 copy %BUILD_DIR%\FV\EfiLdr16
%EFI_BOOT_DISK%
107 if "%STEP%"=="2" goto CreateUsb_FAT32_step2
108 echo Format %EFI_BOOT_DISK% ...
109 echo.
> FormatCommandInput.txt
110 format /FS
:FAT32 /v
:%DISK_LABEL% /q
%EFI_BOOT_DISK% < FormatCommandInput.txt
> NUL
111 del FormatCommandInput.txt
112 echo Create
boot sector ...
113 %BASETOOLS_DIR%\Genbootsector.exe
-i
%EFI_BOOT_DISK% -o UsbBs32.com
114 copy %BOOTSECTOR_BIN_DIR%\Bs32.com Bs32
-1.com
115 %BASETOOLS_DIR%\Bootsectimage.exe
-g UsbBs32.com Bs32
-1.com
-f
117 %BASETOOLS_DIR%\Genbootsector.exe
-o
%EFI_BOOT_DISK% -i Bs32
-1.com
119 %BASETOOLS_DIR%\Genbootsector.exe
-m
-o
%EFI_BOOT_DISK% -i
%BOOTSECTOR_BIN_DIR%\Mbr.com
121 echo PLEASE UNPLUG USB
, THEN PLUG IT AGAIN
!
124 :CreateUsb_FAT32_step2
125 copy %BUILD_DIR%\FV\EfiLdr20
%EFI_BOOT_DISK%
132 mkdir %EFI_BOOT_DISK%\efi
\boot
133 copy %WORKSPACE%\ShellBinPkg\UefiShell\
%PROCESSOR%\
Shell.efi
%EFI_BOOT_DISK%\efi
\boot
\boot
%PROCESSOR%.efi
/y
137 echo Wrong FAT
type %3 for %1
141 echo Error
! Wrong architecture.
145 echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]"