SPL: Add support for parsing board / BootROM specific image types
authorPali Rohár <pali@kernel.org>
Fri, 23 Jul 2021 09:14:28 +0000 (11:14 +0200)
committerStefan Roese <sr@denx.de>
Sat, 31 Jul 2021 07:49:32 +0000 (09:49 +0200)
Platform specific BootROM may use its own image type for loading SPL or
U-Boot proper. In some cases it makes sense to not use BootROM supplied
code for booting U-Boot proper but rather to use U-Boot SPL for this,
e.g. when U-Boot SPL can load U-Boot proper 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 <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
common/spl/spl.c

index f6375b0..d55d3c2 100644 (file)
@@ -300,6 +300,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)
 {
@@ -352,6 +358,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",