Skip to content
Snippets Groups Projects
Commit 11b5db67 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Tom Rini
Browse files

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: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
Suggested-by: default avatarSimon Glass <sjg@chromium.org>
parent ad6e48e5
No related branches found
No related tags found
No related merge requests found
...@@ -252,6 +252,35 @@ do_savedefconfig () { ...@@ -252,6 +252,35 @@ do_savedefconfig () {
IFS=$save_IFS IFS=$save_IFS
} }
# Some sanity checks before running "make <objdir>/<target>",
# where <objdir> 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 <objdir>/<target> <objdir>
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: # Usage:
# do_others <objdir>/<target> # do_others <objdir>/<target>
# The field "<objdir>/" is typically empy, "spl/", "tpl/" for Normal, SPL, TPL, # The field "<objdir>/" is typically empy, "spl/", "tpl/" for Normal, SPL, TPL,
...@@ -265,6 +294,7 @@ do_others () { ...@@ -265,6 +294,7 @@ do_others () {
objdir= objdir=
else else
objdir=${1%/*} objdir=${1%/*}
check_enabled_subimage $1 $objdir
fi fi
run_make_config $target $objdir run_make_config $target $objdir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment