Skip to contentSkip to conversation

tools/kwbimage.c: Make sure that the resulting image is 4-byte aligned

PATCH New Stefan Roese 1 participant 1 message Nov 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/kwbimage.c: Make sure that the resulting image is 4-byte aligned

With the dtb added to the main U-Boot image, it can happen, that the resulting image is not 4-byte aligned. As the dtb tends to be unaligned. But the image needs to be 4-byte aligned. At least the Marvell hdrparser tool complains if its unaligned. By returning 1 here in kwbimage_generate(), called via tparams->vrec_header() in mkimage.c, mkimage will automatically pad the resulting image to a 4-byte size if necessary.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
---
 tools/kwbimage.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/kwbimage.c +9 -1
index 5f6d91c..8fe3bf4 100644
@@ -810,7 +810,15 @@ static int kwbimage_generate(struct image_tool_params *params,
 	tparams->header_size = alloc_len;
 	tparams->hdr = hdr;
 
-	return 0;
+	/*
+	 * The resulting image needs to be 4-byte aligned. At least
+	 * the Marvell hdrparser tool complains if its unaligned.
+	 * By returning 1 here in this function, called via
+	 * tparams->vrec_header() in mkimage.c, mkimage will
+	 * automatically pad the the resulting image to a 4-byte
+	 * size if necessary.
+	 */
+	return 1;
 }
 
 /*
Signature · 1 line
2.6.3