From f37efe4efec699e6ecabc79ee0e92910a8a61766 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Mon, 19 Jun 2017 16:25:42 +0100 Subject: edk2-build.sh: fix bug in toolchain profile selection Preserve default value of TOOLCHAIN while iterating over platforms. Signed-off-by: Leif Lindholm --- edk2-build.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/edk2-build.sh b/edk2-build.sh index a971745..ab45f13 100755 --- a/edk2-build.sh +++ b/edk2-build.sh @@ -86,16 +86,19 @@ function do_build case $TOOLCHAIN in "gcc") - export TOOLCHAIN=`get_gcc_version "$CROSS_COMPILE"gcc` + export PLATFORM_TOOLCHAIN=`get_gcc_version "$CROSS_COMPILE"gcc` ;; "clang") - export TOOLCHAIN=`get_clang_version clang` + export PLATFORM_TOOLCHAIN=`get_clang_version clang` + ;; + *) + # Use command-line specified profile directly ;; esac - echo "TOOLCHAIN is ${TOOLCHAIN}" + echo "PLATFORM_TOOLCHAIN is ${PLATFORM_TOOLCHAIN}" - export ${TOOLCHAIN}_${PLATFORM_ARCH}_PREFIX=$CROSS_COMPILE - echo "Toolchain prefix: ${TOOLCHAIN}_${PLATFORM_ARCH}_PREFIX=$CROSS_COMPILE" + export ${PLATFORM_TOOLCHAIN}_${PLATFORM_ARCH}_PREFIX=$CROSS_COMPILE + echo "Toolchain prefix: ${PLATFORM_TOOLCHAIN}_${PLATFORM_ARCH}_PREFIX=$CROSS_COMPILE" export PACKAGES_PATH="$PLATFORM_PACKAGES_PATH" for target in "${TARGETS[@]}" ; do @@ -110,18 +113,18 @@ function do_build if [ -n "$COMPONENT_INF" ]; then # Build a standalone component if [ $VERBOSE -eq 1 ]; then - echo "build -n $NUM_THREADS -a \"$PLATFORM_ARCH\" -t ${TOOLCHAIN} -p \"$PLATFORM_DSC\"" \ + echo "build -n $NUM_THREADS -a \"$PLATFORM_ARCH\" -t ${PLATFORM_TOOLCHAIN} -p \"$PLATFORM_DSC\"" \ "-m \"$COMPONENT_INF\" -b "$target" ${PLATFORM_BUILDFLAGS}" fi - build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" \ + build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${PLATFORM_TOOLCHAIN} -p "$PLATFORM_DSC" \ -m "$COMPONENT_INF" -b "$target" ${PLATFORM_BUILDFLAGS} else # Build a platform if [ $VERBOSE -eq 1 ]; then - echo "build -n $NUM_THREADS -a \"$PLATFORM_ARCH\" -t ${TOOLCHAIN} -p \"$PLATFORM_DSC\"" \ + echo "build -n $NUM_THREADS -a \"$PLATFORM_ARCH\" -t ${PLATFORM_TOOLCHAIN} -p \"$PLATFORM_DSC\"" \ "-b "$target" ${PLATFORM_BUILDFLAGS}" fi - build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" \ + build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${PLATFORM_TOOLCHAIN} -p "$PLATFORM_DSC" \ -b "$target" ${PLATFORM_BUILDFLAGS} fi @@ -130,9 +133,9 @@ function do_build if [ X"$TOS_DIR" != X"" ]; then pushd $TOS_DIR >/dev/null if [ $VERBOSE -eq 1 ]; then - echo "$TOOLS_DIR/tos-build.sh -e "$EDK2_DIR" -t "$target"_${TOOLCHAIN} $board" + echo "$TOOLS_DIR/tos-build.sh -e "$EDK2_DIR" -t "$target"_${PLATFORM_TOOLCHAIN} $board" fi - $TOOLS_DIR/tos-build.sh -e "$EDK2_DIR" -t "$target"_${TOOLCHAIN} $board + $TOOLS_DIR/tos-build.sh -e "$EDK2_DIR" -t "$target"_${PLATFORM_TOOLCHAIN} $board RESULT=$? popd >/dev/null fi @@ -141,9 +144,9 @@ function do_build if [ X"$ATF_DIR" != X"" ]; then pushd $ATF_DIR >/dev/null if [ $VERBOSE -eq 1 ]; then - echo "$TOOLS_DIR/atf-build.sh -e "$EDK2_DIR" -t "$target"_${TOOLCHAIN} $board" + echo "$TOOLS_DIR/atf-build.sh -e "$EDK2_DIR" -t "$target"_${PLATFORM_TOOLCHAIN} $board" fi - $TOOLS_DIR/atf-build.sh -e "$EDK2_DIR" -t "$target"_${TOOLCHAIN} $board + $TOOLS_DIR/atf-build.sh -e "$EDK2_DIR" -t "$target"_${PLATFORM_TOOLCHAIN} $board RESULT=$? popd >/dev/null fi -- cgit v1.2.3