public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: Loic Poulain <loic.poulain@linaro.org>, sjg@chromium.org, marex@denx.de
Cc: u-boot@lists.denx.de, abbaraju.manojsai@amarulasolutions.com
Subject: Re: [PATCH 2/3] spl: fit: Add support for LZO compressed images
Date: Sat, 4 Nov 2023 11:19:23 -0400	[thread overview]
Message-ID: <5b009ce4-53a0-a2db-878c-3cbf85f44440@gmail.com> (raw)
In-Reply-To: <20231103143426.3643712-2-loic.poulain@linaro.org>

On 11/3/23 10:34, Loic Poulain wrote:
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

Please add an appropriate commit message.

> ---
>   common/spl/spl_fit.c | 10 ++++++++++
>   include/spl.h        |  4 +++-
>   2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 1d42cb1d10..08428660b0 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -18,6 +18,7 @@
>   #include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <linux/libfdt.h>
> +#include <linux/lzo.h>
>   #include <linux/printk.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
> @@ -215,6 +216,8 @@ static inline bool spl_fit_decompression_supported(uint8_t comp)
>   		return IS_ENABLED(CONFIG_SPL_GZIP);
>   	case IH_COMP_LZMA:
>   		return IS_ENABLED(CONFIG_SPL_LZMA);
> +	case IH_COMP_LZO:
> +		return IS_ENABLED(CONFIG_SPL_LZO);
>   	case IH_COMP_NONE:
>   		return true;
>   	}
> @@ -357,6 +360,13 @@ static int load_simple_fit(struct spl_load_info *info, ulong sector,
>   			return -EIO;
>   		}
>   		length = loadEnd - CONFIG_SYS_LOAD_ADDR;
> +	} else if (IS_ENABLED(CONFIG_SPL_LZO) && image_comp == IH_COMP_LZO) {
> +		size = CONFIG_SYS_BOOTM_LEN;
> +		if (lzop_decompress(src, length, load_ptr, &size)) {
> +			puts("Uncompressing error\n");
> +			return -EIO;
> +		}
> +		length = size;
>   	} else {
>   		memcpy(load_ptr, src, length);
>   	}
> diff --git a/include/spl.h b/include/spl.h
> index 8ff20adc28..e07092372a 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -1016,6 +1016,8 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
>    */
>   static inline bool spl_decompression_enabled(void)
>   {
> -	return IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA);
> +	return IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA) ||
> +		IS_ENABLED(CONFIG_SPL_LZO);
>   }
> +
>   #endif

Please also add a decompression test. I think spl_test_image should be extended to
test all decompression types (see do_spl_test_load for inspiration). do_spl_test_load
should also be extended to test LZMA FITs.

--Sean

  reply	other threads:[~2023-11-04 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 14:34 [PATCH 1/3] spl: fit: Discard decompression if not supported Loic Poulain
2023-11-03 14:34 ` [PATCH 2/3] spl: fit: Add support for LZO compressed images Loic Poulain
2023-11-04 15:19   ` Sean Anderson [this message]
2023-11-03 14:34 ` [PATCH 3/3] spl: fit: Load compressed blob to heap buffer Loic Poulain
2023-11-04 15:13   ` Sean Anderson
2023-11-04 15:10 ` [PATCH 1/3] spl: fit: Discard decompression if not supported Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b009ce4-53a0-a2db-878c-3cbf85f44440@gmail.com \
    --to=seanga2@gmail.com \
    --cc=abbaraju.manojsai@amarulasolutions.com \
    --cc=loic.poulain@linaro.org \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox