linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kconfig/merge_config.sh: Support KCONFIG_CONFIG
@ 2015-10-14 13:57 Gabriel de Perthuis
  2015-10-14 14:19 ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel de Perthuis @ 2015-10-14 13:57 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

All make targets support $KCONFIG_CONFIG because they
run scripts/kconf.  Make sure merge_config.sh accesses the
correct file in all cases.

Previously this script broke in two different code paths,
one for targets like kvmconfig (which use merge_config.sh -m
then call a target that respects KCONFIG_CONFIG) and one for
direct use of the script without -m, which called make rules
that edit KCONFIG_CONFIG but verified a different file.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
---
  scripts/kconfig/merge_config.sh | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh 
b/scripts/kconfig/merge_config.sh
index 0d883b3..6765353 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -30,11 +30,11 @@ usage() {
  	echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
  	echo "  -h    display this help text"
  	echo "  -m    only merge the fragments, do not execute the make command"
  	echo "  -n    use allnoconfig instead of alldefconfig"
  	echo "  -r    list redundant entries when merging fragments"
-	echo "  -O    dir to put generated output files"
+	echo "  -O    dir to put generated output files.  Consider setting 
\$KCONFIG_CONFIG instead."
  }
   RUNMAKE=true
  ALLTARGET=alldefconfig
  WARNREDUN=false
@@ -80,10 +80,18 @@ done
  if [ "$#" -lt 2 ] ; then
  	usage
  	exit
  fi
  +if [ -z "$KCONFIG_CONFIG" ]; then
+	if [ "$OUTPUT" != . ]; then
+		KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config")
+	else
+		KCONFIG_CONFIG=.config
+	fi
+fi
+
  INITFILE=$1
  shift;
   if [ ! -r "$INITFILE" ]; then
  	echo "The base file '$INITFILE' does not exist.  Exit." >&2
@@ -122,13 +130,13 @@ for MERGE_FILE in $MERGE_LIST ; do
  	done
  	cat $MERGE_FILE >> $TMP_FILE
  done
   if [ "$RUNMAKE" = "false" ]; then
-	cp $TMP_FILE $OUTPUT/.config
+	cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
  	echo "#"
-	echo "# merged configuration written to $OUTPUT/.config (needs make)"
+	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
  	echo "#"
  	clean_up
  	exit
  fi
  @@ -148,11 +156,11 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG 
$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=$(grep -w -e "$CFG" $TMP_FILE)
-	ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
+	ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
  		echo "Value requested for $CFG not in final .config"
  		echo "Requested value:  $REQUESTED_VAL"
  		echo "Actual value:     $ACTUAL_VAL"
  		echo ""
-- 
2.6.0.5.gb9412f4



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH 1/2] kconfig/merge_config.sh: Support KCONFIG_CONFIG
@ 2015-09-09 17:33 Gabriel de Perthuis
  2015-10-14 10:56 ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel de Perthuis @ 2015-09-09 17:33 UTC (permalink / raw)
  To: linux-kernel, linux-kbuild, Michal Marek

All make targets support $KCONFIG_CONFIG because they
run scripts/kconf.  Make sure merge_config.sh accesses the
correct file in all cases.

Previously this script broke in two different code paths,
one for targets like kvmconfig (which use merge_config.sh -m
then call a target that respects KCONFIG_CONFIG) and one for
direct use of the script without -m, which called make rules
that edit KCONFIG_CONFIG but verified a different file.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
---
  scripts/kconfig/merge_config.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh 
b/scripts/kconfig/merge_config.sh
index 0d883b3..5f1e110 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -122,13 +122,13 @@ for MERGE_FILE in $MERGE_LIST ; do
  	done
  	cat $MERGE_FILE >> $TMP_FILE
  done
   if [ "$RUNMAKE" = "false" ]; then
-	cp $TMP_FILE $OUTPUT/.config
+	cp $TMP_FILE ${KCONFIG_CONFIG:=$OUTPUT/.config}
  	echo "#"
-	echo "# merged configuration written to $OUTPUT/.config (needs make)"
+	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
  	echo "#"
  	clean_up
  	exit
  fi
  @@ -148,11 +148,11 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG 
$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=$(grep -w -e "$CFG" $TMP_FILE)
-	ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
+	ACTUAL_VAL=$(grep -w -e "$CFG" ${KCONFIG_CONFIG:=$OUTPUT/.config})
  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
  		echo "Value requested for $CFG not in final .config"
  		echo "Requested value:  $REQUESTED_VAL"
  		echo "Actual value:     $ACTUAL_VAL"
  		echo ""
-- 
2.6.0.rc0.29.g24f8d8a



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-14 14:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 13:57 [PATCH 1/2] kconfig/merge_config.sh: Support KCONFIG_CONFIG Gabriel de Perthuis
2015-10-14 14:19 ` Michal Marek
  -- strict thread matches above, loose matches on Subject: below --
2015-09-09 17:33 Gabriel de Perthuis
2015-10-14 10:56 ` Michal Marek
2015-10-14 13:50   ` Gabriel de Perthuis
2015-10-14 14:11     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).