Skip to contentSkip to conversation

fdt: Fix mkimage list to try every header type

PATCH New Jordan Hand 3 participants 4 messages Apr 9, 2019 – Apr 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: Fix mkimage list to try every header type

---
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(-)
tools/mkimage.c +15 -8
index 2899adff81..d1e1a6743d 100644
@@ -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);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 fdt: Fix mkimage list to try every header type

Quoted 11 lines · 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.

live well,
vagrant

Quoted 24 lines
tools/mkimage.c +8 -8
index 2899adff81..d1e1a6743d 100644
@@ -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 {

tools/mkimage.c int main(int argc, char **argv) · line 423

Quoted 10 lines
tools/mkimage.c +7 -0
+			/**
+			 * 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>

#2 lore raw

PATCH 1/1 fdt: Fix mkimage list to try every header type

In reply to Jordan Hand
Quoted 8 lines · 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.

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

However, definitely fixes it up for me.

Signature · 1 line
Alex Kiernan
#3 lore raw

PATCH 1/1 fdt: Fix mkimage list to try every header type

Quoted 11 lines · Alex Kiernan
Quoted 8 lines · 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.

Quoted 1 line

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.

Quoted 7 lines

However, definitely fixes it up for me.

--
Alex Kiernan