]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fdt: Fix mkimage list to try every header type
authorJordan Hand <jordanhand22@gmail.com>
Tue, 9 Apr 2019 17:36:09 +0000 (10:36 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 12 Apr 2019 02:10:50 +0000 (20:10 -0600)
Signed-off-by: Jordan Hand <jorhand@microsoft.com>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
Tested-by: Alex Kiernan <alex.kiernan@gmail.com>
tools/mkimage.c

index 2899adff81079e4a92edfe454e88c92d159d2e7a..d1e1a6743d15f9f03c59138b11941afda37964d2 100644 (file)
@@ -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);