]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
tools: imx_header should not include flash_offset
authorStefano Babic <sbabic@denx.de>
Wed, 26 Jun 2013 15:26:27 +0000 (17:26 +0200)
committerStefano Babic <sbabic@denx.de>
Sat, 31 Aug 2013 13:06:28 +0000 (15:06 +0200)
Doing a  make distclean; make mx6qsabresd_config; make
and      hexdump -C u-boot.imx | less

 ...
 00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000003f0  00 00 00 00 00 00 00 00  00 00 00 00 00 04 00 00  |................|
                                                ^^^^^^^^^^^
 00000400  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 00001000  13 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |...ê.ð.å.ð.å.ð.å|
 ...

shows the flash_offset value being written into the final
generated image, wich is not correct.

Instead create flash_offset as static variable such that the
generated image is "clean".

 00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 00001000  13 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |...ê.ð.å.ð.å.ð.å|

Signed-off-by: Stefano Babic <sbabic@denx.de>
tools/imximage.c
tools/imximage.h

index c8a9ad578bc932cd8491c77390062921ace60481..a347b9bc2d3873da0ea009d006d0d04d61d62ed5 100644 (file)
@@ -52,6 +52,7 @@ static table_entry_t imximage_versions[] = {
 
 static struct imx_header imximage_header;
 static uint32_t imximage_version;
+static uint32_t imximage_flash_offset;
 
 static set_dcd_val_t set_dcd_val;
 static set_dcd_rst_t set_dcd_rst;
@@ -327,9 +328,9 @@ static void parse_cfg_cmd(struct imx_header *imxhdr, int32_t cmd, char *token,
                set_hdr_func(imxhdr);
                break;
        case CMD_BOOT_FROM:
-               imxhdr->flash_offset = get_table_entry_id(imximage_bootops,
+               imximage_flash_offset = get_table_entry_id(imximage_bootops,
                                        "imximage boot option", token);
-               if (imxhdr->flash_offset == -1) {
+               if (imximage_flash_offset == -1) {
                        fprintf(stderr, "Error: %s[%d] -Invalid boot device"
                                "(%s)\n", name, lineno, token);
                        exit(EXIT_FAILURE);
@@ -338,7 +339,7 @@ static void parse_cfg_cmd(struct imx_header *imxhdr, int32_t cmd, char *token,
                        cmd_ver_first = 0;
                break;
        case CMD_BOOT_OFFSET:
-               imxhdr->flash_offset = get_cfg_value(token, name, lineno);
+               imximage_flash_offset = get_cfg_value(token, name, lineno);
                if (unlikely(cmd_ver_first != 1))
                        cmd_ver_first = 0;
                break;
@@ -439,7 +440,7 @@ static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
        fclose(fd);
 
        /* Exit if there is no BOOT_FROM field specifying the flash_offset */
-       if (imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
+       if (imximage_flash_offset == FLASH_OFFSET_UNDEFINED) {
                fprintf(stderr, "Error: No BOOT_FROM tag in %s\n", name);
                exit(EXIT_FAILURE);
        }
@@ -497,14 +498,14 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
         */
        imximage_version = IMXIMAGE_V1;
        /* Be able to detect if the cfg file has no BOOT_FROM tag */
-       imxhdr->flash_offset = FLASH_OFFSET_UNDEFINED;
+       imximage_flash_offset = FLASH_OFFSET_UNDEFINED;
        set_hdr_func(imxhdr);
 
        /* Parse dcd configuration file */
        dcd_len = parse_cfg_file(imxhdr, params->imagename);
 
        /* Set the imx header */
-       (*set_imx_hdr)(imxhdr, dcd_len, params->ep, imxhdr->flash_offset);
+       (*set_imx_hdr)(imxhdr, dcd_len, params->ep, imximage_flash_offset);
 
        /*
         * ROM bug alert
@@ -515,7 +516,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
         *
         * The remaining fraction of a block bytes would not be loaded!
         */
-       *header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 4096);
+       *header_size_ptr = ROUND(sbuf->st_size + imximage_flash_offset, 4096);
 }
 
 int imximage_check_params(struct mkimage_params *params)
index 214187bb8c5aa308760116524be4b126ceaf89ed..ec629a5c9438ee2f1c076500f78adb475be5b7ca 100644 (file)
@@ -147,7 +147,6 @@ struct imx_header {
                imx_header_v1_t hdr_v1;
                imx_header_v2_t hdr_v2;
        } header;
-       uint32_t flash_offset;
 } __attribute__((aligned(4096)));
 
 typedef void (*set_dcd_val_t)(struct imx_header *imxhdr,