From: Jordan Hand Date: Tue, 9 Apr 2019 17:36:09 +0000 (-0700) Subject: fdt: Fix mkimage list to try every header type X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=73c02e5e4fc1ef53d06289232edd6cc52e3d73f6;p=u-boot.git fdt: Fix mkimage list to try every header type Signed-off-by: Jordan Hand Tested-by: Vagrant Cascadian Tested-by: Alex Kiernan --- 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);