All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type
@ 2019-04-09 17:36 Jordan Hand
  2019-04-09 20:54 ` [U-Boot] [U-Boot, " Vagrant Cascadian
  2019-04-10  8:52 ` [U-Boot] [PATCH " Alex Kiernan
  0 siblings, 2 replies; 4+ messages in thread
From: Jordan Hand @ 2019-04-09 17:36 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jordan Hand <jorhand@microsoft.com>
---
Image type is not supplied to `mkimage -l`. For this reason, we cannot
use imagetool_verify_print_header_by_type. Instead, this patch uses
imagetool_verify_print_header to look through all header types to find
one where image validation succeeds.

This patch fixes failures in test/image/test-imagetools.sh

 tools/mkimage.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 2899adff81..d1e1a6743d 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -403,14 +403,21 @@ int main(int argc, char **argv)
 			exit (EXIT_FAILURE);
 		}
 
-		/*
-		 * scan through mkimage registry for all supported image types
-		 * and verify the input image file header for match
-		 * Print the image information for matched image type
-		 * Returns the error code if not matched
-		 */
-		retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
-				tparams, &params);
+		if (params.fflag) {
+			/*
+			 * Verifies the header format based on the expected header for image
+			 * type in tparams
+			 */
+			retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
+					tparams, &params);
+		} else {
+			/**
+			 * When listing the image, we are not given the image type. Simply check all
+			 * image types to find one that matches our header
+			 */
+			retval = imagetool_verify_print_header(ptr, &sbuf,
+					tparams, &params);
+		}
 
 		(void) munmap((void *)ptr, sbuf.st_size);
 		(void) close (ifd);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [U-Boot, v1] fdt: Fix mkimage list to try every header type
  2019-04-09 17:36 [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type Jordan Hand
@ 2019-04-09 20:54 ` Vagrant Cascadian
  2019-04-10  8:52 ` [U-Boot] [PATCH " Alex Kiernan
  1 sibling, 0 replies; 4+ messages in thread
From: Vagrant Cascadian @ 2019-04-09 20:54 UTC (permalink / raw)
  To: u-boot

On 2019-04-09, Jordan Hand wrote:
> Signed-off-by: Jordan Hand <jorhand@microsoft.com>
> ---
> Image type is not supplied to `mkimage -l`. For this reason, we cannot
> use imagetool_verify_print_header_by_type. Instead, this patch uses
> imagetool_verify_print_header to look through all header types to find
> one where image validation succeeds.
>
> This patch fixes failures in test/image/test-imagetools.sh
>
>  tools/mkimage.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)

Works for me.

Tested-by: Vagrant Cascadian <vagrant@debian.org>


live well,
  vagrant

> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index 2899adff81..d1e1a6743d 100644
> --- a/tools/mkimage.c
> +++ b/tools/mkimage.c
> @@ -403,14 +403,21 @@ int main(int argc, char **argv)
>  			exit (EXIT_FAILURE);
>  		}
>  
> -		/*
> -		 * scan through mkimage registry for all supported image types
> -		 * and verify the input image file header for match
> -		 * Print the image information for matched image type
> -		 * Returns the error code if not matched
> -		 */
> -		retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
> -				tparams, &params);
> +		if (params.fflag) {
> +			/*
> +			 * Verifies the header format based on the expected header for image
> +			 * type in tparams
> +			 */
> +			retval = imagetool_verify_print_header_by_type(ptr, &sbuf,
> +					tparams, &params);
> +		} else {
> +			/**
> +			 * When listing the image, we are not given the image type. Simply check all
> +			 * image types to find one that matches our header
> +			 */
> +			retval = imagetool_verify_print_header(ptr, &sbuf,
> +					tparams, &params);
> +		}
>  
>  		(void) munmap((void *)ptr, sbuf.st_size);
>  		(void) close (ifd);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190409/9f8c9f69/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type
  2019-04-09 17:36 [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type Jordan Hand
  2019-04-09 20:54 ` [U-Boot] [U-Boot, " Vagrant Cascadian
@ 2019-04-10  8:52 ` Alex Kiernan
  2019-04-10 16:28   ` Jordan Hand
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Kiernan @ 2019-04-10  8:52 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 9, 2019 at 6:36 PM Jordan Hand <jordanhand22@gmail.com> wrote:
>
> Signed-off-by: Jordan Hand <jorhand@microsoft.com>
> ---
> Image type is not supplied to `mkimage -l`. For this reason, we cannot
> use imagetool_verify_print_header_by_type. Instead, this patch uses
> imagetool_verify_print_header to look through all header types to find
> one where image validation succeeds.
>

Doesn't this text want to be part of the changelog and not below the marker?

However, definitely fixes it up for me.

Tested-by: Alex Kiernan <alex.kiernan@gmail.com>

-- 
Alex Kiernan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type
  2019-04-10  8:52 ` [U-Boot] [PATCH " Alex Kiernan
@ 2019-04-10 16:28   ` Jordan Hand
  0 siblings, 0 replies; 4+ messages in thread
From: Jordan Hand @ 2019-04-10 16:28 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 10, 2019 at 1:52 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:
>
> On Tue, Apr 9, 2019 at 6:36 PM Jordan Hand <jordanhand22@gmail.com> wrote:
> >
> > Signed-off-by: Jordan Hand <jorhand@microsoft.com>
> > ---
> > Image type is not supplied to `mkimage -l`. For this reason, we cannot
> > use imagetool_verify_print_header_by_type. Instead, this patch uses
> > imagetool_verify_print_header to look through all header types to find
> > one where image validation succeeds.
> >
>
> Doesn't this text want to be part of the changelog and not below the marker?

Ah, yes. Seems I've messed up my patman formatting. Will submit a v2
so the commit message is cleaner.

>
> However, definitely fixes it up for me.
>
> Tested-by: Alex Kiernan <alex.kiernan@gmail.com>
>
> --
> Alex Kiernan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-10 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 17:36 [U-Boot] [PATCH v1] fdt: Fix mkimage list to try every header type Jordan Hand
2019-04-09 20:54 ` [U-Boot] [U-Boot, " Vagrant Cascadian
2019-04-10  8:52 ` [U-Boot] [PATCH " Alex Kiernan
2019-04-10 16:28   ` Jordan Hand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.