Skip to content

Commit 409f117

Browse files
zhangfeigaomichal42
authored andcommitted
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: Zhangfei Gao <zhangfei.gao@linaro.org> Tested-by: Jon Medhurst (Tixy) <tixy@linaro.org> Acked-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 169dfd8 commit 409f117

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎scripts/kconfig/merge_config.sh‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ usage() {
3232
echo " -m only merge the fragments, do not execute the make command"
3333
echo " -n use allnoconfig instead of alldefconfig"
3434
echo " -r list redundant entries when merging fragments"
35+
echo " -O dir to put generated output files"
3536
}
3637

3738
MAKE=true
3839
ALLTARGET=alldefconfig
3940
WARNREDUN=false
41+
OUTPUT=.
4042

4143
while true; do
4244
case $1 in
@@ -59,6 +61,16 @@ while true; do
5961
shift
6062
continue
6163
;;
64+
"-O")
65+
if [ -d $2 ];then
66+
OUTPUT=$(echo $2 | sed 's/\/*$//')
67+
else
68+
echo "output directory $2 does not exist" 1>&2
69+
exit 1
70+
fi
71+
shift 2
72+
continue
73+
;;
6274
*)
6375
break
6476
;;
@@ -100,9 +112,9 @@ for MERGE_FILE in $MERGE_LIST ; do
100112
done
101113

102114
if [ "$MAKE" = "false" ]; then
103-
cp $TMP_FILE .config
115+
cp $TMP_FILE $OUTPUT/.config
104116
echo "#"
105-
echo "# merged configuration written to .config (needs make)"
117+
echo "# merged configuration written to $OUTPUT/.config (needs make)"
106118
echo "#"
107119
clean_up
108120
exit
@@ -111,14 +123,14 @@ fi
111123
# Use the merged file as the starting point for:
112124
# alldefconfig: Fills in any missing symbols with Kconfig default
113125
# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
114-
make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET
126+
make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET
115127

116128

117129
# Check all specified config values took (might have missed-dependency issues)
118130
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
119131

120132
REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
121-
ACTUAL_VAL=$(grep -w -e "$CFG" .config)
133+
ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
122134
if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
123135
echo "Value requested for $CFG not in final .config"
124136
echo "Requested value: $REQUESTED_VAL"

0 commit comments

Comments
 (0)