2010-03-10 02:23:13 +01:00
|
|
|
@REM ## @file
|
|
|
|
@REM #
|
2011-07-01 06:48:45 +02:00
|
|
|
@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
2010-03-10 02:23:13 +01:00
|
|
|
@REM #
|
|
|
|
@REM # This program and the accompanying materials
|
|
|
|
@REM # are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
@REM # which accompanies this distribution. The full text of the license may be found at
|
|
|
|
@REM # http://opensource.org/licenses/bsd-license.php
|
|
|
|
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
@REM #
|
|
|
|
@REM #
|
|
|
|
@REM ##
|
2008-05-07 07:11:29 +02:00
|
|
|
|
2011-07-01 06:48:45 +02:00
|
|
|
@REM Set up environment at first.
|
2008-05-07 07:11:29 +02:00
|
|
|
|
2009-01-06 05:38:58 +01:00
|
|
|
@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
|
2009-06-22 05:01:53 +02:00
|
|
|
@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
|
2008-05-07 07:11:29 +02:00
|
|
|
@set DISK_LABEL=DUET
|
2010-01-19 09:28:28 +01:00
|
|
|
@set PROCESSOR=""
|
2011-07-01 06:48:45 +02:00
|
|
|
@set STEP=1
|
|
|
|
@call %WORKSPACE%\DuetPkg\GetVariables.bat
|
2008-05-07 07:11:29 +02:00
|
|
|
|
2010-01-19 09:28:28 +01:00
|
|
|
@echo on
|
2008-05-07 07:11:29 +02:00
|
|
|
|
|
|
|
@if "%1"=="" goto Help
|
|
|
|
@if "%2"=="" goto Help
|
|
|
|
@if "%3"=="" goto Help
|
2011-07-01 06:48:45 +02:00
|
|
|
@if "%4"=="" goto Set_BootDisk
|
|
|
|
@if "%4"=="step2" (@set STEP=2) else @set TARGET_ARCH=%4
|
|
|
|
@if "%5"=="step2" @set STEP=2
|
|
|
|
:Set_BootDisk
|
2008-05-07 07:11:29 +02:00
|
|
|
@set EFI_BOOT_DISK=%2
|
2011-07-01 06:48:45 +02:00
|
|
|
@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32
|
|
|
|
@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64
|
2010-01-19 09:28:28 +01:00
|
|
|
@if %PROCESSOR%=="" goto WrongArch
|
2011-07-01 06:48:45 +02:00
|
|
|
@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
|
2010-03-18 03:36:52 +01:00
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
@if "%1"=="floppy" goto CreateFloppy
|
2009-01-06 04:25:24 +01:00
|
|
|
@if "%1"=="file" goto CreateFile
|
2008-05-07 07:11:29 +02:00
|
|
|
@if "%1"=="usb" goto CreateUsb
|
|
|
|
@if "%1"=="ide" goto CreateIde
|
2010-01-19 09:28:28 +01:00
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
goto Help
|
|
|
|
|
|
|
|
:CreateFloppy
|
|
|
|
@if NOT "%3"=="FAT12" goto WrongFATType
|
|
|
|
@echo Start to create floppy boot disk ...
|
|
|
|
@echo Format %EFI_BOOT_DISK% ...
|
|
|
|
@echo.> FormatCommandInput.txt
|
|
|
|
@echo.n>> FormatCommandInput.txt
|
|
|
|
@format /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
|
|
|
|
@del FormatCommandInput.txt
|
|
|
|
@echo Create boot sector ...
|
|
|
|
%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
|
2014-07-09 10:28:05 +02:00
|
|
|
@copy %BOOTSECTOR_BIN_DIR%\Bootsect.com FDBs-1.com
|
|
|
|
%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com FDBs-1.com -f
|
2008-05-07 07:11:29 +02:00
|
|
|
@REM @del FDBS.com
|
2014-07-09 10:28:05 +02:00
|
|
|
%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i FDBs-1.com
|
|
|
|
@del FDBs-1.com
|
2008-05-07 07:11:29 +02:00
|
|
|
@echo Done.
|
|
|
|
copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%
|
|
|
|
mkdir %EFI_BOOT_DISK%\efi\boot
|
2010-01-19 09:28:28 +01:00
|
|
|
@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32
|
|
|
|
@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64
|
2008-05-07 07:11:29 +02:00
|
|
|
@goto end
|
|
|
|
|
2009-01-06 04:25:24 +01:00
|
|
|
:CreateFile
|
|
|
|
@if NOT "%3"=="FAT12" goto WrongFATType
|
|
|
|
@echo Start to create file boot disk ...
|
|
|
|
@echo Create boot sector ...
|
|
|
|
%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o FDBs.com
|
2014-07-09 10:28:05 +02:00
|
|
|
copy %BOOTSECTOR_BIN_DIR%\Bootsect.com FDBs-1.com
|
|
|
|
%BASETOOLS_DIR%\Bootsectimage.exe -g FDBs.com FDBs-1.com -f
|
2009-01-06 04:25:24 +01:00
|
|
|
@REM @del FDBS.com
|
2014-07-09 10:28:05 +02:00
|
|
|
%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i FDBs-1.com
|
|
|
|
@del FDBs-1.com
|
2009-01-06 04:25:24 +01:00
|
|
|
@echo Done.
|
|
|
|
@goto end
|
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
:CreateUsb
|
|
|
|
@echo Start to create usb boot disk ...
|
|
|
|
@if "%3"=="FAT16" goto CreateUsb_FAT16
|
|
|
|
@if "%3"=="FAT32" goto CreateUsb_FAT32
|
|
|
|
@if "%3"=="FAT12" goto WrongFATType
|
|
|
|
|
|
|
|
:CreateUsb_FAT16
|
2011-07-01 06:48:45 +02:00
|
|
|
@if "%STEP%"=="2" goto CreateUsb_FAT16_step2
|
2008-05-07 07:11:29 +02:00
|
|
|
@echo Format %EFI_BOOT_DISK% ...
|
|
|
|
@echo.> FormatCommandInput.txt
|
|
|
|
@format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
|
|
|
|
@del FormatCommandInput.txt
|
|
|
|
@echo Create boot sector ...
|
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs16.com
|
2014-07-09 10:28:05 +02:00
|
|
|
@copy %BOOTSECTOR_BIN_DIR%\Bs16.com Bs16-1.com
|
|
|
|
@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs16.com Bs16-1.com -f
|
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i Bs16-1.com
|
|
|
|
@del Bs16-1.com
|
2009-06-22 05:01:53 +02:00
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com
|
2009-01-06 04:25:24 +01:00
|
|
|
@echo Done.
|
|
|
|
@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
|
|
|
|
@goto end
|
|
|
|
|
|
|
|
:CreateUsb_FAT16_step2
|
2008-05-07 07:11:29 +02:00
|
|
|
@copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%
|
|
|
|
@mkdir %EFI_BOOT_DISK%\efi\boot
|
2010-01-19 09:28:28 +01:00
|
|
|
@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32
|
|
|
|
@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64
|
2008-05-07 07:11:29 +02:00
|
|
|
@goto end
|
|
|
|
|
|
|
|
:CreateUsb_FAT32
|
2011-07-01 06:48:45 +02:00
|
|
|
@if "%STEP%"=="2" goto CreateUsb_FAT32_step2
|
2008-05-07 07:11:29 +02:00
|
|
|
@echo Format %EFI_BOOT_DISK% ...
|
|
|
|
@echo.> FormatCommandInput.txt
|
|
|
|
@format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
|
|
|
|
@del FormatCommandInput.txt
|
|
|
|
@echo Create boot sector ...
|
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -i %EFI_BOOT_DISK% -o UsbBs32.com
|
2014-07-09 10:28:05 +02:00
|
|
|
@copy %BOOTSECTOR_BIN_DIR%\Bs32.com Bs32-1.com
|
|
|
|
@%BASETOOLS_DIR%\Bootsectimage.exe -g UsbBs32.com Bs32-1.com -f
|
2008-05-07 07:11:29 +02:00
|
|
|
@del UsbBs32.com
|
2014-07-09 10:28:05 +02:00
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -o %EFI_BOOT_DISK% -i Bs32-1.com
|
|
|
|
@del Bs32-1.com
|
2009-06-22 05:01:53 +02:00
|
|
|
@%BASETOOLS_DIR%\Genbootsector.exe -m -o %EFI_BOOT_DISK% -i %BOOTSECTOR_BIN_DIR%\Mbr.com
|
2008-05-07 07:11:29 +02:00
|
|
|
@echo Done.
|
|
|
|
@echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN!
|
|
|
|
@goto end
|
|
|
|
|
2009-03-01 09:04:03 +01:00
|
|
|
:CreateUsb_FAT32_step2
|
|
|
|
@copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%
|
|
|
|
@mkdir %EFI_BOOT_DISK%\efi\boot
|
2010-01-19 09:28:28 +01:00
|
|
|
@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32
|
|
|
|
@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64
|
2009-03-01 09:04:03 +01:00
|
|
|
@goto end
|
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
:CreateIde
|
|
|
|
@goto end
|
|
|
|
|
2010-01-19 09:28:28 +01:00
|
|
|
:CreateBootFileForIA32
|
|
|
|
copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\IA32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y
|
|
|
|
@goto end
|
|
|
|
|
|
|
|
:CreateBootFileForX64
|
|
|
|
copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootx64.efi /y
|
|
|
|
@goto end
|
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
:WrongFATType
|
|
|
|
@echo Wrong FAT type %3 for %1
|
|
|
|
@goto end
|
|
|
|
|
2010-01-19 09:28:28 +01:00
|
|
|
:WrongArch
|
|
|
|
@echo Error! Wrong architecture.
|
|
|
|
@goto Help
|
|
|
|
|
2008-05-07 07:11:29 +02:00
|
|
|
:Help
|
2010-01-19 09:28:28 +01:00
|
|
|
@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]"
|
2008-05-07 07:11:29 +02:00
|
|
|
:end
|
|
|
|
@echo on
|