Message ID | 1502147786-8269-4-git-send-email-york.sun@nxp.com |
---|---|
State | Superseded |
Delegated to: | York Sun |
Headers | show |
On Mon, Aug 07, 2017 at 04:16:24PM -0700, York Sun wrote: > Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for > SPL boot, eg. falcon boot compressed kernel image. > > Signed-off-by: York Sun <york.sun@nxp.com> > Reviewed-by: Tom Rini <trini@konsulko.com>
Hi York, On 7 August 2017 at 17:16, York Sun <york.sun@nxp.com> wrote: > Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for > SPL boot, eg. falcon boot compressed kernel image. > > Signed-off-by: York Sun <york.sun@nxp.com> > > --- > > Changes in v2: > Combine Kconfig change and actual code into one patch > > common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- > lib/Kconfig | 8 ++++++++ > lib/Makefile | 5 +++-- > 3 files changed, 37 insertions(+), 4 deletions(-) > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index d2a352e..23f85d2 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -135,6 +135,19 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > ulong overhead; > int nr_sectors; > int align_len = ARCH_DMA_MINALIGN - 1; > +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) If these are in Kconfig can we use if (IS_ENABLED()) instead of #if ? > + uint8_t image_comp, type; > + > + if (fit_image_get_comp(fit, node, &image_comp)) > + puts("Cannot get image compression format.\n"); > + else > + debug("%s ", genimg_get_comp_name(image_comp)); > + > + if (fit_image_get_type(fit, node, &type)) > + puts("Cannot get image type.\n"); > + else > + debug("%s ", genimg_get_type_name(type)); > +#endif > > offset = fdt_getprop_u32(fit, node, "data-offset"); > if (offset == FDT_ERROR) > @@ -154,7 +167,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > if (info->read(info, sector + get_aligned_image_offset(info, offset), > nr_sectors, (void*)load_ptr) != nr_sectors) > return -EIO; > - debug("image: dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, > + debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, > (unsigned long)length); > > src = (void *)load_ptr + overhead; > @@ -162,7 +175,18 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > board_fit_image_post_process(&src, &length); > #endif > > - memcpy((void*)load_addr, src, length); > +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { > + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, > + src, &length)) { > + puts("Uncompressing error\n"); > + return -EIO; > + } > + } else > +#endif > + { > + memcpy((void *)load_addr, src, length); > + } > > if (image_info) { > image_info->load_addr = load_addr; > diff --git a/lib/Kconfig b/lib/Kconfig > index 2f5a210..a3c6520 100644 > --- a/lib/Kconfig > +++ b/lib/Kconfig > @@ -160,6 +160,14 @@ config LZO > bool "Enable LZO decompression support" > help > This enables support for LZO compression algorithm.r > + > +config SPL_GZIP > + bool "Enable gzip decompression support for SPL build" > + select SPL_ZLIB > + > +config SPL_ZLIB > + bool Help? > + > endmenu > > config ERRNO_STR > diff --git a/lib/Makefile b/lib/Makefile > index eacc7d6..455cc9d 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -11,7 +11,6 @@ obj-$(CONFIG_EFI) += efi/ > obj-$(CONFIG_EFI_LOADER) += efi_loader/ > obj-$(CONFIG_LZMA) += lzma/ > obj-$(CONFIG_LZO) += lzo/ > -obj-$(CONFIG_ZLIB) += zlib/ > obj-$(CONFIG_BZIP2) += bzip2/ > obj-$(CONFIG_TIZEN) += tizen/ > obj-$(CONFIG_FIT) += libfdt/ > @@ -26,7 +25,6 @@ obj-y += crc16.o > obj-$(CONFIG_ERRNO_STR) += errno_str.o > obj-$(CONFIG_FIT) += fdtdec_common.o > obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o > -obj-$(CONFIG_GZIP) += gunzip.o > obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o > obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o > obj-y += initcall.o > @@ -49,6 +47,9 @@ obj-$(CONFIG_RSA) += rsa/ > obj-$(CONFIG_SHA1) += sha1.o > obj-$(CONFIG_SHA256) += sha256.o > > +obj-$(CONFIG_$(SPL_)ZLIB) += zlib/ > +obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o > + > obj-$(CONFIG_SPL_SAVEENV) += qsort.o > obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/ > ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy) > -- > 2.7.4 > Regards, Simon
On 08/13/2017 02:35 PM, Simon Glass wrote: > Hi York, > > On 7 August 2017 at 17:16, York Sun <york.sun@nxp.com> wrote: >> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for >> SPL boot, eg. falcon boot compressed kernel image. >> >> Signed-off-by: York Sun <york.sun@nxp.com> >> >> --- >> >> Changes in v2: >> Combine Kconfig change and actual code into one patch >> >> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- >> lib/Kconfig | 8 ++++++++ >> lib/Makefile | 5 +++-- >> 3 files changed, 37 insertions(+), 4 deletions(-) >> >> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c >> index d2a352e..23f85d2 100644 >> --- a/common/spl/spl_fit.c >> +++ b/common/spl/spl_fit.c >> @@ -135,6 +135,19 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, >> ulong overhead; >> int nr_sectors; >> int align_len = ARCH_DMA_MINALIGN - 1; >> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > > If these are in Kconfig can we use if (IS_ENABLED()) instead of #if ? Sure thing. Will change in next version. York
On 08/08/2017 01:16 AM, York Sun wrote: > Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for > SPL boot, eg. falcon boot compressed kernel image. > > Signed-off-by: York Sun <york.sun@nxp.com> > Reviewed-by: Tom Rini <trini@konsulko.com> > --- > > Changes in v2: > Combine Kconfig change and actual code into one patch > > common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- > lib/Kconfig | 8 ++++++++ > lib/Makefile | 5 +++-- > 3 files changed, 37 insertions(+), 4 deletions(-) > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index d2a352e..23f85d2 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -135,6 +135,19 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > ulong overhead; > int nr_sectors; > int align_len = ARCH_DMA_MINALIGN - 1; > +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > + uint8_t image_comp, type; > + > + if (fit_image_get_comp(fit, node, &image_comp)) > + puts("Cannot get image compression format.\n"); > + else > + debug("%s ", genimg_get_comp_name(image_comp)); > + > + if (fit_image_get_type(fit, node, &type)) > + puts("Cannot get image type.\n"); > + else > + debug("%s ", genimg_get_type_name(type)); > +#endif > > offset = fdt_getprop_u32(fit, node, "data-offset"); > if (offset == FDT_ERROR) > @@ -154,7 +167,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > if (info->read(info, sector + get_aligned_image_offset(info, offset), > nr_sectors, (void*)load_ptr) != nr_sectors) > return -EIO; > - debug("image: dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, > + debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, > (unsigned long)length); > > src = (void *)load_ptr + overhead; > @@ -162,7 +175,18 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > board_fit_image_post_process(&src, &length); > #endif > > - memcpy((void*)load_addr, src, length); > +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { > + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, > + src, &length)) { In this file length is defined as size_t. In include/common.h the last parameter of gunzip is defined as unsigned long *. This leads to a compilation warning and probably incorrect results: CC spl/common/spl/spl_fit.o common/spl/spl_fit.c: In function ‘spl_load_fit_image’: common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’ from incompatible pointer type [-Wincompatible-pointer-types] src, &length)) { Please, correct the patch to pass a compatible parameter. The patch already made it into the U-Boot git master. So possibly you want to send a follow up patch. Best regards Heinrich > + puts("Uncompressing error\n"); > + return -EIO; > + } > + } else > +#endif > + { > + memcpy((void *)load_addr, src, length); > + } > > if (image_info) { > image_info->load_addr = load_addr; > diff --git a/lib/Kconfig b/lib/Kconfig > index 2f5a210..a3c6520 100644 > --- a/lib/Kconfig > +++ b/lib/Kconfig > @@ -160,6 +160,14 @@ config LZO > bool "Enable LZO decompression support" > help > This enables support for LZO compression algorithm.r > + > +config SPL_GZIP > + bool "Enable gzip decompression support for SPL build" > + select SPL_ZLIB > + > +config SPL_ZLIB > + bool > + > endmenu > > config ERRNO_STR > diff --git a/lib/Makefile b/lib/Makefile > index eacc7d6..455cc9d 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -11,7 +11,6 @@ obj-$(CONFIG_EFI) += efi/ > obj-$(CONFIG_EFI_LOADER) += efi_loader/ > obj-$(CONFIG_LZMA) += lzma/ > obj-$(CONFIG_LZO) += lzo/ > -obj-$(CONFIG_ZLIB) += zlib/ > obj-$(CONFIG_BZIP2) += bzip2/ > obj-$(CONFIG_TIZEN) += tizen/ > obj-$(CONFIG_FIT) += libfdt/ > @@ -26,7 +25,6 @@ obj-y += crc16.o > obj-$(CONFIG_ERRNO_STR) += errno_str.o > obj-$(CONFIG_FIT) += fdtdec_common.o > obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o > -obj-$(CONFIG_GZIP) += gunzip.o > obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o > obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o > obj-y += initcall.o > @@ -49,6 +47,9 @@ obj-$(CONFIG_RSA) += rsa/ > obj-$(CONFIG_SHA1) += sha1.o > obj-$(CONFIG_SHA256) += sha256.o > > +obj-$(CONFIG_$(SPL_)ZLIB) += zlib/ > +obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o > + > obj-$(CONFIG_SPL_SAVEENV) += qsort.o > obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/ > ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy) >
On 09/13/2017 01:38 PM, Heinrich Schuchardt wrote: > On 08/08/2017 01:16 AM, York Sun wrote: >> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for >> SPL boot, eg. falcon boot compressed kernel image. >> >> Signed-off-by: York Sun <york.sun@nxp.com> >> Reviewed-by: Tom Rini <trini@konsulko.com> >> --- >> >> Changes in v2: >> Combine Kconfig change and actual code into one patch >> >> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- >> lib/Kconfig | 8 ++++++++ >> lib/Makefile | 5 +++-- >> 3 files changed, 37 insertions(+), 4 deletions(-) <snip> >> - memcpy((void*)load_addr, src, length); >> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) >> + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { >> + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, >> + src, &length)) { > > In this file length is defined as size_t. > > In include/common.h the last parameter of gunzip is defined as unsigned > long *. > > This leads to a compilation warning and probably incorrect results: > CC spl/common/spl/spl_fit.o > common/spl/spl_fit.c: In function ‘spl_load_fit_image’: > common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’ > from incompatible pointer type [-Wincompatible-pointer-types] > src, &length)) { > > Please, correct the patch to pass a compatible parameter. > The patch already made it into the U-Boot git master. > So possibly you want to send a follow up patch. > Heinrich, Thanks for the heads up. I used travis-ci to build all targets but didn't see this warning. What target did you build? York
On 09/13/2017 11:07 PM, York Sun wrote: > On 09/13/2017 01:38 PM, Heinrich Schuchardt wrote: >> On 08/08/2017 01:16 AM, York Sun wrote: >>> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for >>> SPL boot, eg. falcon boot compressed kernel image. >>> >>> Signed-off-by: York Sun <york.sun@nxp.com> >>> Reviewed-by: Tom Rini <trini@konsulko.com> >>> --- >>> >>> Changes in v2: >>> Combine Kconfig change and actual code into one patch >>> >>> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- >>> lib/Kconfig | 8 ++++++++ >>> lib/Makefile | 5 +++-- >>> 3 files changed, 37 insertions(+), 4 deletions(-) > > <snip> > >>> - memcpy((void*)load_addr, src, length); >>> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) >>> + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { >>> + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, >>> + src, &length)) { >> >> In this file length is defined as size_t. >> >> In include/common.h the last parameter of gunzip is defined as unsigned >> long *. >> >> This leads to a compilation warning and probably incorrect results: >> CC spl/common/spl/spl_fit.o >> common/spl/spl_fit.c: In function ‘spl_load_fit_image’: >> common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’ >> from incompatible pointer type [-Wincompatible-pointer-types] >> src, &length)) { >> >> Please, correct the patch to pass a compatible parameter. >> The patch already made it into the U-Boot git master. >> So possibly you want to send a follow up patch. >> > > Thanks for the heads up. I used travis-ci to build all targets but > didn't see this warning. What target did you build? make mrproper make qemu-x86_64_defconfig make Regards Heinrich > > York >
On 09/13/2017 09:27 PM, Heinrich Schuchardt wrote: > On 09/13/2017 11:07 PM, York Sun wrote: >> On 09/13/2017 01:38 PM, Heinrich Schuchardt wrote: >>> On 08/08/2017 01:16 AM, York Sun wrote: >>>> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for >>>> SPL boot, eg. falcon boot compressed kernel image. >>>> >>>> Signed-off-by: York Sun <york.sun@nxp.com> >>>> Reviewed-by: Tom Rini <trini@konsulko.com> >>>> --- >>>> >>>> Changes in v2: >>>> Combine Kconfig change and actual code into one patch >>>> >>>> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- >>>> lib/Kconfig | 8 ++++++++ >>>> lib/Makefile | 5 +++-- >>>> 3 files changed, 37 insertions(+), 4 deletions(-) >> >> <snip> >> >>>> - memcpy((void*)load_addr, src, length); >>>> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) >>>> + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { >>>> + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, >>>> + src, &length)) { >>> >>> In this file length is defined as size_t. >>> >>> In include/common.h the last parameter of gunzip is defined as unsigned >>> long *. >>> >>> This leads to a compilation warning and probably incorrect results: >>> CC spl/common/spl/spl_fit.o >>> common/spl/spl_fit.c: In function ‘spl_load_fit_image’: >>> common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’ >>> from incompatible pointer type [-Wincompatible-pointer-types] >>> src, &length)) { >>> >>> Please, correct the patch to pass a compatible parameter. >>> The patch already made it into the U-Boot git master. >>> So possibly you want to send a follow up patch. >>> >> >> Thanks for the heads up. I used travis-ci to build all targets but >> didn't see this warning. What target did you build? > > make mrproper > make qemu-x86_64_defconfig > make > Heinrich, Thanks. I check travis-ci log. Surprisingly, it has this warning but reports as "passed". Now I start to question what else I missed. York
On Thu, Sep 14, 2017 at 03:20:18PM +0000, York Sun wrote: > On 09/13/2017 09:27 PM, Heinrich Schuchardt wrote: > > On 09/13/2017 11:07 PM, York Sun wrote: > >> On 09/13/2017 01:38 PM, Heinrich Schuchardt wrote: > >>> On 08/08/2017 01:16 AM, York Sun wrote: > >>>> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for > >>>> SPL boot, eg. falcon boot compressed kernel image. > >>>> > >>>> Signed-off-by: York Sun <york.sun@nxp.com> > >>>> Reviewed-by: Tom Rini <trini@konsulko.com> > >>>> --- > >>>> > >>>> Changes in v2: > >>>> Combine Kconfig change and actual code into one patch > >>>> > >>>> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- > >>>> lib/Kconfig | 8 ++++++++ > >>>> lib/Makefile | 5 +++-- > >>>> 3 files changed, 37 insertions(+), 4 deletions(-) > >> > >> <snip> > >> > >>>> - memcpy((void*)load_addr, src, length); > >>>> +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) > >>>> + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { > >>>> + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, > >>>> + src, &length)) { > >>> > >>> In this file length is defined as size_t. > >>> > >>> In include/common.h the last parameter of gunzip is defined as unsigned > >>> long *. > >>> > >>> This leads to a compilation warning and probably incorrect results: > >>> CC spl/common/spl/spl_fit.o > >>> common/spl/spl_fit.c: In function ‘spl_load_fit_image’: > >>> common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’ > >>> from incompatible pointer type [-Wincompatible-pointer-types] > >>> src, &length)) { > >>> > >>> Please, correct the patch to pass a compatible parameter. > >>> The patch already made it into the U-Boot git master. > >>> So possibly you want to send a follow up patch. > >>> > >> > >> Thanks for the heads up. I used travis-ci to build all targets but > >> didn't see this warning. What target did you build? > > > > make mrproper > > make qemu-x86_64_defconfig > > make > > > > Heinrich, > > Thanks. I check travis-ci log. Surprisingly, it has this warning but > reports as "passed". Now I start to question what else I missed. So, yes. One of the things that we don't do today is have -Werror passed. I would love to see the series of patches that fixes the handful of warnings we have today so we could at least make this an option.
On 09/14/2017 05:23 PM, Tom Rini wrote: > On Thu, Sep 14, 2017 at 03:20:18PM +0000, York Sun wrote: >> On 09/13/2017 09:27 PM, Heinrich Schuchardt wrote: >>> On 09/13/2017 11:07 PM, York Sun wrote: >>>> On 09/13/2017 01:38 PM, Heinrich Schuchardt wrote: >>>>> On 08/08/2017 01:16 AM, York Sun wrote: >>>>>> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip >>>>>> support for SPL boot, eg. falcon boot compressed kernel >>>>>> image. >>>>>> >>>>>> Signed-off-by: York Sun <york.sun@nxp.com> Reviewed-by: >>>>>> Tom Rini <trini@konsulko.com> --- >>>>>> >>>>>> Changes in v2: Combine Kconfig change and actual code >>>>>> into one patch >>>>>> >>>>>> common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- >>>>>> lib/Kconfig | 8 ++++++++ lib/Makefile | >>>>>> 5 +++-- 3 files changed, 37 insertions(+), 4 >>>>>> deletions(-) >>>> >>>> <snip> >>>> >>>>>> - memcpy((void*)load_addr, src, length); +#if >>>>>> defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) + >>>>>> if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) >>>>>> { + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, >>>>>> + src, &length)) { >>>>> >>>>> In this file length is defined as size_t. >>>>> >>>>> In include/common.h the last parameter of gunzip is defined >>>>> as unsigned long *. >>>>> >>>>> This leads to a compilation warning and probably incorrect >>>>> results: CC spl/common/spl/spl_fit.o >>>>> common/spl/spl_fit.c: In function ‘spl_load_fit_image’: >>>>> common/spl/spl_fit.c:201:12: warning: passing argument 4 of >>>>> ‘gunzip’ from incompatible pointer type >>>>> [-Wincompatible-pointer-types] src, &length)) { >>>>> >>>>> Please, correct the patch to pass a compatible parameter. >>>>> The patch already made it into the U-Boot git master. So >>>>> possibly you want to send a follow up patch. >>>>> >>>> >>>> Thanks for the heads up. I used travis-ci to build all >>>> targets but didn't see this warning. What target did you >>>> build? >>> >>> make mrproper make qemu-x86_64_defconfig make >>> >> >> Heinrich, >> >> Thanks. I check travis-ci log. Surprisingly, it has this warning >> but reports as "passed". Now I start to question what else I >> missed. > > So, yes. One of the things that we don't do today is have -Werror > passed. I would love to see the series of patches that fixes the > handful of warnings we have today so we could at least make this > an option. > You just have to switch the compiler and these warnings become real errors. Under Visual C++ long is always 32bit: https://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.140).aspx If it is really only a handful of warnings we should switch -Werror on in the 2017.11 release. Regards Heinrich
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index d2a352e..23f85d2 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -135,6 +135,19 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, ulong overhead; int nr_sectors; int align_len = ARCH_DMA_MINALIGN - 1; +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) + uint8_t image_comp, type; + + if (fit_image_get_comp(fit, node, &image_comp)) + puts("Cannot get image compression format.\n"); + else + debug("%s ", genimg_get_comp_name(image_comp)); + + if (fit_image_get_type(fit, node, &type)) + puts("Cannot get image type.\n"); + else + debug("%s ", genimg_get_type_name(type)); +#endif offset = fdt_getprop_u32(fit, node, "data-offset"); if (offset == FDT_ERROR) @@ -154,7 +167,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, if (info->read(info, sector + get_aligned_image_offset(info, offset), nr_sectors, (void*)load_ptr) != nr_sectors) return -EIO; - debug("image: dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, + debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, (unsigned long)length); src = (void *)load_ptr + overhead; @@ -162,7 +175,18 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, board_fit_image_post_process(&src, &length); #endif - memcpy((void*)load_addr, src, length); +#if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP) + if (image_comp == IH_COMP_GZIP && type == IH_TYPE_KERNEL) { + if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN, + src, &length)) { + puts("Uncompressing error\n"); + return -EIO; + } + } else +#endif + { + memcpy((void *)load_addr, src, length); + } if (image_info) { image_info->load_addr = load_addr; diff --git a/lib/Kconfig b/lib/Kconfig index 2f5a210..a3c6520 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -160,6 +160,14 @@ config LZO bool "Enable LZO decompression support" help This enables support for LZO compression algorithm.r + +config SPL_GZIP + bool "Enable gzip decompression support for SPL build" + select SPL_ZLIB + +config SPL_ZLIB + bool + endmenu config ERRNO_STR diff --git a/lib/Makefile b/lib/Makefile index eacc7d6..455cc9d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -11,7 +11,6 @@ obj-$(CONFIG_EFI) += efi/ obj-$(CONFIG_EFI_LOADER) += efi_loader/ obj-$(CONFIG_LZMA) += lzma/ obj-$(CONFIG_LZO) += lzo/ -obj-$(CONFIG_ZLIB) += zlib/ obj-$(CONFIG_BZIP2) += bzip2/ obj-$(CONFIG_TIZEN) += tizen/ obj-$(CONFIG_FIT) += libfdt/ @@ -26,7 +25,6 @@ obj-y += crc16.o obj-$(CONFIG_ERRNO_STR) += errno_str.o obj-$(CONFIG_FIT) += fdtdec_common.o obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o -obj-$(CONFIG_GZIP) += gunzip.o obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o obj-y += initcall.o @@ -49,6 +47,9 @@ obj-$(CONFIG_RSA) += rsa/ obj-$(CONFIG_SHA1) += sha1.o obj-$(CONFIG_SHA256) += sha256.o +obj-$(CONFIG_$(SPL_)ZLIB) += zlib/ +obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o + obj-$(CONFIG_SPL_SAVEENV) += qsort.o obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/ ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for SPL boot, eg. falcon boot compressed kernel image. Signed-off-by: York Sun <york.sun@nxp.com> --- Changes in v2: Combine Kconfig change and actual code into one patch common/spl/spl_fit.c | 28 ++++++++++++++++++++++++++-- lib/Kconfig | 8 ++++++++ lib/Makefile | 5 +++-- 3 files changed, 37 insertions(+), 4 deletions(-)