summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Kerma <drEagle@doukki.net>2014-10-31 01:03:27 +0100
committerTom Rini <trini@ti.com>2014-11-04 15:03:07 -0500
commit26f195c71252e98aebfffd5cfa994a4475559370 (patch)
tree80b6588dbcf81d0814286fb6a8451bb2df8a771c /tools
parent336be762281f86050d70ed3430183be9ad58a1ed (diff)
downloadtalos-obmc-uboot-26f195c71252e98aebfffd5cfa994a4475559370.tar.gz
talos-obmc-uboot-26f195c71252e98aebfffd5cfa994a4475559370.zip
ARM: kwimage: fix v0 format
This patch fix the kwimage tools for version 0 fileformat used for kirkwood Tested on sheevaplug Signed-off-by: Gerald Kerma <drEagle@doukki.net> Tested-by: Stefan Roese <sr@denx.de> Reviewed-by: Stefan Roese <sr@denx.de> Acked-By: Prafulla Wadaskar <prafulla@marvell.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/kwbimage.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index ec52f9ee43..c50f2e2b24 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -325,7 +325,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;
@@ -811,8 +811,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);
@@ -835,7 +835,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;
@@ -843,7 +844,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;
}
OpenPOWER on IntegriCloud