On 19.07.21 14:20, Marek Behún wrote:
From: Pali Rohár <p...@kernel.org>
Platform specific BootROM may use its own image type for loading SPL or
main U-Boot binary. In some cases it makes sense to not use BootROM
supplied code for booting main U-Boot binary but rather to use U-Boot SPL
to load main U-Boot binary, e.g. when U-Boot SPL can load main U-Boot
binary faster than BootROM. In this case it is required for platform board
code to parse and load U-Boot in BootROM specific image type.
This change adds support for parsing platform / board / BootROM specific
image types via weak function spl_parse_board_header() which is called
before marking boot image as a raw.
Signed-off-by: Pali Rohár <p...@kernel.org>
Reviewed-by: Marek Behún <marek.be...@nic.cz>
Reviewed-by: Stefan Roese <s...@denx.de>
Thanks,
Stefan
---
common/spl/spl.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index eba77cace6..555045eaf2 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -296,6 +296,12 @@ static int spl_load_fit_image(struct spl_image_info
*spl_image,
}
#endif
+__weak int spl_parse_board_header(struct spl_image_info *spl_image,
+ const void *image_header, size_t size)
+{
+ return -EINVAL;
+}
+
__weak int spl_parse_legacy_header(struct spl_image_info *spl_image,
const struct image_header *header)
{
@@ -348,6 +354,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
}
#endif
+ if (!spl_parse_board_header(spl_image, (const void *)header, sizeof(*header)))
+ return 0;
+
#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
/* Signature not found - assume u-boot.bin */
debug("mkimage signature not found - ih_magic = %x\n",
Viele Grüße,
Stefan
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de