[PATCH] scripts: imx: imx-image: Fix image size for HABv3 images

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 6 01:19:33 PDT 2016


When the image contains CSF data we must add CSF_LEN to the image
size pointer.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 scripts/imx/imx-image.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 20815bf..16f086a 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -210,10 +210,8 @@ static int add_header_v1(struct config_data *data, void *buf)
 	uint32_t loadaddr = data->image_load_addr;
 	uint32_t imagesize = data->load_size;
 
-	if (add_barebox_header) {
+	if (add_barebox_header)
 		memcpy(buf, bb_header, sizeof(bb_header));
-		*psize = imagesize;
-	}
 
 	buf += offset;
 	hdr = buf;
@@ -246,6 +244,9 @@ static int add_header_v1(struct config_data *data, void *buf)
 		imagesize += CSF_LEN;
 	}
 
+	if (add_barebox_header)
+		*psize = imagesize;
+
 	*(uint32_t *)buf = imagesize;
 
 	return 0;
-- 
2.7.0




More information about the barebox mailing list