Message ID | 20230630121146.513345-5-abbaraju.manojsai@amarulasolutions.com |
---|---|
State | Superseded |
Delegated to: | Kever Yang |
Headers | show |
Series | support for booting the compressed U-boot binary on Rockchip based SOC's | expand |
El Fri, Jun 30, 2023 at 05:41:40PM +0530, Manoj Sai deia: > If GZIP Compression support is enabled, GZIP compressed U-Boot raw binary will > be at a specified RAM location which is defined at > UBOOT_COMPRESSED_BINARY_FIT_USER_DEF_ADDR and will be assign it as > the source address. > > gunzip function in spl_load_fit_image ,will decompress the GZIP compressed > U-Boot raw binary which is placed at source address to the default > CONFIG_SYS_TEXT_BASE location. > > spl_load_fit_image function will load the decompressed U-Boot > raw binary, which is placed at the CONFIG_SYS_TEXT_BASE location. > > Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com> > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com> > --- > common/spl/spl_fit.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index 730639f756..e2101099ef 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -281,7 +281,12 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > return 0; > } > > - src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); > + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { > + src_ptr = map_sysmem(ALIGN(CONFIG_VAL(UBOOT_COMPRESSED_BINARY_FIT_USER_DEF_ADDR), > + ARCH_DMA_MINALIGN), len); > + } else { > + src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); > + } > length = len; > > overhead = get_aligned_image_overhead(info, offset); > @@ -319,11 +324,14 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, > board_fit_image_post_process(fit, node, &src, &length); > > load_ptr = map_sysmem(load_addr, length); > - if (IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) { > - size = length; > - if (gunzip(load_ptr, CONFIG_SYS_BOOTM_LEN, src, &size)) { > - puts("Uncompressing error\n"); > - return -EIO; > + > + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { > + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { You just repeated the same condition in a new if here ? > + size = length; > + if (gunzip(load_ptr, CONFIG_SYS_BOOTM_LEN, src, &size)) { > + puts("Uncompressing error\n"); > + return -EIO; > + } > } > length = size; > } else { > -- > 2.25.1 >
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 730639f756..e2101099ef 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -281,7 +281,12 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, return 0; } - src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { + src_ptr = map_sysmem(ALIGN(CONFIG_VAL(UBOOT_COMPRESSED_BINARY_FIT_USER_DEF_ADDR), + ARCH_DMA_MINALIGN), len); + } else { + src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); + } length = len; overhead = get_aligned_image_overhead(info, offset); @@ -319,11 +324,14 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, board_fit_image_post_process(fit, node, &src, &length); load_ptr = map_sysmem(load_addr, length); - if (IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) { - size = length; - if (gunzip(load_ptr, CONFIG_SYS_BOOTM_LEN, src, &size)) { - puts("Uncompressing error\n"); - return -EIO; + + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) { + size = length; + if (gunzip(load_ptr, CONFIG_SYS_BOOTM_LEN, src, &size)) { + puts("Uncompressing error\n"); + return -EIO; + } } length = size; } else {