summaryrefslogtreecommitdiffstats
path: root/tools/merge_config.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/merge_config.sh')
-rwxr-xr-xtools/merge_config.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/merge_config.sh b/tools/merge_config.sh
index 6595eb7..3eeba85 100755
--- a/tools/merge_config.sh
+++ b/tools/merge_config.sh
@@ -32,6 +32,18 @@ usage() {
MAKE_FLAG=true
ALLTARGET=alldefconfig
+# There are two variables that impact where the .config will be dropped,
+# O= and KBUILD_OUTPUT=. So we'll respect those variables and use them as
+# an output directory as well. These two variables are not propagating
+# automatically to the kernel build, so always explicitly setting O=
+# and passing it to the kernel build ensures that it is respected.
+if [ -n "$KBUILD_OUTPUT" ]; then
+ O=$KBUILD_OUTPUT
+fi
+if [ -z "$O" ]; then
+ O=.
+fi
+
while true; do
case $1 in
"-n")
@@ -70,7 +82,7 @@ fi
MERGE_LIST=$*
SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
-TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
+TMP_FILE=$(mktemp $O/.tmp.config.XXXXXXXXXX)
# Merge files, printing warnings on overrided values
for MERGE_FILE in $MERGE_LIST ; do
@@ -95,9 +107,9 @@ for MERGE_FILE in $MERGE_LIST ; do
done
if [ "$MAKE_FLAG" = "false" ]; then
- cp $TMP_FILE .config
+ cp $TMP_FILE $O/.config
echo "#"
- echo "# merged configuration written to .config (needs make)"
+ echo "# merged configuration written to $O/.config (needs make)"
echo "#"
if [ -z "$DEBUG" ]; then
clean_up
@@ -108,14 +120,14 @@ 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 $ALLTARGET
+make KCONFIG_ALLCONFIG=$TMP_FILE O=$O $ALLTARGET
# Check all specified config values took (might have missed-dependency issues)
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
REQUESTED_VAL=$(sed -n "$SED_CONFIG_EXP" $TMP_FILE | grep -w -e "$CFG")
- ACTUAL_VAL=$(sed -n "$SED_CONFIG_EXP" .config | grep -w -e "$CFG")
+ ACTUAL_VAL=$(sed -n "$SED_CONFIG_EXP" $O/.config | grep -w -e "$CFG")
if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
echo "Value requested for $CFG not in final .config"
echo "Requested value: $REQUESTED_VAL"