Commit 11b5db67879c1ac0f1c358fb9b791896af189b0a

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent ad6e48e509

kconfig: add sanity checks for SPL configuration

For the SPL configuration, "make <dir>/<target>" is used.
Here,
  <dir> is either "spl" or "tpl"
  <target> is one of "config", "menuconfig", "xconfig", etc.

This commit adds two checks:

[1] If <dir> 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 <yamada.m@jp.panasonic.com>
Suggested-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 30 additions and 0 deletions Side-by-side Diff

scripts/multiconfig.sh
... ... @@ -252,7 +252,36 @@
252 252 IFS=$save_IFS
253 253 }
254 254  
  255 +# Some sanity checks before running "make <objdir>/<target>",
  256 +# where <objdir> should be either "spl" or "tpl".
  257 +# Doing "make spl/menuconfig" etc. on a non-SPL board makes no sense.
  258 +# It should be allowed only when ".config" exists and "CONFIG_SPL" is enabled.
  259 +#
255 260 # Usage:
  261 +# check_enabled_sumbimage <objdir>/<target> <objdir>
  262 +check_enabled_subimage () {
  263 +
  264 + case $2 in
  265 + spl|tpl) ;;
  266 + *)
  267 + echo >&2 "***"
  268 + echo >&2 "*** \"make $1\" is not supported."
  269 + echo >&2 "***"
  270 + exit 1
  271 + ;;
  272 + esac
  273 + test -r "$KCONFIG_CONFIG" && get_enabled_subimages | grep -q $2 || {
  274 + config=CONFIG_$(echo $2 | tr '[a-z]' '[A-Z]')
  275 +
  276 + echo >&2 "***"
  277 + echo >&2 "*** Create \"$KCONFIG_CONFIG\" with \"$config\" enabled"
  278 + echo >&2 "*** before \"make $1\"."
  279 + echo >&2 "***"
  280 + exit 1
  281 + }
  282 +}
  283 +
  284 +# Usage:
256 285 # do_others <objdir>/<target>
257 286 # The field "<objdir>/" is typically empy, "spl/", "tpl/" for Normal, SPL, TPL,
258 287 # respectively.
... ... @@ -265,6 +294,7 @@
265 294 objdir=
266 295 else
267 296 objdir=${1%/*}
  297 + check_enabled_subimage $1 $objdir
268 298 fi
269 299  
270 300 run_make_config $target $objdir