On Mon, Jan 17, 2022 at 08:02:58PM -0500, Nathan Barrett-Morrison wrote:

> Hi All,
> 
> While trying to bring up Falcon Mode boot on an ARM64 board, I've
> discovered that the SPL+SPI(spl_spi.c) driver does not allow us to load a
> raw kernel image and subsequently call the bootz_setup() function which
> resides in spl_parse_image_header().
> 
> I've added a new config option (CONFIG_SYS_SPI_KERNEL_SKIP_HEADER) which
> will skip the mkimage header check, allowing the subsequent
> spl_parse_image_header() call to successfully fall through to bootz_setup()
> and load/boot a raw kernel image.
> 
> Sincerely,
> Nathan Barrett-Morrison

> From e5a15a8ad2fd007e6d8d48dd64767d194bbd1833 Mon Sep 17 00:00:00 2001
> From: Nathan Barrett-Morrison <nathan.morri...@timesys.com>
> Date: Mon, 17 Jan 2022 19:42:59 -0500
> Subject: [PATCH] Allow Falcon Mode boot to use raw kernel image when
>  booting via SPI.  When using Falcon Mode boot with a raw, unwrapped kernel
>  image, the bootz_setup() call inside of spl_parse_image_header() is
>  unreachable because the mkimage header magic check will never pass.  Adding
>  CONFIG_SYS_SPI_KERNEL_SKIP_HEADER gives us the ability to pass through to the
>  desired bootz_setup() call.
> 
> Signed-off-by: Nathan Barrett-Morrison <nathan.morri...@timesys.com>
> Cc: Tom Rini <tr...@konsulko.com>
> Cc: Aneesh V <ane...@ti.com>
> ---
>  common/spl/spl_spi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
> index 4e20a23dea..62dad1d2fb 100644
> --- a/common/spl/spl_spi.c
> +++ b/common/spl/spl_spi.c
> @@ -33,8 +33,10 @@ static int spi_load_image_os(struct spl_image_info 
> *spl_image,
>       spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(*header),
>                      (void *)header);
>  
> +#ifndef CONFIG_SYS_SPI_KERNEL_SKIP_HEADER
>       if (image_get_magic(header) != IH_MAGIC)
>               return -1;
> +#endif
>  
>       err = spl_parse_image_header(spl_image, header);
>       if (err)

I'm not sure this is the right path.  Why is this part of the code
checking for IH_MAGIC at all, and should it not instead allow for
graceful falling back so that zImage/Image/etc work?

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to