From 93481b9f6b3286083a12b136e091caf6f24d8b9e Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 4 Sep 2014 05:41:31 +0900 Subject: kconfig: fix savedefconfig to output empty defconfig Commit 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script) introduced a minor regression. make alldefconfig; make savedefconfig should create an empty 'defconfig'. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- scripts/multiconfig.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh index 4190798a97..785f5639a6 100644 --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -217,6 +217,7 @@ do_savedefconfig () { done rm -f defconfig + touch defconfig for line in $output_lines do echo $line >> defconfig -- cgit From 8dffe663a2e50751150d92caf834f717d397ac80 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 4 Sep 2014 05:41:32 +0900 Subject: kconfig: fix whitespace handling bug of savedefconfig Commit 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script) introduced another regression. Shell usually handles whitespaces as separators, so "make saveconfig" outputs # CONFIG_FOO is not set into: # CONFIG_FOO is not set Whitespaces should not be treated as separators here. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- scripts/multiconfig.sh | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh index 785f5639a6..7606193102 100644 --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -170,7 +170,7 @@ do_savedefconfig () { # backslashes as an escape character while read -r line do - output_lines="$output_lines $line" + output_lines="$output_lines%$line" done < defconfig for img in $subimages @@ -185,43 +185,64 @@ do_savedefconfig () { tmp= match= + # "# CONFIG_FOO is not set" should not be divided. + # Use "%" as a separator, instead of a whitespace. + # "%" is unlikely to appear in defconfig context. + save_IFS=$IFS + IFS=% # coalesce common lines together for i in $output_lines do case "$i" in "[+A-Z]*:$line") - tmp="$tmp $unmatched" + tmp="$tmp%$unmatched" i=$(echo "$i" | \ sed -e "s/^\([^:]\)*/\1$symbol/") - tmp="$tmp $i" + tmp="$tmp%$i" match=1 ;; "$line") - tmp="$tmp $unmatched" - tmp="$tmp +$symbol:$i" + tmp="$tmp%$unmatched" + tmp="$tmp%+$symbol:$i" match=1 ;; *) - tmp="$tmp $i" + tmp="$tmp%$i" ;; esac done + # Restore the default separator for the outer for loop. + IFS=$save_IFS + if [ "$match" ]; then output_lines="$tmp" unmatched= else - unmatched="$unmatched $symbol:$line" + unmatched="$unmatched%$symbol:$line" fi done < defconfig done rm -f defconfig touch defconfig + + save_IFS=$IFS + IFS=% + for line in $output_lines do - echo $line >> defconfig + case "$line" in + "") + # do not output blank lines + ;; + *) + echo $line >> defconfig + ;; + esac done + + IFS=$save_IFS } # Usage: -- cgit From dee745bf3d9ba14da6992b829bb168adc2d1c873 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 4 Sep 2014 05:41:33 +0900 Subject: kconfig: fix savedefconfig to handle TPL correctly Since 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script), "make savedefconfig" of TPL boards has not been working. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- scripts/multiconfig.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh index 7606193102..a5790428c8 100644 --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -194,14 +194,14 @@ do_savedefconfig () { for i in $output_lines do case "$i" in - "[+A-Z]*:$line") + [+A-Z]*:$line) tmp="$tmp%$unmatched" i=$(echo "$i" | \ - sed -e "s/^\([^:]\)*/\1$symbol/") + sed -e "s/^\([^:]*\)/\1$symbol/") tmp="$tmp%$i" match=1 ;; - "$line") + $line) tmp="$tmp%$unmatched" tmp="$tmp%+$symbol:$i" match=1 -- cgit From 8caaec62602453cf2a24ccc0799c59bf4e3d74f9 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 4 Sep 2014 22:16:15 +0900 Subject: kconfig: show an error message when defconfig is not found When a non-existing defconfig is specified, display an easy-to-understand message (fake the error message on Linux Kernel): $ make foo_defconfig *** *** Can't find default configuration "confis/foo_defconfig"! *** Signed-off-by: Masahiro Yamada Acked-by: Stephen Warren --- scripts/multiconfig.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh index a5790428c8..49fcfad3c1 100644 --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -118,6 +118,13 @@ do_board_defconfig () { defconfig_path=$srctree/configs/$1 tmp_defconfig_path=configs/.tmp_defconfig + if [ ! -r $defconfig_path ]; then + echo >&2 "***" + echo >&2 "*** Can't find default configuration \"confis/$1\"!" + echo >&2 "***" + exit 1 + fi + mkdir -p arch configs # defconfig for Normal: # pick lines without prefixes and lines starting '+' prefix -- cgit From 021f0495979317e26b2cf582cf2b765008390bcd Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 5 Sep 2014 01:56:51 +0900 Subject: scripts/Makefile.clean: clean also $(extra-m) and $(extra-) This commit is a backport from Linux Kernel, commit 9d5db8949f1ecf4019785b04d8986835d3c0e99e, written by me. Signed-off-by: Masahiro Yamada --- scripts/Makefile.clean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index d6dcd47f6f..88f14e2d8f 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -45,8 +45,8 @@ subdir-ymn := $(foreach f, $(subdir-ymn), \ # build a list of files to remove, usually relative to the current # directory -__clean-files := $(extra-y) $(always) \ - $(targets) $(clean-files) \ +__clean-files := $(extra-y) $(extra-m) $(extra-) \ + $(always) $(targets) $(clean-files) \ $(host-progs) \ $(hostprogs-y) $(hostprogs-m) $(hostprogs-) -- cgit From 11b5db67879c1ac0f1c358fb9b791896af189b0a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 10 Sep 2014 18:13:10 +0900 Subject: kconfig: add sanity checks for SPL configuration For the SPL configuration, "make /" is used. Here, is either "spl" or "tpl" is one of "config", "menuconfig", "xconfig", etc. This commit adds two checks: [1] If is given an unsupported subimage, the configuration should error out like this: $ make qpl/menuconfig *** *** "make qpl/menuconfig" is not supported. *** [2] Make sure that "CONFIG_SPL" is enabled in the ".config" before running "make spl/menuconfig. Otherwise, the SPL image is not built at all. Having "spl/.config" makes no sense. In such a case, the configuration should exit with a message: $ make spl/menuconfig *** *** Create ".config" with "CONFIG_SPL" enabled *** before "make spl/menuconfig". *** Signed-off-by: Masahiro Yamada Suggested-by: Simon Glass --- scripts/multiconfig.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'scripts') diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh index 49fcfad3c1..4a8737f352 100644 --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -252,6 +252,35 @@ do_savedefconfig () { IFS=$save_IFS } +# Some sanity checks before running "make /", +# where should be either "spl" or "tpl". +# Doing "make spl/menuconfig" etc. on a non-SPL board makes no sense. +# It should be allowed only when ".config" exists and "CONFIG_SPL" is enabled. +# +# Usage: +# check_enabled_sumbimage / +check_enabled_subimage () { + + case $2 in + spl|tpl) ;; + *) + echo >&2 "***" + echo >&2 "*** \"make $1\" is not supported." + echo >&2 "***" + exit 1 + ;; + esac + test -r "$KCONFIG_CONFIG" && get_enabled_subimages | grep -q $2 || { + config=CONFIG_$(echo $2 | tr '[a-z]' '[A-Z]') + + echo >&2 "***" + echo >&2 "*** Create \"$KCONFIG_CONFIG\" with \"$config\" enabled" + echo >&2 "*** before \"make $1\"." + echo >&2 "***" + exit 1 + } +} + # Usage: # do_others / # The field "/" is typically empy, "spl/", "tpl/" for Normal, SPL, TPL, @@ -265,6 +294,7 @@ do_others () { objdir= else objdir=${1%/*} + check_enabled_subimage $1 $objdir fi run_make_config $target $objdir -- cgit