[PATCH 2/2] FIT: do not decompress ramdisks even if asked

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 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;
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux