]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix CreateBootDisk.bat not using config variables
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Jul 2011 04:48:45 +0000 (04:48 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Jul 2011 04:48:45 +0000 (04:48 +0000)
Signed-off-by: Pete Batard
Reviewed-by: niruiyu
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11941 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/CreateBootDisk.bat
DuetPkg/GetVariables.bat [new file with mode: 0644]
DuetPkg/PostBuild.bat

index b82b22abdf469de057c4c0b24df3dcb9197acac9..9a421d7ea7538edcbabc73aa4d725c129a3baa27 100644 (file)
@@ -1,6 +1,6 @@
 @REM ## @file\r
 @REM #\r
-@REM #  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\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 #\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 BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
 @set DISK_LABEL=DUET\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 NoArch\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 "%4"=="IA32" set PROCESSOR=IA32\r
-@if "%4"=="X64" set PROCESSOR=X64\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%\DEBUG_MYTOOLS\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
@@ -76,7 +81,7 @@ mkdir %EFI_BOOT_DISK%\efi\boot
 @if "%3"=="FAT12" goto WrongFATType\r
 \r
 :CreateUsb_FAT16\r
-@if "%5"=="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
@@ -98,7 +103,7 @@ mkdir %EFI_BOOT_DISK%\efi\boot
 @goto end\r
 \r
 :CreateUsb_FAT32\r
-@if "%5"=="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
@@ -135,10 +140,6 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\b
 @echo Wrong FAT type %3 for %1\r
 @goto end\r
 \r
-:NoArch\r
-@echo Error! Please specific the architecture.\r
-@goto Help\r
-\r
 :WrongArch\r
 @echo Error! Wrong architecture.\r
 @goto Help\r
diff --git a/DuetPkg/GetVariables.bat b/DuetPkg/GetVariables.bat
new file mode 100644 (file)
index 0000000..c781228
--- /dev/null
@@ -0,0 +1,38 @@
+@REM ## @file\r
+@REM #\r
+@REM #  Copyright (c) 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
+\r
+@REM Read the variables from Conf/target.txt\r
+@REM Because we can't add '=' as a delimiter in 'for', each variable is read in 2 parts:\r
+@REM First we read the "= xyz" part of the variable assignation which we use, along with\r
+@REM the original equal sign for our first assignation. Then we trim any left whitespaces.\r
+@REM NB: default token delimiters for "for /f" are tab and space.\r
+\r
+@set CONFIG_FILE=%WORKSPACE%\Conf\target.txt\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TOOL_CHAIN_TAG" ^| find /V "#"') do @set TOOL_CHAIN_TAG%%j\r
+@for /f "tokens=*" %%i in ("%TOOL_CHAIN_TAG%") do @set TOOL_CHAIN_TAG=%%i\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET" ^| find /V "#" ^| find /V "TARGET_ARCH"') do @set TARGET%%j\r
+@for /f "tokens=*" %%i in ("%TARGET%") do @set TARGET=%%i\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET_ARCH" ^|find /V "#"') do @set TARGET_ARCH%%j\r
+@for /f "tokens=*" %%i in ("%TARGET_ARCH%") do @set TARGET_ARCH=%%i\r
+\r
+\r
+@REM Set defaults if above variables are undefined in target.txt\r
+\r
+@if "%TOOL_CHAIN_TAG%%"=="" @set TOOL_CHAIN_TAG=MYTOOLS\r
+@if "%TARGET%"=="" @set TARGET=DEBUG\r
+@if "%TARGET_ARCH%"=="" @set TARGET_ARCH=IA32\r
index 6d71aeb1802950b8dbffed947be6be2164690f0a..bdcafb864ffccf17c1005b53d1c754974a4457cd 100644 (file)
@@ -4,7 +4,7 @@
 @REM #  and platform building, so just use a bat file to do post build commands.\r
 @REM #  Originally, following post building command is for EfiLoader module.\r
 @REM #\r
-@REM #  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\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
 @set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32\r
 @set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
 @set PROCESSOR=""\r
+@call %WORKSPACE%\DuetPkg\GetVariables.bat\r
 \r
-@if "%1"=="" goto NoArch\r
-@if "%1"=="IA32" set PROCESSOR=IA32\r
-@if "%1"=="X64" set PROCESSOR=X64\r
+@if NOT "%1"=="" @set TARGET_ARCH=%1\r
+@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32\r
+@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64\r
 @if %PROCESSOR%=="" goto WrongArch\r
 \r
-@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\DEBUG_MYTOOLS\r
+@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
 \r
 \r
 @echo Compressing DUETEFIMainFv.FV ...\r
 @goto end\r
 \r
 \r
-:NoArch\r
-@echo Error! Please specific the architecture.\r
-@goto Help\r
-\r
 :WrongArch\r
 @echo Error! Wrong architecture.\r
 @goto Help\r