[U-Boot] [PATCH] ML: SPL: NOR: Add CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE define to enable whole image copy from NOR

Tom Rini trini at konsulko.com
Sun Sep 18 20:03:14 CEST 2016


On Fri, Sep 16, 2016 at 10:43:51AM +0200, Lukasz Majewski wrote:

> This define gives the possibility to copy entire image (including header)
> from NOR parallel memory to e.g. SDRAM.
> 
> The legacy behavior is preserved, since other board don't enabled this option.

What's the use case?

> Signed-off-by: Lukasz Majewski <l.majewski at majess.pl>
> ---
>  Kconfig              | 10 ++++++++++

This should now get moved to common/spl/Kconfig

>  README               |  4 ++++

This can be dropped.

[snip]
> diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
> index 8ea874c..1e0f739 100644
> --- a/common/spl/spl_nor.c
> +++ b/common/spl/spl_nor.c
> @@ -9,13 +9,15 @@
>  
>  int spl_nor_load_image(void)
>  {
> +	void *img_src;
>  	int ret;
> +#ifndef CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE
>  	/*
>  	 * Loading of the payload to SDRAM is done with skipping of
>  	 * the mkimage header in this SPL NOR driver
>  	 */
>  	spl_image.flags |= SPL_COPY_PAYLOAD_ONLY;
> -
> +#endif
>  #ifdef CONFIG_SPL_OS_BOOT
>  	if (!spl_start_uboot()) {
>  		const struct image_header *header;
> @@ -64,9 +66,13 @@ int spl_nor_load_image(void)
>  	if (ret)
>  		return ret;
>  

We should have a comment here about how we're calculating the base of
where to copy from.

> +	img_src = (void *)CONFIG_SYS_UBOOT_BASE;
> +#ifndef CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE
> +	img_src += sizeof(struct image_header));
> +#endif
> +
>  	memcpy((void *)(unsigned long)spl_image.load_addr,
> -	       (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
> -	       spl_image.size);
> +	       img_src, spl_image.size);
>  
>  	return 0;
>  }

Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160918/d1be3db9/attachment.sig>


More information about the U-Boot mailing list