diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-08-25 12:22:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-08-28 09:52:08 +0200 |
commit | 309b960a6da4c44345135fe463e3516fd63b1499 (patch) | |
tree | f87754ff46583916866fb47d40707817ce81839e | |
parent | b7f0b977dbc34241755a7e8577848dc5efdbe10e (diff) | |
download | barebox-309b960a6da4c44345135fe463e3516fd63b1499.tar.gz barebox-309b960a6da4c44345135fe463e3516fd63b1499.tar.xz |
FIT: do not decompress ramdisks even if asked
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>
Tested-by: Christian Eggers <ceggers@arri.de>
[Tested both patches, as 1/2 is also required ]
Link: https://lore.barebox.org/20230825102246.4189465-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | common/image-fit.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/image-fit.c b/common/image-fit.c index 9ceebde029..0352dc5cbd 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; |