mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Eggers <ceggers@arri.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] FIT: do not decompress ramdisks even if asked
Date: Fri, 25 Aug 2023 12:45:52 +0200	[thread overview]
Message-ID: <3275337.44csPzL39Z@n95hx1g2> (raw)
In-Reply-To: <20230825102246.4189465-2-a.fatoum@pengutronix.de>

On Friday, 25 August 2023, 12:22:46 CEST, Ahmad Fatoum wrote:
> Linux will decompress its own ramdisk, so a well-formed ITS would
> specify compression = "none", so the bootloader doesn't unpack the
> ramdisk and the kernel takes care of it.
> 
> Some older versions of the Yocto kernel-fitimage.bbclass did populate
> compression != "none" for ramdisks, so now barebox will fail to boot
> the FIT images generated by them.
> 
> Fix this issue by not acting on the compression property when the image
> in question is a ramdisk. We still print a warning, so users can fix
> their ITS.
> 
> This aligns us with U-Boot's behavior[1].
> 
> [1]: https://git.yoctoproject.org/poky/commit/?h=kirkstone&id=2c58079222310
> [2]: https://github.com/u-boot/u-boot/commit/bddd985734653c366c8da073650930
> 
> Fixes: 2ab6780b80e3 ("FIT: add first support for compressed images")
> Reported-by: Christian Eggers <ceggers@arri.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/image-fit.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 9ceebde02931..0352dc5cbd0c 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -565,6 +565,7 @@ static void fit_uncompress_error_fn(char *x)
>  }
>  
>  static int fit_handle_decompression(struct device_node *image,
> +				    const char *type,
>  				    const void **data,
>  				    int *data_len)
>  {
> @@ -576,6 +577,12 @@ static int fit_handle_decompression(struct device_node *image,
>  	if (!compression || !strcmp(compression, "none"))
>  		return 0;
>  
> +	if (!strcmp(type, "ramdisk")) {
> +		pr_warn("compression != \"none\" for ramdisks is deprecated,"
> +			" please fix your .its file!\n");
> +		return 0;
> +	}
> +
>  	if (!IS_ENABLED(CONFIG_UNCOMPRESS)) {
>  		pr_err("image has compression = \"%s\", but support not compiled in\n",
>  		       compression);
> @@ -652,7 +659,7 @@ int fit_open_image(struct fit_handle *handle, void *configuration,
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = fit_handle_decompression(image, &data, &data_len);
> +	ret = fit_handle_decompression(image, type, &data, &data_len);
>  	if (ret)
>  		return ret;
>  
> 

Hi Ahmad,

thanks for the fast solution!

Tested-by: Christian Eggers <ceggers@arri.de>
[Tested both patches, as 1/2 is also required ]






  reply	other threads:[~2023-08-25 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 10:22 [PATCH 1/2] FIT: refactor compression handling into separate function Ahmad Fatoum
2023-08-25 10:22 ` [PATCH 2/2] FIT: do not decompress ramdisks even if asked Ahmad Fatoum
2023-08-25 10:45   ` Christian Eggers [this message]
2023-08-28  7:52 ` [PATCH 1/2] FIT: refactor compression handling into separate function Sascha Hauer

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=3275337.44csPzL39Z@n95hx1g2 \
    --to=ceggers@arri.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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