]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/CreateBootDisk.bat
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / DuetPkg / CreateBootDisk.bat
index 2272a11dcab957111815a507d3b5a4545501ef45..9a421d7ea7538edcbabc73aa4d725c129a3baa27 100644 (file)
@@ -1,22 +1,46 @@
-@REM\r
+@REM ## @file\r
+@REM #\r
+@REM #  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+@REM #\r
+@REM #  This program and the accompanying materials\r
+@REM #  are licensed and made available under the terms and conditions of the BSD License\r
+@REM #  which accompanies this distribution. The full text of the license may be found at\r
+@REM #  http://opensource.org/licenses/bsd-license.php\r
+@REM #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+@REM #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+@REM #\r
+@REM #\r
+@REM ##\r
 \r
-@REM Set up environment at fisrt.\r
+@REM Set up environment at first.\r
 \r
 @set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32\r
-@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg\DEBUG_MYTOOLS\r
 @set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
 @set DISK_LABEL=DUET\r
-@echo on\r
+@set PROCESSOR=""\r
+@set STEP=1\r
+@call %WORKSPACE%\DuetPkg\GetVariables.bat\r
 \r
+@echo on\r
 \r
 @if "%1"=="" goto Help\r
 @if "%2"=="" goto Help\r
 @if "%3"=="" goto Help\r
+@if "%4"=="" goto Set_BootDisk\r
+@if "%4"=="step2" (@set STEP=2) else @set TARGET_ARCH=%4\r
+@if "%5"=="step2" @set STEP=2\r
+:Set_BootDisk\r
 @set EFI_BOOT_DISK=%2\r
+@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32\r
+@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64\r
+@if %PROCESSOR%=="" goto WrongArch\r
+@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
+\r
 @if "%1"=="floppy" goto CreateFloppy\r
 @if "%1"=="file" goto CreateFile\r
 @if "%1"=="usb" goto CreateUsb\r
 @if "%1"=="ide" goto CreateIde\r
+\r
 goto Help\r
 \r
 :CreateFloppy\r
@@ -35,7 +59,8 @@ goto Help
 @echo Done.\r
 copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK%\r
 mkdir %EFI_BOOT_DISK%\efi\boot\r
-copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
+@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
+@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
 @goto end\r
 \r
 :CreateFile\r
@@ -56,7 +81,7 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\
 @if "%3"=="FAT12" goto WrongFATType\r
 \r
 :CreateUsb_FAT16\r
-@if "%4"=="step2" goto CreateUsb_FAT16_step2\r
+@if "%STEP%"=="2" goto CreateUsb_FAT16_step2\r
 @echo Format %EFI_BOOT_DISK% ...\r
 @echo.> FormatCommandInput.txt\r
 @format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
@@ -73,11 +98,12 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\
 :CreateUsb_FAT16_step2\r
 @copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK%\r
 @mkdir %EFI_BOOT_DISK%\efi\boot\r
-copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\Ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
+@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
+@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
 @goto end\r
 \r
 :CreateUsb_FAT32\r
-@if "%4"=="step2" goto CreateUsb_FAT32_step2\r
+@if "%STEP%"=="2" goto CreateUsb_FAT32_step2\r
 @echo Format %EFI_BOOT_DISK% ...\r
 @echo.> FormatCommandInput.txt\r
 @format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL\r
@@ -95,17 +121,30 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\Ia32\Shell.efi %EFI_BOOT_DISK%\efi\
 :CreateUsb_FAT32_step2\r
 @copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK%\r
 @mkdir %EFI_BOOT_DISK%\efi\boot\r
-@copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
+@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32\r
+@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64\r
 @goto end\r
 \r
 :CreateIde\r
 @goto end\r
 \r
+:CreateBootFileForIA32\r
+copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\IA32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y\r
+@goto end\r
+\r
+:CreateBootFileForX64\r
+copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootx64.efi /y\r
+@goto end\r
+\r
 :WrongFATType\r
 @echo Wrong FAT type %3 for %1\r
 @goto end\r
 \r
+:WrongArch\r
+@echo Error! Wrong architecture.\r
+@goto Help\r
+\r
 :Help\r
-@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32]"\r
+@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]"\r
 :end\r
 @echo on
\ No newline at end of file