public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 3/3] ARM: kwimage: fix v0 format
@ 2014-10-31  0:03 Gerald Kerma
  2014-10-31  4:57 ` Prafulla Wadaskar
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gerald Kerma @ 2014-10-31  0:03 UTC (permalink / raw)
  To: u-boot

This patch fix the kwimage tools for version 0 fileformat used for kirkwood
Tested on sheevaplug

Signed-off-by: Gerald Kerma <drEagle@doukki.net>
---
 tools/kwbimage.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 1120e9b..7e2fb5e 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -324,7 +324,7 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params,
 	main_hdr = image;
 
 	/* Fill in the main header */
-	main_hdr->blocksize = payloadsz + sizeof(uint32_t);
+	main_hdr->blocksize = payloadsz + sizeof(uint32_t) - headersz;
 	main_hdr->srcaddr   = headersz;
 	main_hdr->ext       = has_ext;
 	main_hdr->destaddr  = params->addr;
@@ -792,8 +792,8 @@ static void kwbimage_print_header(const void *ptr)
 
 	printf("Image Type:   MVEBU Boot from %s Image\n",
 	       image_boot_mode_name(mhdr->blockid));
-	printf("Data Size:    ");
 	printf("Image version:%d\n", image_version((void *)ptr));
+	printf("Data Size:    ");
 	genimg_print_size(mhdr->blocksize - sizeof(uint32_t));
 	printf("Load Address: %08x\n", mhdr->destaddr);
 	printf("Entry Point:  %08x\n", mhdr->execaddr);
@@ -816,7 +816,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size,
 
 	main_hdr = (void *)ptr;
 	checksum = image_checksum8(ptr,
-				   sizeof(struct main_hdr_v0));
+				   sizeof(struct main_hdr_v0)
+				   - sizeof(uint8_t));
 	if (checksum != main_hdr->checksum)
 		return -FDT_ERR_BADSTRUCTURE;
 
@@ -824,7 +825,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size,
 	if (image_version((void *)ptr) == 0) {
 		ext_hdr = (void *)ptr + sizeof(struct main_hdr_v0);
 		checksum = image_checksum8(ext_hdr,
-					   sizeof(struct ext_hdr_v0));
+					   sizeof(struct ext_hdr_v0)
+					   - sizeof(uint8_t));
 		if (checksum != ext_hdr->checksum)
 			return -FDT_ERR_BADSTRUCTURE;
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-04 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-31  0:03 [U-Boot] [PATCH 3/3] ARM: kwimage: fix v0 format Gerald Kerma
2014-10-31  4:57 ` Prafulla Wadaskar
2014-10-31  6:56 ` Stefan Roese
2014-11-03  7:17   ` Prafulla Wadaskar
2014-11-04 23:24 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox