All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] kconfig: add sanity checks for SPL configuration
@ 2014-09-10  9:13 Masahiro Yamada
  2014-09-17  0:47 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2014-09-10  9:13 UTC (permalink / raw)
  To: u-boot

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>
---

This check was proposed by Simon in his review
before getting the Kconfig series in.


Changes in v2:
  - Replace "$objdir" with "$2" in check_enabled_subimage()

 scripts/multiconfig.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh
index 49fcfad..4a8737f 100644
--- a/scripts/multiconfig.sh
+++ b/scripts/multiconfig.sh
@@ -252,6 +252,35 @@ do_savedefconfig () {
 	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:
 #   do_others <objdir>/<target>
 # The field "<objdir>/" 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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot, v2] kconfig: add sanity checks for SPL configuration
  2014-09-10  9:13 [U-Boot] [PATCH v2] kconfig: add sanity checks for SPL configuration Masahiro Yamada
@ 2014-09-17  0:47 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2014-09-17  0:47 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 10, 2014 at 06:13:10PM +0900, Masahiro Yamada wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/e3eeccaa/attachment.pgp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-17  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10  9:13 [U-Boot] [PATCH v2] kconfig: add sanity checks for SPL configuration Masahiro Yamada
2014-09-17  0:47 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.