image-fit: don't set compression if it can't be read
PATCH 1/1 image-fit: don't set compression if it can't be read
fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used.
As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.
--- boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
boot/bootm.c +2 -4
@@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &imape_comp)) { -puts ("Can't get image compression!\n" ); -return -EINVAL ; - } +if (fit_image_get_comp (fit, noffset, &imape_comp)) + image_comp =IH_COMP_NONE ;/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ;
boot/image-fit.c +1 -2
@@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)void fit_image_print (const void *fit,int image_noffset,const char *p) {char *desc; -uint8_t type, arch, os, comp; +uint8_t type, arch, os, comp =IH_COMP_NONE ;size_t size;ulong load, entry;const void *data;
@@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data =fdt_getprop (fit, noffset,FIT_COMP_PROP , &len);if (data ==NULL ) {fit_get_debug (fit, noffset,FIT_COMP_PROP , len); - *comp =-1 ;return -1 ; }
cmd/ximg.c +2 -5
@@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } -if (fit_image_get_comp (fit_hdr, noffset, &comp)) { -puts ("Could not find script subimage " -"compression type\n" ); -return 1 ; - } +if (fit_image_get_comp (fit_hdr, noffset, &comp)) + comp =IH_COMP_NONE ; data = (ulong )fit_data; len = (ulong )fit_len;
Signature · 1 line
2.37.1
Quoted 10 lines · Daniel Golle
fit_image_get_comp()should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller offit_image_get_comp()should be used.As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.
Quoted 6 lines
Signed-off-by Daniel Golle <[email protected]>--- boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
Quoted 11 lines · Daniel Golle
fit_image_get_comp()should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller offit_image_get_comp()should be used.As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.Signed-off-by Daniel Golle <[email protected]>Reviewed-by Simon Glass <[email protected]>
This causes most platforms to fail to build with an error such as:
https://source.denx.de/u-boot/u-boot/-/jobs/486959#L140
Signature · 1 line
Tom
PATCH v2 1/1 image-fit: don't set compression if it can't be read
fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used.
As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.
---
v2: fix typo 'imape_comp' vs. 'image_comp'
boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
boot/bootm.c +2 -4
@@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &imape_comp)) { -puts ("Can't get image compression!\n" ); -return -EINVAL ; - } +if (fit_image_get_comp (fit, noffset, &imape_comp)) + imape_comp =IH_COMP_NONE ;/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ;
boot/image-fit.c +1 -2
@@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)void fit_image_print (const void *fit,int image_noffset,const char *p) {char *desc; -uint8_t type, arch, os, comp; +uint8_t type, arch, os, comp =IH_COMP_NONE ;size_t size;ulong load, entry;const void *data;
@@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data =fdt_getprop (fit, noffset,FIT_COMP_PROP , &len);if (data ==NULL ) {fit_get_debug (fit, noffset,FIT_COMP_PROP , len); - *comp =-1 ;return -1 ; }
cmd/ximg.c +2 -5
@@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } -if (fit_image_get_comp (fit_hdr, noffset, &comp)) { -puts ("Could not find script subimage " -"compression type\n" ); -return 1 ; - } +if (fit_image_get_comp (fit_hdr, noffset, &comp)) + comp =IH_COMP_NONE ; data = (ulong )fit_data; len = (ulong )fit_len;
Signature · 1 line
2.37.2
Hi Daniel,
Quoted 75 lines · Daniel Golle
fit_image_get_comp()should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller offit_image_get_comp()should be used.As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.Signed-off-by Daniel Golle <[email protected]>---
v2: fix typo 'imape_comp' vs. 'image_comp'boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)boot/bootm.c +2
-4@@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &imape_comp)) { -puts ("Can't get image compression!\n" ); -return -EINVAL ; - } +if (fit_image_get_comp (fit, noffset, &imape_comp)) + imape_comp =IH_COMP_NONE ;/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ;boot/image-fit.c +1
-2@@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)void fit_image_print (const void *fit,int image_noffset,const char *p) {char *desc; -uint8_t type, arch, os, comp; +uint8_t type, arch, os, comp =IH_COMP_NONE ;size_t size;ulong load, entry;const void *data;@@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data =fdt_getprop (fit, noffset,FIT_COMP_PROP , &len);if (data ==NULL ) {fit_get_debug (fit, noffset,FIT_COMP_PROP , len); - *comp =-1 ;return -1 ; }cmd/ximg.c +2
-6@@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } -if (fit_image_get_comp (fit_hdr, noffset, &comp)) { -puts ("Could not find script subimage " -"compression type\n" ); -return 1 ; - } +if (fit_image_get_comp (fit_hdr, noffset, &comp)) + comp =IH_COMP_NONE ; data = (ulong )fit_data; len = (ulong )fit_len; --
Quoted 2 lines
2.37.2
Well it should be imape_comp, so could you fix that error first (in a patch before this one)?
Regards,
SImon
PATCH v3 1/2 bootm: fix typo imape_comp -> image_comp
Chage variable name 'imape_comp' to the supposedly intended name 'image_comp'.
--- boot/bootm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
boot/bootm.c +3 -3
@@ -1006,7 +1006,7 @@ static int bootm_host_load_image(const void *fit, int req_image_type,int noffset;ulong load_end, buf_size;uint8_t image_type; -uint8_t imape_comp; +uint8_t image_comp;void *load_buf;int ret;
@@ -1032,12 +1032,12 @@ static int bootm_host_load_image(const void *fit, int req_image_type,/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ; load_buf =malloc (buf_size); - ret =image_decomp (imape_comp,0 , data, image_type, load_buf, + ret =image_decomp (image_comp,0 , data, image_type, load_buf, (void *)data, len, buf_size, &load_end);free (load_buf);if (ret) { - ret =handle_decomp_error (imape_comp, load_end -0 , buf_size, ret); + ret =handle_decomp_error (image_comp, load_end -0 , buf_size, ret);if (ret !=BOOTM_ERR_UNIMPLEMENTED )return ret; }
Signature · 1 line
2.37.2
PATCH v3 2/2 image-fit: don't set compression if it can't be read
In reply to Simon Glassfit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used.
As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.
--- boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
boot/bootm.c +2 -4
@@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &imape_comp)) { -puts ("Can't get image compression!\n" ); -return -EINVAL ; - } +if (fit_image_get_comp (fit, noffset, &image_comp)) + image_comp =IH_COMP_NONE ;/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ;
boot/image-fit.c +1 -2
@@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)void fit_image_print (const void *fit,int image_noffset,const char *p) {char *desc; -uint8_t type, arch, os, comp; +uint8_t type, arch, os, comp =IH_COMP_NONE ;size_t size;ulong load, entry;const void *data;
@@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data =fdt_getprop (fit, noffset,FIT_COMP_PROP , &len);if (data ==NULL ) {fit_get_debug (fit, noffset,FIT_COMP_PROP , len); - *comp =-1 ;return -1 ; }
cmd/ximg.c +2 -5
@@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } -if (fit_image_get_comp (fit_hdr, noffset, &comp)) { -puts ("Could not find script subimage " -"compression type\n" ); -return 1 ; - } +if (fit_image_get_comp (fit_hdr, noffset, &comp)) + comp =IH_COMP_NONE ; data = (ulong )fit_data; len = (ulong )fit_len;
Signature · 1 line
2.37.2
PATCH v4 1/2 bootm: fix typo imape_comp -> image_comp
In reply to Simon GlassChage variable name 'imape_comp' to the supposedly intended name 'image_comp'.
---
v4: add missing name replacement
boot/bootm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
boot/bootm.c +4 -4
@@ -1006,7 +1006,7 @@ static int bootm_host_load_image(const void *fit, int req_image_type,int noffset;ulong load_end, buf_size;uint8_t image_type; -uint8_t imape_comp; +uint8_t image_comp;void *load_buf;int ret;
@@ -1024,7 +1024,7 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &imape_comp)) { +if (fit_image_get_comp (fit, noffset, &image_comp)) {puts ("Can't get image compression!\n" );return -EINVAL ; }
@@ -1032,12 +1032,12 @@ static int bootm_host_load_image(const void *fit, int req_image_type,/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ; load_buf =malloc (buf_size); - ret =image_decomp (imape_comp,0 , data, image_type, load_buf, + ret =image_decomp (image_comp,0 , data, image_type, load_buf, (void *)data, len, buf_size, &load_end);free (load_buf);if (ret) { - ret =handle_decomp_error (imape_comp, load_end -0 , buf_size, ret); + ret =handle_decomp_error (image_comp, load_end -0 , buf_size, ret);if (ret !=BOOTM_ERR_UNIMPLEMENTED )return ret; }
Signature · 1 line
2.37.2
Re: [PATCH v4 1/2] bootm: fix typo imape_comp -> image_comp
Quoted 2 lines · Daniel Golle
Chage variable name '
imape_comp' to the supposedly intended name
Change
Quoted 9 lines
'
image_comp'.Signed-off-by Daniel Golle <[email protected]>---
v4: add missing name replacement
boot/bootm.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)
Re: [PATCH v4 1/2] bootm: fix typo imape_comp -> image_comp
Quoted 5 lines · Simon Glass
Quoted 2 lines · Daniel Golle
Chage variable name '
imape_comp' to the supposedly intended nameChange
Can you fix that on-the-fly while comitting or should I repost with that typo in the patch description fixed?
Quoted 12 lines
Quoted 10 lines
'
image_comp'.Signed-off-by Daniel Golle <[email protected]>---
v4: add missing name replacement
boot/bootm.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)Reviewed-by Simon Glass <[email protected]>
Re: [PATCH v4 1/2] bootm: fix typo imape_comp -> image_comp
Hi Daniel,
Quoted 10 lines · Daniel Golle
Quoted 5 lines · Simon Glass
Quoted 2 lines · Daniel Golle
Chage variable name '
imape_comp' to the supposedly intended nameChange
Can you fix that on-the-fly while comitting or should I repost with that typo in the patch description fixed?
Yes I suspect Tom can do that.
Regards,
Simon
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
'
image_comp'.Signed-off-by Daniel Golle <[email protected]>---
v4: add missing name replacement
boot/bootm.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)Reviewed-by Simon Glass <[email protected]>
Re: [PATCH v4 1/2] bootm: fix typo imape_comp -> image_comp
Quoted 7 lines · Simon Glass
Hi Daniel,
Quoted 4 lines · Daniel Golle
Quoted 2 lines · Simon Glass
Quoted 1 line · Daniel Golle
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Chage variable name '
imape_comp' to the supposedly intended nameChange
Can you fix that on-the-fly while comitting or should I repost with that typo in the patch description fixed?
Yes I suspect Tom can do that.
Yes, that's fine.
Signature · 1 line
Tom
Re: [PATCH v4 1/2] bootm: fix typo imape_comp -> image_comp
In reply to Daniel GolleQuoted 5 lines · Daniel Golle
Change variable name '
imape_comp' to the supposedly intended name 'image_comp'.Signed-off-by Daniel Golle <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v4 2/2 image-fit: don't set compression if it can't be read
In reply to Simon Glassfit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used.
As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.
---
v2: fix typo 'imape_comp' vs. 'image_comp'
v3: rather fix the typo everywhere in an additional patch before
v4: rebase on updated patch fixing typo
boot/bootm.c | 6 ++----
boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
boot/bootm.c +2 -4
@@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type,return -EINVAL ; } -if (fit_image_get_comp (fit, noffset, &image_comp)) { -puts ("Can't get image compression!\n" ); -return -EINVAL ; - } +if (fit_image_get_comp (fit, noffset, &image_comp)) + image_comp =IH_COMP_NONE ;/* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 <<20 ) + len *4 ;
boot/image-fit.c +1 -2
@@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)void fit_image_print (const void *fit,int image_noffset,const char *p) {char *desc; -uint8_t type, arch, os, comp; +uint8_t type, arch, os, comp =IH_COMP_NONE ;size_t size;ulong load, entry;const void *data;
@@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data =fdt_getprop (fit, noffset,FIT_COMP_PROP , &len);if (data ==NULL ) {fit_get_debug (fit, noffset,FIT_COMP_PROP , len); - *comp =-1 ;return -1 ; }
cmd/ximg.c +2 -5
@@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } -if (fit_image_get_comp (fit_hdr, noffset, &comp)) { -puts ("Could not find script subimage " -"compression type\n" ); -return 1 ; - } +if (fit_image_get_comp (fit_hdr, noffset, &comp)) + comp =IH_COMP_NONE ; data = (ulong )fit_data; len = (ulong )fit_len;
Signature · 1 line
2.37.2
Quoted 16 lines · Daniel Golle
fit_image_get_comp()should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller offit_image_get_comp()should be used.As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.Signed-off-by Daniel Golle <[email protected]>---
v2: fix typo 'imape_comp' vs. 'image_comp'
v3: rather fix the typo everywhere in an additional patch before
v4: rebase on updated patch fixing typo
Quoted 4 lines
boot/bootm.c| 6 ++----boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-)
Quoted 11 lines · Daniel Golle
fit_image_get_comp()should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller offit_image_get_comp()should be used.As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent.Signed-off-by Daniel Golle <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom