X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=scripts%2Fmulticonfig.sh;h=70f3a5df6f711081d9808cb67bd807a843164df9;hb=8e04d4c537eca06112fc8508689eb6c75d1f518e;hp=a5790428c852422a3d330e4d7089afa818737c92;hpb=dee745bf3d9ba14da6992b829bb168adc2d1c873;p=u-boot diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh old mode 100644 new mode 100755 index a5790428c8..70f3a5df6f --- a/scripts/multiconfig.sh +++ b/scripts/multiconfig.sh @@ -69,8 +69,8 @@ get_enabled_subimages() { # CONFIG_SPL=y -> spl # CONFIG_TPL=y -> tpl - sed -n -e 's/^CONFIG_\(SPL\|TPL\)=y$/\1/p' $KCONFIG_CONFIG | \ - tr '[A-Z]' '[a-z]' + sed -n -e 's/^CONFIG_SPL=y$/spl/p' -e 's/^CONFIG_TPL=y$/tpl/p' \ + $KCONFIG_CONFIG } do_silentoldconfig () { @@ -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 \"configs/$1\"!" + echo >&2 "***" + exit 1 + fi + mkdir -p arch configs # defconfig for Normal: # pick lines without prefixes and lines starting '+' prefix @@ -155,6 +162,16 @@ do_defconfig () { fi } +do_board_felconfig () { + do_board_defconfig ${1%%_felconfig}_defconfig + if ! grep -q CONFIG_ARCH_SUNXI=y .config || ! grep -q CONFIG_SPL=y .config ; then + echo "$progname: Cannot felconfig a non-sunxi or non-SPL platform" >&2 + exit 1 + fi + sed -i -e 's/\# CONFIG_SPL_FEL is not set/CONFIG_SPL_FEL=y/g' \ + .config spl/.config +} + do_savedefconfig () { if [ -r "$KCONFIG_CONFIG" ]; then subimages=$(get_enabled_subimages) @@ -222,6 +239,8 @@ do_savedefconfig () { unmatched="$unmatched%$symbol:$line" fi done < defconfig + + output_lines="$output_lines%$unmatched" done rm -f defconfig @@ -245,6 +264,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, @@ -258,9 +306,25 @@ do_others () { objdir= else objdir=${1%/*} + check_enabled_subimage $1 $objdir + + if [ -f "$objdir/$KCONFIG_CONFIG" ]; then + timestamp_before=$(stat --printf="%Y" \ + $objdir/$KCONFIG_CONFIG) + fi fi run_make_config $target $objdir + + if [ "$timestamp_before" -a -f "$objdir/$KCONFIG_CONFIG" ]; then + timestamp_after=$(stat --printf="%Y" $objdir/$KCONFIG_CONFIG) + + if [ "$timestamp_after" -gt "$timestamp_before" ]; then + # $objdir/.config has been updated. + # touch .config to invoke "make silentoldconfig" + touch $KCONFIG_CONFIG + fi + fi } progname=$(basename $0) @@ -269,6 +333,8 @@ target=$1 case $target in *_defconfig) do_board_defconfig $target;; +*_felconfig) + do_board_felconfig $target;; *_config) # backward compatibility do_board_defconfig ${target%_config}_defconfig;;