[U-Boot] [PATCH] SPL: NOR: Add CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE define to enable whole image copy from NOR
Lukasz Majewski
l.majewski at majess.pl
Tue Nov 29 10:11:53 CET 2016
Hi Marek,
> On 11/28/2016 10:09 PM, Lukasz Majewski wrote:
> > This define gives the possibility to copy entire image (including
> > header - e.g. u-boot.img) from NOR parallel memory to e.g. SDRAM.
> > The current code only supports loading the raw binary image (the
> > u-boot.bin).
> >
> > The legacy behavior is preserved, since other board don't enabled
> > this option.
>
> Sooooo, what's the usecase again ? ;-)
:-)
The use case is to allow u-boot.img being loaded from Parallel NOR. The
current code only supports u-boot.bin.
This code is crucial for boards booting from NOR, as a board which
support will be sent soon to u-boot ML :-).
Best regards,
Łukasz Majewski
> I still miss it being
> documented.
>
> > Signed-off-by: Lukasz Majewski <l.majewski at majess.pl>
> > ---
> > Changes for v2:
> > - Update to code to apply on v2016.11+
> > Changes for v3:
> > - Write better commit mesage to explain the problem
> >
> > ---
> > common/spl/Kconfig | 10 ++++++++++
> > common/spl/spl_nor.c | 12 +++++++++---
> > 2 files changed, 19 insertions(+), 3 deletions(-)
> >
> > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > index df9e0ce..d31b26d 100644
> > --- a/common/spl/Kconfig
> > +++ b/common/spl/Kconfig
> > @@ -399,6 +399,16 @@ config SPL_NOR_SUPPORT
> > a memory-mapped device makes it very easy to access.
> > Loading from NOR is typically achieved with just a memcpy().
> >
> > +config SPL_NOR_COPY_ENTIRE_IMAGE
> > + bool
> > + depends on SPL_NOR_SUPPORT
> > + prompt "Copy entire image from NOR memory"
> > + default n
> > + help
> > + By default the SPL NOR driver supports copying only
> > payload to
> > + destination address. Say Y if you want to copy entire
> > image (including
> > + its image header).
> > +
> > config SPL_ONENAND_SUPPORT
> > bool "Support OneNAND flash"
> > depends on SPL
> > diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
> > index 6bfa399..44f3e99 100644
> > --- a/common/spl/spl_nor.c
> > +++ b/common/spl/spl_nor.c
> > @@ -10,13 +10,15 @@
> > static int spl_nor_load_image(struct spl_image_info *spl_image,
> > struct spl_boot_device *bootdev)
> > {
> > + 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;
> > @@ -65,9 +67,13 @@ static int spl_nor_load_image(struct
> > spl_image_info *spl_image, if (ret)
> > return ret;
> >
> > + 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;
> > }
> >
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161129/af5f870a/attachment.sig>
More information about the U-Boot
mailing list