summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh108
1 files changed, 108 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..78a6776
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+BUILD_OPTIONS="-c platforms.config -b DEBUG -b RELEASE"
+
+ARM_TF_REPO=https://github.com/ARM-software/arm-trusted-firmware.git
+EDK2_REPO=https://github.com/tianocore/edk2.git
+EDK2_PLATFORMS_REPO=https://github.com/tianocore/edk2-platforms.git
+EDK2_NON_OSI_REPO=https://github.com/tianocore/edk2-non-osi.git
+UEFI_TOOLS_REPO=https://git.linaro.org/uefi/uefi-tools.git
+
+ARM_TF_HASH=ccd0c24cf89cb2195cbb38b6bb0639769afef7c5
+EDK2_HASH=4bbf39632c840e32996e8d43137f23fb43282859
+EDK2_PLATFORMS_HASH=1727ed8024639f32f75c4eb23c4b5691a52aa922
+EDK2_NON_OSI_HASH=5f76141f299780cb3a64f007126261c6c3157d75
+UEFI_TOOLS_HASH=42eac07beb4da42a182d2a87d6b2e928fc9a31cf
+
+REPO_ORIGIN=
+REPO_HASH=
+set_current_repo()
+{
+ case $1 in
+ arm-trusted-firmware)
+ REPO_ORIGIN=$ARM_TF_REPO
+ REPO_HASH=$ARM_TF_HASH
+ ;;
+ edk2)
+ REPO_ORIGIN=$EDK2_REPO
+ REPO_HASH=$EDK2_HASH
+ ;;
+ edk2-platforms)
+ REPO_ORIGIN=$EDK2_PLATFORMS_REPO
+ REPO_HASH=$EDK2_PLATFORMS_HASH
+ ;;
+ edk2-non-osi)
+ REPO_ORIGIN=$EDK2_NON_OSI_REPO
+ REPO_HASH=$EDK2_NON_OSI_HASH
+ ;;
+ uefi-tools)
+ REPO_ORIGIN=$UEFI_TOOLS_REPO
+ REPO_HASH=$UEFI_TOOLS_HASH
+ ;;
+ *)
+ echo "Invalid repository '$1'" >&2
+ exit 1
+ ;;
+ esac
+
+ echo REPO_ORIGIN=$REPO_ORIGIN
+ echo REPO_HASH=$REPO_HASH
+}
+
+update_repo()
+{
+ set_current_repo $1
+
+ cd $1
+
+ CURRENT_ORIGIN=`git config --get remote.origin.url`
+ if [ $REPO_ORIGIN != $CURRENT_ORIGIN ]; then
+ echo "Existing checkout of '$1' has unexpected origin '$REPO_ORIGIN'" >&2
+ exit 1
+ fi
+
+ git checkout master
+ [ $? -ne 0 ] && echo "Failed to check out master branch!" >&2 && exit 1
+
+ git fetch origin
+ [ $? -ne 0 ] && echo "Failed to fetch from '$CURRENT_ORIGIN'!" >&2 && exit 1
+
+ git reset --hard $REPO_HASH
+ [ $? -ne 0 ] && echo "Failed to reset '$1' to '$REPO_HASH'!" >&2 && exit 1
+
+ cd -
+}
+
+get_repo()
+{
+ TARGET_DIR=$1
+ if [ -d $TARGET_DIR ]; then
+ update_repo $TARGET_DIR
+ if [ $? -ne 0 ]; then
+ echo "Failed to obtain specified version of '$TARGET_DIR'" >&2
+ exit 1
+ fi
+ else
+ set_current_repo $1
+ echo git clone $REPO_ORIGIN
+ git clone $REPO_ORIGIN
+ fi
+}
+
+build_all()
+{
+ echo ./uefi-tools/edk2-build.sh $BUILD_OPTIONS all
+ ./uefi-tools/edk2-build.sh $BUILD_OPTIONS all
+}
+
+BUILD_OPTIONS="$BUILD_OPTIONS $*"
+
+for repo in arm-trusted-firmware edk2 edk2-platforms edk2-non-osi uefi-tools
+do
+ echo "$repo"
+ get_repo $repo
+done
+
+rm -rf Build
+
+build_all