From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vagrant Cascadian Date: Tue, 09 Apr 2019 13:54:12 -0700 Subject: [U-Boot] [U-Boot, v1] fdt: Fix mkimage list to try every header type In-Reply-To: <20190409173609.18388-1-jorhand@microsoft.com> References: <20190409173609.18388-1-jorhand@microsoft.com> Message-ID: <874l7699xn.fsf@ponder> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2019-04-09, Jordan Hand wrote: > Signed-off-by: Jordan Hand > --- > 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 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, ¶ms); > + 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, ¶ms); > + } 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, ¶ms); > + } > > (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: