diff mbox

merge_config.sh: Add option to specify output dir

Message ID 51B3EC47.8040204@linaro.org
State Accepted
Headers show

Commit Message

Zhangfei Gao June 9, 2013, 2:45 a.m. UTC
-------- Original Message --------
Subject: [PATCH] merge_config.sh: Add option to specify output dir
Date: Fri, 30 Nov 2012 10:04:06 +0800
From: Zhangfei Gao <zhangfei.gao@linaro.org>
To: John Stultz <john.stultz@linaro.org>, Michal Marek <mmarek@suse.cz>, 
"linaro-dev@lists.linaro.org" <linaro-dev@lists.linaro.org>
CC: Zhangfei Gao <zhangfei.gao@linaro.org>

Provide a -O option to specify dir to put generated .config

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: Jon Medhurst (Tixy) <tixy@linaro.org>
---
  scripts/kconfig/merge_config.sh |   18 +++++++++++++++---
  1 file changed, 15 insertions(+), 3 deletions(-)

  		echo "Requested value:  $REQUESTED_VAL"
diff mbox

Patch

diff --git a/scripts/kconfig/merge_config.sh 
b/scripts/kconfig/merge_config.sh
index 974d5cb..9ad5744 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -32,11 +32,13 @@  usage() {
  	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"
  }

  MAKE=true
  ALLTARGET=alldefconfig
  WARNREDUN=false
+OUTPUT=.

  while true; do
  	case $1 in
@@ -59,6 +61,16 @@  while true; do
  		shift
  		continue
  		;;
+	"-O")
+		if [ -d $2 ];then
+			OUTPUT=$2
+		else
+			echo "output directory $2 does not exist" 1>&2
+			exit 1
+		fi
+		shift 2
+		continue
+		;;
  	*)
  		break
  		;;
@@ -100,7 +112,7 @@  for MERGE_FILE in $MERGE_LIST ; do
  done

  if [ "$MAKE" = "false" ]; then
-	cp $TMP_FILE .config
+	cp $TMP_FILE $OUTPUT/.config
  	echo "#"
  	echo "# merged configuration written to .config (needs make)"
  	echo "#"
@@ -111,14 +123,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=$OUTPUT $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" .config)
+	ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
  		echo "Value requested for $CFG not in final .config"