summaryrefslogtreecommitdiff
path: root/common/image-fit.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-08-02 15:52:28 -0700
committerTom Rini <trini@konsulko.com>2019-08-07 15:31:05 -0400
commitbddd985734653c366c8da073650930fb2e9b5003 (patch)
treebf679ea3c896aa1fa1fac55720408726aa963318 /common/image-fit.c
parent13551b911416044dede2311935f34b29095c8dba (diff)
fit: Do not automatically decompress ramdisk images
The Linux ramdisk should always be decompressed by the kernel itself, not by U-Boot. Therefore, the 'compression' node in the FIT image should always be set to "none" for ramdisk images, since the only point of using that node is if you want U-Boot to do the decompression itself. Yet some systems populate the node to the compression algorithm used by the kernel instead. This used to be ignored, but now that we support decompression of all image types it becomes a problem. Since ramdisks should never be decompressed by U-Boot anyway, this patch adds a special exception for them to avoid these issues. Still, setting the 'compression' node like that is wrong in the first place, so we still want to print out a warning so that third-party distributions doing this can notice and fix it. Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'common/image-fit.c')
-rw-r--r--common/image-fit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index e346fed550..5c63c769de 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1998,10 +1998,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
comp = IH_COMP_NONE;
loadbuf = buf;
/* Kernel images get decompressed later in bootm_load_os(). */
- if (!(image_type == IH_TYPE_KERNEL ||
- image_type == IH_TYPE_KERNEL_NOLOAD) &&
- !fit_image_get_comp(fit, noffset, &comp) &&
- comp != IH_COMP_NONE) {
+ if (!fit_image_get_comp(fit, noffset, &comp) &&
+ comp != IH_COMP_NONE &&
+ !(image_type == IH_TYPE_KERNEL ||
+ image_type == IH_TYPE_KERNEL_NOLOAD ||
+ image_type == IH_TYPE_RAMDISK)) {
ulong max_decomp_len = len * 20;
if (load == data) {
loadbuf = malloc(max_decomp_len);
@@ -2021,6 +2022,10 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
memcpy(loadbuf, buf, len);
}
+ if (image_type == IH_TYPE_RAMDISK && comp != IH_COMP_NONE)
+ puts("WARNING: 'compression' nodes for ramdisks are deprecated,"
+ " please fix your .its file!\n");
+
/* verify that image data is a proper FDT blob */
if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) {
puts("Subimage data is not a FDT");