tools: imagetool: Fix error message when verify_header is undefined
PATCH 1/3 tools: imagetool: Fix error message when verify_header is undefined
--- tools/imagetool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/imagetool.c +1 -1
@@ -105,7 +105,7 @@ static int imagetool_verify_print_header_by_type( } }else { -fprintf (stderr,"%s: print_header undefined for %s\n" , +fprintf (stderr,"%s: verify_header undefined for %s\n" , params->cmdname, tparams->name); }
Signature · 1 line
2.20.1
PATCH 2/3 tools: imagetool: Show error message when detecting image type failed
--- tools/imagetool.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/imagetool.c +5 -0
@@ -71,6 +71,11 @@ int imagetool_verify_print_header( } } +if (retval !=0 ) { +fprintf (stderr,"%s: cannot detect image type\n" , + params->cmdname); + } +return retval; }
Signature · 1 line
2.20.1
Re: [PATCH u-boot 2/3] tools: imagetool: Show error message when detecting image type failed
Quoted 1 line · Pali Rohár
Signed-off-by Pali Rohár <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 3/3 tools: imagetool: Skip autodetection of gpimage type
In reply to Pali Rohárgpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
--- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/imagetool.c +6 -0
@@ -49,6 +49,12 @@ int imagetool_verify_print_header(return imagetool_verify_print_header_by_type (ptr, sbuf, tparams, params);for (curr = start; curr != end; curr++) { +/* +* Basically every data file can be guessed / verified as gpimage, +* so skip autodetection of data file as gpimage as it does not work. +*/ +if ((*curr)->check_image_type && (*curr)->check_image_type (IH_TYPE_GPIMAGE ) ==0 ) +continue ;if ((*curr)->verify_header) { retval = (*curr)->verify_header ((unsigned char *)ptr, sbuf->st_size, params);
Signature · 1 line
2.20.1
Re: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
Quoted 7 lines · Pali Rohár
gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
Quoted 5 lines
Signed-off-by Pali Rohár <[email protected]>--- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+)
Re: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
Quoted 8 lines · Simon Glass
Quoted 7 lines · Pali Rohár
gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Pali Rohár <[email protected]>--- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+)Reviewed-by Simon Glass <[email protected]>
I see we've had problems with gpimage before too. This seems reasonable but I'm adding Nishanth here too, as the current interested person in keystone2 platforms, to see if there's any other / better ways to address this problem.
Signature · 1 line
Tom
Re: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
Quoted 15 lines · On Monday 30 January 2023 13:02:42 Tom Rini wrote:
Quoted 14 lines · Simon Glass
Quoted 12 lines · Pali Rohár
gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
Signed-off-by Pali Rohár <[email protected]>--- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 9 lines
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>I see we've had problems with gpimage before too. This seems reasonable but I'm adding Nishanth here too, as the current interested person in keystone2 platforms, to see if there's any other / better ways to address this problem.
Signature · 1 line
Tom
I do not think that there is a better solution for gpimage. Basically it is not possible to write autodetection code for gpimage due to its generic nature. So the best what we can do is to disable gpimage in autodetection code.
I would suggest to apply this patch, so people can test their build setups sooner than later.
Re: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
Quoted 23 lines · Pali Rohár
Quoted 15 lines · On Monday 30 January 2023 13:02:42 Tom Rini wrote:
Quoted 14 lines · Simon Glass
Quoted 12 lines · Pali Rohár
gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
Signed-off-by Pali Rohár <[email protected]>--- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+)Quoted 6 lines
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>I see we've had problems with gpimage before too. This seems reasonable but I'm adding Nishanth here too, as the current interested person in keystone2 platforms, to see if there's any other / better ways to address this problem.
Quoted 7 lines
I do not think that there is a better solution for gpimage. Basically it is not possible to write autodetection code for gpimage due to its generic nature. So the best what we can do is to disable gpimage in autodetection code.
I would suggest to apply this patch, so people can test their build setups sooner than later.
Yes, I will pick this up before -rc2. I was wondering / hoping Nishanth might have access to further internal information that might be helpful here.
Signature · 1 line
Tom
Re: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type
In reply to Pali RohárQuoted 8 lines · Pali Rohár
gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage.
Signed-off-by Pali Rohár <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
On Sun, 29 Jan 2023 at 09:46, Pali Rohár <[email protected]> wrote:
commit message? Also it is good to keep subjects to under 60 chars
Quoted 22 lines
Signed-off-by Pali Rohár <[email protected]>--- tools/imagetool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/imagetool.c +1
-2@@ -105,7 +105,7 @@ static int imagetool_verify_print_header_by_type( } }else { -fprintf (stderr,"%s: print_header undefined for %s\n" , +fprintf (stderr,"%s: verify_header undefined for %s\n" , params->cmdname, tparams->name); } --2.20.1
Quoted 1 line · Pali Rohár
Signed-off-by Pali Rohár <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom