Skip to contentSkip to conversation

spl_fit.c: enable loading compressed u-boot from fit image

PATCH New Rasmus Villemoes 3 participants 4 messages Dec 11, 2019 – Jan 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl_fit.c: enable loading compressed u-boot from fit image

From: "Klaus H. Sorensen" <[email protected]>

Allow reading compressed content from fit image, even if CONFIG_SPL_OS_BOOT is not set.

This allow booting compressed 2nd stage u-boot from fit image.

Additionally, do not print warning message if compression node is not found, since it simply implies the content is uncompressed.

---
 common/spl/spl_fit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
common/spl/spl_fit.c +3 -5
index b3e3ccd5a2..98271eb878 100644
@@ -195,11 +195,9 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 			debug("%s ", genimg_get_type_name(type));
 	}
 
-	if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
-		if (fit_image_get_comp(fit, node, &image_comp))
-			puts("Cannot get image compression format.\n");
-		else
-			debug("%s ", genimg_get_comp_name(image_comp));
+	if (IS_ENABLED(CONFIG_SPL_GZIP)) {
+		fit_image_get_comp(fit, node, &image_comp);
+		debug("%s ", genimg_get_comp_name(image_comp));
 	}
 
 	if (fit_image_get_load(fit, node, &load_addr))
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 spl_fit.c: enable loading compressed u-boot from fit image

Hi Rasmus,

Quoted 22 lines · Rasmus Villemoes

From: "Klaus H. Sorensen" <[email protected]>

Allow reading compressed content from fit image, even if CONFIG_SPL_OS_BOOT is not set.

This allow booting compressed 2nd stage u-boot from fit image.

Additionally, do not print warning message if compression node is not found, since it simply implies the content is uncompressed.

---
 common/spl/spl_fit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
common/spl/spl_fit.c +0 -0
index b3e3ccd5a2..98271eb878 100644

common/spl/spl_fit.c static int spl_load_fit_image(struct spl_load_info *info, ulong sector, · line 200

Quoted 6 lines
common/spl/spl_fit.c +0 -3
@@ -195,11 +195,9 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
                        debug("%s ", genimg_get_type_name(type));
        }
 
-       if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
-               if (fit_image_get_comp(fit, node, &image_comp))
-                       puts("Cannot get image compression format.\n");

You dropped this error, which seems necessary.

Quoted 11 lines
common/spl/spl_fit.c +3 -3
-               else
-                       debug("%s ", genimg_get_comp_name(image_comp));
+       if (IS_ENABLED(CONFIG_SPL_GZIP)) {
+               fit_image_get_comp(fit, node, &image_comp);
+               debug("%s ", genimg_get_comp_name(image_comp));
        }
 
        if (fit_image_get_load(fit, node, &load_addr))
--

2.23.0

Regards,
Simon

#2 lore raw

PATCH 1/1 spl_fit.c: enable loading compressed u-boot from fit image

Quoted 29 lines · Simon Glass

Hi Rasmus,

Quoted 25 lines · Rasmus Villemoes

From: "Klaus H. Sorensen" <[email protected]>

Allow reading compressed content from fit image, even if CONFIG_SPL_OS_BOOT is not set.

This allow booting compressed 2nd stage u-boot from fit image.

Additionally, do not print warning message if compression node is not found, since it simply implies the content is uncompressed.

---
 common/spl/spl_fit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
common/spl/spl_fit.c +0 -0
index b3e3ccd5a2..98271eb878 100644
@@ -195,11 +195,9 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
                        debug("%s ", genimg_get_type_name(type));
        }
 
Quoted 5 lines

common/spl/spl_fit.c static int spl_load_fit_image(struct spl_load_info *info, ulong sector, · line 200

Quoted 3 lines
common/spl/spl_fit.c +0 -3
-       if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
-               if (fit_image_get_comp(fit, node, &image_comp))
-                       puts("Cannot get image compression format.\n");

You dropped this error, which seems necessary.

How so? There's no change in control flow, and the code proceeds exactly as if 'compression = "none"' was specified (or, in fact, for some reason, 'compression = "bzip2"' or anything else at all also ends up with the image just being memcpy'ed to its loadaddr).

If a 'compression = "foo"' property is supposed to be mandatory (even to explicitly specify "none"), I'm fine leaving it in. But it seems that what's really needed is an error message (and actually erroring out) if the compression property specifies something other than "none" or "gzip".

Rasmus

#3 lore raw

PATCH 1/1 spl_fit.c: enable loading compressed u-boot from fit image

In reply to Rasmus Villemoes
Quoted 5 lines · Rasmus Villemoes

From: "Klaus H. Sorensen" <[email protected]>

Allow reading compressed content from fit image, even if CONFIG_SPL_OS_BOOT is not set.

Quoted 7 lines

This allow booting compressed 2nd stage u-boot from fit image.

Additionally, do not print warning message if compression node is not found, since it simply implies the content is uncompressed.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200123/78e2f256/attachment.sig>