summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-01 04:48:45 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-01 04:48:45 +0000
commit7708d081953fd7541cbcf233904c854a1800780e (patch)
treebb8242c6868b138d67f812b997a0ee710eee8d6b
parent976f617719571585c78a9e80abacfcb73148979b (diff)
downloadedk2-platforms-7708d081953fd7541cbcf233904c854a1800780e.tar.xz
Fix CreateBootDisk.bat not using config variables
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
-rw-r--r--DuetPkg/CreateBootDisk.bat25
-rw-r--r--DuetPkg/GetVariables.bat38
-rw-r--r--DuetPkg/PostBuild.bat15
3 files changed, 57 insertions, 21 deletions
diff --git a/DuetPkg/CreateBootDisk.bat b/DuetPkg/CreateBootDisk.bat
index b82b22abdf..9a421d7ea7 100644
--- a/DuetPkg/CreateBootDisk.bat
+++ b/DuetPkg/CreateBootDisk.bat
@@ -1,6 +1,6 @@
@REM ## @file
@REM #
-@REM # Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
@REM #
@REM # This program and the accompanying materials
@REM # are licensed and made available under the terms and conditions of the BSD License
@@ -12,24 +12,29 @@
@REM #
@REM ##
-@REM Set up environment at fisrt.
+@REM Set up environment at first.
@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
@set DISK_LABEL=DUET
@set PROCESSOR=""
+@set STEP=1
+@call %WORKSPACE%\DuetPkg\GetVariables.bat
@echo on
@if "%1"=="" goto Help
@if "%2"=="" goto Help
@if "%3"=="" goto Help
-@if "%4"=="" goto NoArch
+@if "%4"=="" goto Set_BootDisk
+@if "%4"=="step2" (@set STEP=2) else @set TARGET_ARCH=%4
+@if "%5"=="step2" @set STEP=2
+:Set_BootDisk
@set EFI_BOOT_DISK=%2
-@if "%4"=="IA32" set PROCESSOR=IA32
-@if "%4"=="X64" set PROCESSOR=X64
+@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32
+@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64
@if %PROCESSOR%=="" goto WrongArch
-@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\DEBUG_MYTOOLS
+@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
@if "%1"=="floppy" goto CreateFloppy
@if "%1"=="file" goto CreateFile
@@ -76,7 +81,7 @@ mkdir %EFI_BOOT_DISK%\efi\boot
@if "%3"=="FAT12" goto WrongFATType
:CreateUsb_FAT16
-@if "%5"=="step2" goto CreateUsb_FAT16_step2
+@if "%STEP%"=="2" goto CreateUsb_FAT16_step2
@echo Format %EFI_BOOT_DISK% ...
@echo.> FormatCommandInput.txt
@format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
@@ -98,7 +103,7 @@ mkdir %EFI_BOOT_DISK%\efi\boot
@goto end
:CreateUsb_FAT32
-@if "%5"=="step2" goto CreateUsb_FAT32_step2
+@if "%STEP%"=="2" goto CreateUsb_FAT32_step2
@echo Format %EFI_BOOT_DISK% ...
@echo.> FormatCommandInput.txt
@format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL
@@ -135,10 +140,6 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\b
@echo Wrong FAT type %3 for %1
@goto end
-:NoArch
-@echo Error! Please specific the architecture.
-@goto Help
-
:WrongArch
@echo Error! Wrong architecture.
@goto Help
diff --git a/DuetPkg/GetVariables.bat b/DuetPkg/GetVariables.bat
new file mode 100644
index 0000000000..c781228854
--- /dev/null
+++ b/DuetPkg/GetVariables.bat
@@ -0,0 +1,38 @@
+@REM ## @file
+@REM #
+@REM # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+@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 ##
+
+
+@REM Read the variables from Conf/target.txt
+@REM Because we can't add '=' as a delimiter in 'for', each variable is read in 2 parts:
+@REM First we read the "= xyz" part of the variable assignation which we use, along with
+@REM the original equal sign for our first assignation. Then we trim any left whitespaces.
+@REM NB: default token delimiters for "for /f" are tab and space.
+
+@set CONFIG_FILE=%WORKSPACE%\Conf\target.txt
+
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TOOL_CHAIN_TAG" ^| find /V "#"') do @set TOOL_CHAIN_TAG%%j
+@for /f "tokens=*" %%i in ("%TOOL_CHAIN_TAG%") do @set TOOL_CHAIN_TAG=%%i
+
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET" ^| find /V "#" ^| find /V "TARGET_ARCH"') do @set TARGET%%j
+@for /f "tokens=*" %%i in ("%TARGET%") do @set TARGET=%%i
+
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET_ARCH" ^|find /V "#"') do @set TARGET_ARCH%%j
+@for /f "tokens=*" %%i in ("%TARGET_ARCH%") do @set TARGET_ARCH=%%i
+
+
+@REM Set defaults if above variables are undefined in target.txt
+
+@if "%TOOL_CHAIN_TAG%%"=="" @set TOOL_CHAIN_TAG=MYTOOLS
+@if "%TARGET%"=="" @set TARGET=DEBUG
+@if "%TARGET_ARCH%"=="" @set TARGET_ARCH=IA32
diff --git a/DuetPkg/PostBuild.bat b/DuetPkg/PostBuild.bat
index 6d71aeb180..bdcafb864f 100644
--- a/DuetPkg/PostBuild.bat
+++ b/DuetPkg/PostBuild.bat
@@ -4,7 +4,7 @@
@REM # and platform building, so just use a bat file to do post build commands.
@REM # Originally, following post building command is for EfiLoader module.
@REM #
-@REM # Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
@REM #
@REM # This program and the accompanying materials
@REM # are licensed and made available under the terms and conditions of the BSD License
@@ -19,13 +19,14 @@
@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
@set PROCESSOR=""
+@call %WORKSPACE%\DuetPkg\GetVariables.bat
-@if "%1"=="" goto NoArch
-@if "%1"=="IA32" set PROCESSOR=IA32
-@if "%1"=="X64" set PROCESSOR=X64
+@if NOT "%1"=="" @set TARGET_ARCH=%1
+@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32
+@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64
@if %PROCESSOR%=="" goto WrongArch
-@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\DEBUG_MYTOOLS
+@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
@echo Compressing DUETEFIMainFv.FV ...
@@ -59,10 +60,6 @@
@goto end
-:NoArch
-@echo Error! Please specific the architecture.
-@goto Help
-
:WrongArch
@echo Error! Wrong architecture.
@goto Help