uboot-mediatek: no compression means IH_COMP_NONE
[openwrt/staging/stintel.git] / package / boot / uboot-mediatek / patches / 061-image-fit-don-t-set-compression-if-it-can-t-be-read.patch
1 From b2c109c012ca946baebbb23e7f4301f6eee4c6f3 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 15 Aug 2022 12:15:50 +0200
4 Subject: [PATCH 2/2] image-fit: don't set compression if it can't be read
5
6 fit_image_get_comp() should not set value -1 in case it can't read
7 the compression node. Instead, leave the value untouched in that case
8 as it can be absent and a default value previously defined by the
9 caller of fit_image_get_comp() should be used.
10
11 As a result the warning message
12 WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file!
13 no longer shows if the compression node is actually absent.
14
15 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
16 ---
17 boot/bootm.c | 6 ++----
18 boot/image-fit.c | 3 +--
19 cmd/ximg.c | 7 ++-----
20 3 files changed, 5 insertions(+), 11 deletions(-)
21
22 --- a/boot/bootm.c
23 +++ b/boot/bootm.c
24 @@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const v
25 return -EINVAL;
26 }
27
28 - if (fit_image_get_comp(fit, noffset, &image_comp)) {
29 - puts("Can't get image compression!\n");
30 - return -EINVAL;
31 - }
32 + if (fit_image_get_comp(fit, noffset, &image_comp))
33 + image_comp = IH_COMP_NONE;
34
35 /* Allow the image to expand by a factor of 4, should be safe */
36 load_buf = malloc((1 << 20) + len * 4);
37 --- a/boot/image-fit.c
38 +++ b/boot/image-fit.c
39 @@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)
40 void fit_image_print(const void *fit, int image_noffset, const char *p)
41 {
42 char *desc;
43 - uint8_t type, arch, os, comp;
44 + uint8_t type, arch, os, comp = IH_COMP_NONE;
45 size_t size;
46 ulong load, entry;
47 const void *data;
48 @@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit,
49 data = fdt_getprop(fit, noffset, FIT_COMP_PROP, &len);
50 if (data == NULL) {
51 fit_get_debug(fit, noffset, FIT_COMP_PROP, len);
52 - *comp = -1;
53 return -1;
54 }
55
56 --- a/cmd/ximg.c
57 +++ b/cmd/ximg.c
58 @@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int
59 return 1;
60 }
61
62 - if (fit_image_get_comp(fit_hdr, noffset, &comp)) {
63 - puts("Could not find script subimage "
64 - "compression type\n");
65 - return 1;
66 - }
67 + if (fit_image_get_comp(fit_hdr, noffset, &comp))
68 + comp = IH_COMP_NONE;
69
70 data = (ulong)fit_data;
71 len = (ulong)fit_len;