public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew F. Davis <afd@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot]  [PATCH 1/4] Introduce CONFIG_SPL_PANIC_ON_NON_FIT_IMAGE
Date: Mon, 1 Aug 2016 10:30:23 -0500	[thread overview]
Message-ID: <20160801153026.7341-2-afd@ti.com> (raw)
In-Reply-To: <20160801153026.7341-1-afd@ti.com>

Introduce CONFIG_SPL_PANIC_ON_NON_FIT_IMAGE. An SPL which define
this will panic() if the image it has loaded is not a FIT image.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 Kconfig          | 8 ++++++++
 common/spl/spl.c | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/Kconfig b/Kconfig
index ef12f9f..4c03716 100644
--- a/Kconfig
+++ b/Kconfig
@@ -336,6 +336,14 @@ config SPL_FIT_IMAGE_POST_PROCESS
 	  injected into the FIT creation (i.e. the blobs would have been pre-
 	  processed before being added to the FIT image).
 
+config SPL_PANIC_ON_NON_FIT_IMAGE
+	bool "Disable SPL loading of non-FIT images"
+	help
+	  SPL will panic() if the image loaded is not a FIT image. This is
+	  useful for devices that only support authentication/encryption
+	  through SPL FIT loading paths and do not want SPL falling back
+	  to legacy image loading when a non-FIT image is present.
+
 config SYS_CLK_FREQ
 	depends on ARC || ARCH_SUNXI
 	int "CPU clock frequency"
diff --git a/common/spl/spl.c b/common/spl/spl.c
index b7ec333..7a30c7d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -93,6 +93,9 @@ void spl_set_header_raw_uboot(void)
 
 int spl_parse_image_header(const struct image_header *header)
 {
+#ifdef CONFIG_SPL_PANIC_ON_NON_FIT_IMAGE
+	panic("** non-FIT images are not supported");
+#else
 	u32 header_size = sizeof(struct image_header);
 
 	if (image_get_magic(header) == IH_MAGIC) {
@@ -153,6 +156,7 @@ int spl_parse_image_header(const struct image_header *header)
 		spl_set_header_raw_uboot();
 #endif
 	}
+#endif
 	return 0;
 }
 
-- 
2.9.2

  reply	other threads:[~2016-08-01 15:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 15:30 [U-Boot] [PATCH 0/4] Allow disabling non-FIT image loading from SPL Andrew F. Davis
2016-08-01 15:30 ` Andrew F. Davis [this message]
2016-08-01 17:30   ` [U-Boot] [PATCH 1/4] Introduce CONFIG_SPL_PANIC_ON_NON_FIT_IMAGE Tom Rini
2016-08-01 17:50     ` Simon Glass
2016-08-01 15:30 ` [U-Boot] [PATCH 2/4] ARM: AM57xx: Disable non-FIT based image loading for HS devices Andrew F. Davis
2016-08-04  1:16   ` Simon Glass
2016-08-04  1:48     ` Tom Rini
2016-08-04  2:27       ` Simon Glass
2016-08-05 16:15         ` Andrew F. Davis
2016-08-01 15:30 ` [U-Boot] [PATCH 3/4] ARM: AM437x: " Andrew F. Davis
2016-08-01 15:30 ` [U-Boot] [PATCH 4/4] ARM: DRA7xx: " Andrew F. Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160801153026.7341-2-afd@ti.com \
    --to=afd@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox