Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 409f117e authored by Zhangfei Gao's avatar Zhangfei Gao Committed by Michal Marek
Browse files

merge_config.sh: Add option to specify output dir



Provide a -O option to specify dir to put generated .config
Then merge_config.sh does not need to be copied to target dir,
for easy re-usage in other script

Signed-off-by: default avatarZhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: default avatarJon Medhurst (Tixy) <tixy@linaro.org>
Acked-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 169dfd88
Loading
Loading
Loading
Loading
+16 −4
Original line number Original line Diff line number Diff line
@@ -32,11 +32,13 @@ usage() {
	echo "  -m    only merge the fragments, do not execute the make command"
	echo "  -m    only merge the fragments, do not execute the make command"
	echo "  -n    use allnoconfig instead of alldefconfig"
	echo "  -n    use allnoconfig instead of alldefconfig"
	echo "  -r    list redundant entries when merging fragments"
	echo "  -r    list redundant entries when merging fragments"
	echo "  -O    dir to put generated output files"
}
}


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


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


if [ "$MAKE" = "false" ]; then
if [ "$MAKE" = "false" ]; then
	cp $TMP_FILE .config
	cp $TMP_FILE $OUTPUT/.config
	echo "#"
	echo "#"
	echo "# merged configuration written to .config (needs make)"
	echo "# merged configuration written to $OUTPUT/.config (needs make)"
	echo "#"
	echo "#"
	clean_up
	clean_up
	exit
	exit
@@ -111,14 +123,14 @@ fi
# Use the merged file as the starting point for:
# Use the merged file as the starting point for:
# alldefconfig: Fills in any missing symbols with Kconfig default
# alldefconfig: Fills in any missing symbols with Kconfig default
# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
# 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)
# Check all specified config values took (might have missed-dependency issues)
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do


	REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
	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
	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
		echo "Value requested for $CFG not in final .config"
		echo "Value requested for $CFG not in final .config"
		echo "Requested value:  $REQUESTED_VAL"
		echo "Requested value:  $REQUESTED_VAL"