
On 2023-07-25 05:51, Manoj Sai wrote:
If LZMA Compression support is enabled, LZMA compressed U-Boot binary will be placed at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assigned as the source address.
image_decomp() function, will decompress the LZMA compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location.
spl_load_fit_image function will load the decompressed U-Boot 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 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index d728ac71fc..208d2f761e 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -246,7 +246,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, debug("%s ", genimg_get_type_name(type)); }
- if (IS_ENABLED(CONFIG_SPL_GZIP)) {
- if (IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA)) {
This should probably change to use new spl_decompression_enabled(), such change should be made in the GZIP patch.
fit_image_get_comp(fit, node, &image_comp); debug("%s ", genimg_get_comp_name(image_comp));
} @@ -280,8 +280,8 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, __func__, fit_get_name(fit, node, NULL)); return 0; }
if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP))
if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) ||
(IS_ENABLED(CONFIG_SPL_LZMA) && image_comp == IH_COMP_LZMA))
Could probably be simplified to something like:
if (spl_decompression_enabled() && (image_comp == IH_COMP_GZIP || image_comp == IH_COMP_LZMA))
Also what happens if I run a SPL without compression enabled, but have a FIT with image parts that is compressed?
Regards, Jonas
src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len); else src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len);
@@ -329,6 +329,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, return -EIO; } length = size;
- } else if (IS_ENABLED(CONFIG_SPL_LZMA) && image_comp == IH_COMP_LZMA) {
size = CONFIG_SYS_BOOTM_LEN;
ulong loadEnd;
if (image_decomp(IH_COMP_LZMA, CONFIG_SYS_LOAD_ADDR, 0, 0,
load_ptr, src, length, size, &loadEnd)) {
puts("Uncompressing error\n");
return -EIO;
}
} else { memcpy(load_ptr, src, length); }length = loadEnd - CONFIG_SYS_LOAD_ADDR;