summaryrefslogtreecommitdiff
path: root/DuetPkg/PostBuild.bat
diff options
context:
space:
mode:
Diffstat (limited to 'DuetPkg/PostBuild.bat')
-rw-r--r--DuetPkg/PostBuild.bat49
1 files changed, 31 insertions, 18 deletions
diff --git a/DuetPkg/PostBuild.bat b/DuetPkg/PostBuild.bat
index 28cab6b665..e7f27788ac 100644
--- a/DuetPkg/PostBuild.bat
+++ b/DuetPkg/PostBuild.bat
@@ -1,11 +1,9 @@
@echo off
@REM ## @file
@REM #
-@REM # Currently, Build system does not provide post build mechanism for module
-@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 # Post build script that will be automatically run after build.
@REM #
-@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+@REM # Copyright (c) 2010 - 2016, 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
@@ -17,18 +15,38 @@
@REM #
@REM ##
-set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
+set BASETOOLS_DIR=%EDK_TOOLS_BIN%
set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
-set PROCESSOR=""
-call %WORKSPACE%\DuetPkg\GetVariables.bat
-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
+:SetDefault
+set TARGET_ARCH=
+set TARGET=
+set TOOL_CHAIN_TAG=
+:ParseParamsLoop
+if "%1"=="" goto EndPParseParamsLoop
+if /I "%1"=="-p" goto ParseParamsLoopNext
+if /I "%1"=="-a" set TARGET_ARCH=%2& goto ParseParamsLoopNext
+if /I "%1"=="-b" set TARGET=%2& goto ParseParamsLoopNext
+if /I "%1"=="-t" set TOOL_CHAIN_TAG=%2& goto ParseParamsLoopNext
+if /I "%1"=="-h" goto Help
+
+:ParseParamsLoopNext
+shift
+shift
+goto ParseParamsLoop
+
+:EndPParseParamsLoop
+if "%TARGET_ARCH%"=="" goto Help
+if "%TARGET%"=="" goto Help
+if "%TOOL_CHAIN_TAG%"=="" goto Help
+
+set PROCESSOR=%TARGET_ARCH%
set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
+@REM Store environment variables used by CreateBootDisk.bat
+echo set TARGET=%TARGET%> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat
+echo set TOOL_CHAIN_TAG=%TOOL_CHAIN_TAG%>> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat
echo Compressing DUETEFIMainFv.FV ...
%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
@@ -60,11 +78,6 @@ copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_
%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20
goto end
-
-:WrongArch
-echo Error! Wrong architecture.
-goto Help
-
:Help
-echo Usage: "PostBuild [IA32|X64]"
-:end \ No newline at end of file
+echo Usage: This script will be run automatically after build.
+:end