From d275a9d3ae22f4cd0b21a9745a22fd172444e9c3 Mon Sep 17 00:00:00 2001 From: Raghavendra Rao Ananta Date: Wed, 4 Sep 2019 10:13:24 -0700 Subject: [PATCH] scripts: Consider env vaiables while running 'make' The scripts, gki/generate_defconfig.sh and kconfig/merge_config.sh doesn't consider the host exported environment variables (such as HOSTCC) while running 'make'. This is particularly needed in the Android build environment as it uses the compiler, linker, and other utilities from a pre-builts' path, rather than depending on the host tools. Hence, pass the environment variables explicitly. Change-Id: I082c0c05be5f4266fc647e3c1ebef8302e1a433a Signed-off-by: Raghavendra Rao Ananta --- scripts/gki/envsetup.sh | 7 +++++-- scripts/gki/generate_defconfig.sh | 14 ++++++++++++-- scripts/kconfig/merge_config.sh | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/gki/envsetup.sh b/scripts/gki/envsetup.sh index 445b0e4d3fa0..72ae068b142e 100755 --- a/scripts/gki/envsetup.sh +++ b/scripts/gki/envsetup.sh @@ -10,6 +10,9 @@ KERN_SRC=`pwd` : ${ARCH:=arm64} : ${CROSS_COMPILE:=aarch64-linux-gnu-} : ${REAL_CC:=clang} +: ${HOSTCC:=gcc} +: ${HOSTLD:ld} +: ${HOSTAR:ar} : ${KERN_OUT:=} CONFIGS_DIR=${KERN_SRC}/arch/${ARCH}/configs/vendor @@ -23,5 +26,5 @@ QCOM_GKI_FRAG=${CONFIGS_DIR}/${PLATFORM_NAME}_GKI.config QCOM_QGKI_FRAG=${CONFIGS_DIR}/${PLATFORM_NAME}_QGKI.config QCOM_DEBUG_FRAG=${CONFIGS_DIR}/${PLATFORM_NAME}_debug.config -export ARCH CROSS_COMPILE REAL_CC KERN_SRC KERN_OUT CONFIGS_DIR BASE_DEFCONFIG \ - QCOM_GKI_FRAG QCOM_QGKI_FRAG QCOM_DEBUG_FRAG +export ARCH CROSS_COMPILE REAL_CC HOSTCC HOSTLD HOSTAR KERN_SRC KERN_OUT \ + CONFIGS_DIR BASE_DEFCONFIG QCOM_GKI_FRAG QCOM_QGKI_FRAG QCOM_DEBUG_FRAG diff --git a/scripts/gki/generate_defconfig.sh b/scripts/gki/generate_defconfig.sh index 3b6cfeddc154..21cda67402b0 100755 --- a/scripts/gki/generate_defconfig.sh +++ b/scripts/gki/generate_defconfig.sh @@ -25,6 +25,15 @@ PLATFORM_NAME=`echo $PLATFORM_NAME | sed "s/vendor\///g"` # We should be in the kernel root after the envsetup source ${SCRIPTS_ROOT}/envsetup.sh $PLATFORM_NAME +KERN_MAKE_ARGS="ARCH=$ARCH \ + CROSS_COMPILE=$CROSS_COMPILE \ + REAL_CC=$REAL_CC \ + CLANG_TRIPLE=$CLANG_TRIPLE \ + HOSTCC=$HOSTCC \ + HOSTLD=$HOSTLD \ + HOSTAR=$HOSTAR \ + " + # Allyes fragment temporarily created on GKI config fragment QCOM_GKI_ALLYES_FRAG=${CONFIGS_DIR}/${PLATFORM_NAME}_ALLYES_GKI.config @@ -59,8 +68,9 @@ FINAL_DEFCONFIG_BLEND=`echo "${FINAL_DEFCONFIG_BLEND}" | awk '{ for (i=NF; i>1; echo "defconfig blend for $REQUIRED_DEFCONFIG: $FINAL_DEFCONFIG_BLEND" -${KERN_SRC}/scripts/kconfig/merge_config.sh $FINAL_DEFCONFIG_BLEND -make savedefconfig +MAKE_ARGS=$KERN_MAKE_ARGS \ + ${KERN_SRC}/scripts/kconfig/merge_config.sh $FINAL_DEFCONFIG_BLEND +make $KERN_MAKE_ARGS savedefconfig mv defconfig $CONFIGS_DIR/$REQUIRED_DEFCONFIG # Cleanup the allyes config fragment and other generated files diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index d924c51d28b7..b81dfb36774b 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -170,7 +170,7 @@ fi # Use the merged file as the starting point for: # alldefconfig: Fills in any missing symbols with Kconfig default # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set -make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET +make $MAKE_ARGS KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET # Check all specified config values took (might have missed-dependency issues)