Running mkimage to generate an imximage produces a SEGFAULT
on 64 bit machines due to pointer arithmetic limited to 32 bit.

Signed-off-by: Stefano Babic <sba...@denx.de>
---
 tools/imximage.c |   10 +++++-----
 tools/imximage.h |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 59923ff..76cd903 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -111,7 +111,7 @@ static void imximage_print_header(const void *ptr)
                exit(EXIT_FAILURE);
        }
 
-       ext_header = (flash_cfg_parms_t *) ((uint32_t)&imx_hdr->dcd_table +
+       ext_header = (flash_cfg_parms_t *) ((uint64_t)&imx_hdr->dcd_table +
                        sizeof(dcd_preamble_t) + size);
 
        printf("Image Type:   Freescale IMX Boot Image\n");
@@ -264,15 +264,15 @@ static void imximage_set_header(void *ptr, struct stat 
*sbuf, int ifd,
        fhdr->app_code_jump_vector = params->ep;
 
        base_offset = fhdr->app_dest_ptr + hdr->flash_offset ;
-       fhdr->dcd_ptr_ptr = (uint32_t) ((uint32_t)&fhdr->dcd_ptr -
-               (uint32_t)&fhdr->app_code_jump_vector) + base_offset ;
+       fhdr->dcd_ptr_ptr = (uint32_t) ((uint64_t)&fhdr->dcd_ptr -
+               (uint64_t)&fhdr->app_code_jump_vector) + base_offset ;
 
        fhdr->dcd_ptr = base_offset +
                        ((uint32_t)&hdr->dcd_table -
                        (uint32_t)&hdr->fhdr);
 
        /* The external flash header must be at the end of the DCD table */
-       ext_header = (flash_cfg_parms_t *) ((uint32_t)&hdr->dcd_table +
+       ext_header = (flash_cfg_parms_t *) ((uint64_t)&hdr->dcd_table +
                        dcd_len +
                        sizeof(dcd_preamble_t));
        ext_header->length = sbuf->st_size +
@@ -281,7 +281,7 @@ static void imximage_set_header(void *ptr, struct stat 
*sbuf, int ifd,
 
        /* Security feature are not supported */
        fhdr->app_code_csf = 0;
-       fhdr->super_root_key = NULL;
+       fhdr->super_root_key = 0;
 
 }
 
diff --git a/tools/imximage.h b/tools/imximage.h
index c579f51..b4d926d 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -81,7 +81,7 @@ typedef struct {
        uint32_t app_code_barker;
        uint32_t app_code_csf;
        uint32_t dcd_ptr_ptr;
-       hab_rsa_public_key *super_root_key;
+       uint32_t super_root_key;
        uint32_t dcd_ptr;
        uint32_t app_dest_ptr;
 } flash_header_t;
-- 
1.6.3.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to