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 v2 1/4] Introduce CONFIG_SPL_ABORT_ON_NON_FIT_IMAGE
Date: Mon, 14 Nov 2016 13:14:16 -0600	[thread overview]
Message-ID: <20161114191419.14214-2-afd@ti.com> (raw)
In-Reply-To: <20161114191419.14214-1-afd@ti.com>

Introduce CONFIG_SPL_ABORT_ON_NON_FIT_IMAGE. An SPL which define
this will abort image loading if the image is not a FIT image.

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

diff --git a/Kconfig b/Kconfig
index 1263d0b..eefebef 100644
--- a/Kconfig
+++ b/Kconfig
@@ -291,6 +291,15 @@ config 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_ABORT_ON_NON_FIT_IMAGE
+	bool "Disable SPL loading of non-FIT images"
+	default y if SPL_FIT_SIGNATURE
+	help
+	  SPL will not load and image if it 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 SPL_DFU_SUPPORT
 	bool "Enable SPL with DFU to load binaries to memory device"
 	depends on USB
diff --git a/common/spl/spl.c b/common/spl/spl.c
index bdb165a..3d8bee9 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -93,6 +93,10 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 int spl_parse_image_header(struct spl_image_info *spl_image,
 			   const struct image_header *header)
 {
+#ifdef CONFIG_SPL_ABORT_ON_NON_FIT_IMAGE
+	/* non-FIT image found, proceed to other boot methods. */
+	return -EINVAL;
+#else
 	u32 header_size = sizeof(struct image_header);
 
 	if (image_get_magic(header) == IH_MAGIC) {
@@ -156,6 +160,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		spl_set_header_raw_uboot(spl_image);
 #endif
 	}
+#endif
 	return 0;
 }
 
-- 
2.10.1

  reply	other threads:[~2016-11-14 19:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 19:14 [U-Boot] [PATCH v2 0/4] Allow disabling non-FIT image loading from SPL Andrew F. Davis
2016-11-14 19:14 ` Andrew F. Davis [this message]
2016-11-14 20:44   ` [U-Boot] [PATCH v2 1/4] Introduce CONFIG_SPL_ABORT_ON_NON_FIT_IMAGE Simon Glass
2016-11-14 22:05     ` Andrew F. Davis
2016-11-15  0:33       ` Simon Glass
2016-12-05 22:37         ` Andrew F. Davis
2016-12-07  3:47           ` Simon Glass
2017-02-08 15:18             ` Andrew F. Davis
2017-02-10 16:23               ` Simon Glass
2017-02-10 16:57                 ` Andrew F. Davis
2016-11-14 19:14 ` [U-Boot] [PATCH v2 2/4] ARM: AM57xx: Disable non-FIT based image loading for HS devices Andrew F. Davis
2016-11-14 19:14 ` [U-Boot] [PATCH v2 3/4] ARM: AM437x: " Andrew F. Davis
2016-11-14 19:14 ` [U-Boot] [PATCH v2 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=20161114191419.14214-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