diff options
author | Zhangfei Gao <zhangfei.gao@linaro.org> | 2012-12-03 02:36:10 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2012-12-09 12:22:17 -0500 |
commit | 409f117e2d6b38d714ab26def840801e33dfe115 (patch) | |
tree | ac40deb3e159ba9c0337e24136304fe61ef5d44e /scripts/kconfig/merge_config.sh | |
parent | 169dfd880ad3f301f60587b2e6145afd3edbbd59 (diff) |
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>
Diffstat (limited to 'scripts/kconfig/merge_config.sh')
-rwxr-xr-x | scripts/kconfig/merge_config.sh | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 974d5cb7e30a..05274fccb88e 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
@@ -32,11 +32,13 @@ usage() { | |||
32 | echo " -m only merge the fragments, do not execute the make command" | 32 | echo " -m only merge the fragments, do not execute the make command" |
33 | echo " -n use allnoconfig instead of alldefconfig" | 33 | echo " -n use allnoconfig instead of alldefconfig" |
34 | echo " -r list redundant entries when merging fragments" | 34 | echo " -r list redundant entries when merging fragments" |
35 | echo " -O dir to put generated output files" | ||
35 | } | 36 | } |
36 | 37 | ||
37 | MAKE=true | 38 | MAKE=true |
38 | ALLTARGET=alldefconfig | 39 | ALLTARGET=alldefconfig |
39 | WARNREDUN=false | 40 | WARNREDUN=false |
41 | OUTPUT=. | ||
40 | 42 | ||
41 | while true; do | 43 | while true; do |
42 | case $1 in | 44 | case $1 in |
@@ -59,6 +61,16 @@ while true; do | |||
59 | shift | 61 | shift |
60 | continue | 62 | continue |
61 | ;; | 63 | ;; |
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 | ;; | ||
62 | *) | 74 | *) |
63 | break | 75 | break |
64 | ;; | 76 | ;; |
@@ -100,9 +112,9 @@ for MERGE_FILE in $MERGE_LIST ; do | |||
100 | done | 112 | done |
101 | 113 | ||
102 | if [ "$MAKE" = "false" ]; then | 114 | if [ "$MAKE" = "false" ]; then |
103 | cp $TMP_FILE .config | 115 | cp $TMP_FILE $OUTPUT/.config |
104 | echo "#" | 116 | echo "#" |
105 | echo "# merged configuration written to .config (needs make)" | 117 | echo "# merged configuration written to $OUTPUT/.config (needs make)" |
106 | echo "#" | 118 | echo "#" |
107 | clean_up | 119 | clean_up |
108 | exit | 120 | exit |
@@ -111,14 +123,14 @@ fi | |||
111 | # Use the merged file as the starting point for: | 123 | # Use the merged file as the starting point for: |
112 | # alldefconfig: Fills in any missing symbols with Kconfig default | 124 | # alldefconfig: Fills in any missing symbols with Kconfig default |
113 | # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set | 125 | # 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 |
115 | 127 | ||
116 | 128 | ||
117 | # Check all specified config values took (might have missed-dependency issues) | 129 | # Check all specified config values took (might have missed-dependency issues) |
118 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do | 130 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do |
119 | 131 | ||
120 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) | 132 | 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) |
122 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then | 134 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then |
123 | echo "Value requested for $CFG not in final .config" | 135 | echo "Value requested for $CFG not in final .config" |
124 | echo "Requested value: $REQUESTED_VAL" | 136 | echo "Requested value: $REQUESTED_VAL" |