aboutsummaryrefslogtreecommitdiff
path: root/build-uefi.sh
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2015-06-30 10:39:10 +0100
committerRyan Harkin <ryan.harkin@linaro.org>2015-07-01 14:14:03 +0100
commit7a0eaa0c9fcdf239834e0afec5a8e3801aefa1a1 (patch)
tree0584e2f9b93d3e71f92405a78467d4870172a66a /build-uefi.sh
parentcc915b7287c9db7b41cc83e8544626b56584e912 (diff)
build-uefi.sh: add git commit id to the version string
The user can provide a version string to the UEFI build by passing the "-D FIRMWARE_VER=string" parameter. This patch sets the firmware version to the short commit id of the HEAD commit and indicated if the repo has been modified by appending "dirty" to the commit id.. Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Diffstat (limited to 'build-uefi.sh')
-rwxr-xr-xbuild-uefi.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/build-uefi.sh b/build-uefi.sh
index faf13ad..9ebf687 100755
--- a/build-uefi.sh
+++ b/build-uefi.sh
@@ -52,6 +52,15 @@ do_build ()
export EDK2_TOOLCHAIN=$UEFI_TOOLCHAIN
export ${UEFI_TOOLCHAIN}_AARCH64_PREFIX=$CROSS_COMPILE
export EDK2_MACROS="-n $PARALLELISM"
+
+ if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+ FIRMWARE_VER=`git rev-parse --short HEAD`
+ if ! git diff-index --quiet HEAD --; then
+ FIRMWARE_VER="${FIRMWARE_VER}-dirty"
+ fi
+ export EDK2_MACROS="$EDK2_MACROS -D FIRMWARE_VER=\"$FIRMWARE_VER\""
+ fi
+
for item in $UEFI_PLATFORMS; do
make -f $item EDK2_BUILD=$UEFI_BUILD_MODE
done