diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-11-11 16:21:35 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-11-14 19:33:11 +0800 |
commit | bab82372a9e6ce066fa725a792e71d07191046ca (patch) | |
tree | 8f7f709bb0b64ce8e972f37a901c2b49e0a1d3f5 /DuetPkg/PostBuild.sh | |
parent | ea4511d127f45e5028996aba6613b4807c3c7902 (diff) | |
download | edk2-bab82372a9e6ce066fa725a792e71d07191046ca.tar.gz |
DuetPkg: Add POSTBUILD in DSC files to run post-build automatically
https://bugzilla.tianocore.org/show_bug.cgi?id=220
Currently, the post-build scripts PostBuild.bat/PostBuild.sh in DuetPkg
need to be run manually. Especially for Windows batch script, it also
requires users to set the build options (like tool chain, target and arch)
in file Conf/target.txt. If users using command line options via '-t' or
'-a', the post-build script won't work properly.
The package DSC files now support the feature to execute post-build script
automatically by adding a 'POSTBUILD' definition. This feature also passes
the build options into the post-build script as parameters. This commit
uses this feature to make the post-build works for DuetPkg more
user-friendly. Also, ReadMe.txt is updated to reflect the new steps for
UEFI Emulation (DUET) development.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'DuetPkg/PostBuild.sh')
-rwxr-xr-x | DuetPkg/PostBuild.sh | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/DuetPkg/PostBuild.sh b/DuetPkg/PostBuild.sh index 6f307e1c7e..524c9d7047 100755 --- a/DuetPkg/PostBuild.sh +++ b/DuetPkg/PostBuild.sh @@ -2,9 +2,7 @@ ## @file # -# Currently, Build system does not provide post build mechanism for module -# and platform building, so just use a sh file to do post build commands. -# Originally, following post building command is for EfiLoader module. +# Post build script that will be automatically run after build. # # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> # @@ -26,43 +24,33 @@ fi export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin export PROCESSOR="" -if [ \ - -z "$1" -o \ - "$1" = "-?" -o \ - "$1" = "-h" -o \ - "$1" = "--help" \ - ] -then - echo Error! Please specific the architecture. - echo Usage: "./PostBuild.sh [IA32|X64] [UNIXGCC|GCC44]" +export TOOLTAG="" + +while [ $# -gt 0 ]; do + if [ "$1" = "-a" ]; then + export PROCESSOR=$2 + elif [ "$1" = "-t" ]; then + export TOOLTAG=$2 + elif [ "$1" = "-h" ]; then + echo Usage: This script will be run automatically after build. + return 1 + fi + shift + shift +done + +if [ "$PROCESSOR" = "" -o "$TOOLTAG" = "" ]; then + echo Usage: This script will be run automatically after build. + return 1 fi -case "$1" in - IA32) - export PROCESSOR=IA32 - ;; - X64) - export PROCESSOR=X64 - ;; - *) - echo Invalid Architecture string, should be only IA32 or X64 - return 1 -esac - -case "$2" in - UNIXGCC) - export TOOLTAG=UNIXGCC - ;; - GCC4*) - export TOOLTAG=$2 - ;; - *) - echo Invalid tool tag, should be only UNIXGCC or GCC4\* - return 1 -esac - export BUILD_DIR=$WORKSPACE/Build/DuetPkg$PROCESSOR/DEBUG_$TOOLTAG +# +# Store environment variables used by CreateBootDisk.sh +# +echo export TOOLCHAIN=$TOOLTAG> $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh +chmod +x $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh # # Boot sector module could only be built under IA32 tool chain |