summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliot Berman <eberman@codeaurora.org>2020-04-01 14:32:51 -0700
committerElliot Berman <eberman@codeaurora.org>2020-04-15 16:07:03 -0700
commitbbde34690f60b3a2e284cd235ebccaa9b1e85414 (patch)
treecd10d8c93952cf1deaaa4c8a61745586ecdf3982
parent2a2a5063fbffa1dc9bcb5e433076f943378e13c0 (diff)
downloadbuild-bbde34690f60b3a2e284cd235ebccaa9b1e85414.tar.gz
_setup_env.sh: Add helper function for adding command to _CMDS variables
This helper function will concatenate to a _CMDS variable. For instance, if one wanted to add update_debug_config from [1], but didn't know/care whether check_defconfig was present in POST_DEFCONFIG_CMDS, they could add "add_cmd POST_DEFCONFIG_CMDS 'update_debug_config'" to their build.config. [1] https://source.android.com/setup/build/building-kernels#customize-config Signed-off-by: Elliot Berman <eberman@codeaurora.org> Signed-off-by: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org> Change-Id: Ic55563b7d60012bd21c37ba5008612d8e6f0f9fb
-rw-r--r--_setup_env.sh11
-rwxr-xr-xbuild_abi.sh3
2 files changed, 13 insertions, 1 deletions
diff --git a/_setup_env.sh b/_setup_env.sh
index 6b941b94..82eb3964 100644
--- a/_setup_env.sh
+++ b/_setup_env.sh
@@ -24,6 +24,17 @@
export ROOT_DIR=$(readlink -f $PWD)
export BUILD_CONFIG=${BUILD_CONFIG:-build.config}
+
+# Helper function to let build.config files add command to PRE_DEFCONFIG_CMDS, EXTRA_CMDS, etc.
+# Usage: append_cmd PRE_DEFCONFIG_CMDS 'the_cmd'
+function append_cmd() {
+ if [ ! -z "${!1}" ]; then
+ eval "$1=\"${!1} && \$2\""
+ else
+ eval "$1=\"\$2\""
+ fi
+}
+
set -a
. ${ROOT_DIR}/${BUILD_CONFIG}
set +a
diff --git a/build_abi.sh b/build_abi.sh
index 4fc84aa4..c90f199a 100755
--- a/build_abi.sh
+++ b/build_abi.sh
@@ -99,7 +99,8 @@ if [[ $wipe_out_dir -eq 1 ]]; then
fi
# inject CONFIG_DEBUG_INFO=y
-export POST_DEFCONFIG_CMDS="${POST_DEFCONFIG_CMDS} : && update_config_for_abi_dump"
+append_cmd POST_DEFCONFIG_CMDS 'update_config_for_abi_dump'
+export POST_DEFCONFIG_CMDS
function update_config_for_abi_dump() {
${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \
-e CONFIG_DEBUG_INFO