All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/7] tools: imx_header should not include flash_offset
Date: Mon, 19 Aug 2013 19:03:16 +0200	[thread overview]
Message-ID: <1376931802-24994-2-git-send-email-sbabic@denx.de> (raw)
In-Reply-To: <1376931802-24994-1-git-send-email-sbabic@denx.de>

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>

---
Changes in v3: None
Changes in v2: None

 tools/imximage.c |   15 ++++++++-------
 tools/imximage.h |    1 -
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index c8a9ad5..a347b9b 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -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)
diff --git a/tools/imximage.h b/tools/imximage.h
index 214187b..ec629a5 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -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,
-- 
1.7.9.5

  reply	other threads:[~2013-08-19 17:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 13:06 [U-Boot] [PATCH v1 0/7] The patchset fixes some issue in the generation of the imx image Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 1/7] tools: imx_header should not include flash_offset Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 2/7] tools: rename mximage_flash_offset to imximage_ivt_offset Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 3/7] tools: dynamically allocate imx_header in imximage Stefano Babic
2013-07-11 18:29   ` Marek Vasut
2013-07-11 13:06 ` [U-Boot] [PATCH v1 4/7] tools: add variable padding of data image in mkimage Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 5/7] tools: add padding of data image file for imximage Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 6/7] tools: add support for setting the CSF into imximage Stefano Babic
2013-07-11 18:14   ` Wolfgang Denk
2013-07-12  9:17     ` Stefano Babic
2013-07-11 13:06 ` [U-Boot] [PATCH v1 7/7] imx: add status reporting for HAB status Stefano Babic
2013-07-11 17:17   ` Fabio Estevam
2013-07-12  8:27     ` Stefano Babic
2013-07-11 18:31   ` Marek Vasut
2013-07-12  8:34     ` Stefano Babic
2013-07-11 18:11 ` [U-Boot] [PATCH v1 0/7] The patchset fixes some issue in the generation of the imx image Otavio Salvador
2013-07-11 18:17   ` Eric Nelson
2013-07-11 20:40 ` Eric Nelson
2013-08-12 14:39 ` [U-Boot] [PATCH v2 " Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 1/7] tools: imx_header should not include flash_offset Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 2/7] tools: rename mximage_flash_offset to imximage_ivt_offset Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 3/7] tools: dynamically allocate imx_header in imximage Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 4/7] tools: add variable padding of data image in mkimage Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 5/7] tools: add padding of data image file for imximage Stefano Babic
2013-08-13  5:10     ` Marek Vasut
2013-08-19 11:17       ` Stefano Babic
2013-08-12 14:39   ` [U-Boot] [PATCH v2 6/7] tools: add support for setting the CSF into imximage Stefano Babic
2013-08-15 18:49     ` Bernhard Walle
2013-08-12 14:39   ` [U-Boot] [PATCH v2 7/7] imx: add status reporting for HAB status Stefano Babic
2013-08-20 20:21     ` Bernhard Walle
2013-08-12 15:23   ` [U-Boot] [PATCH v2 0/7] The patchset fixes some issue in the generation of the imx image Otavio Salvador
2013-08-19 11:30     ` Stefano Babic
2013-08-19 11:40       ` Otavio Salvador
2013-08-19 16:19   ` Tom Rini
2013-08-19 16:44     ` Stefano Babic
2013-08-19 19:00       ` Tom Rini
2013-08-19 19:45         ` Marek Vasut
2013-08-19 19:51           ` Tom Rini
2013-08-19 17:03 ` [U-Boot] [PATCH v3 " Stefano Babic
2013-08-19 17:03   ` Stefano Babic [this message]
2013-08-19 17:03   ` [U-Boot] [PATCH v3 2/7] tools: rename mximage_flash_offset to imximage_ivt_offset Stefano Babic
2013-08-19 17:03   ` [U-Boot] [PATCH v3 3/7] tools: dynamically allocate imx_header in imximage Stefano Babic
2013-08-19 17:03   ` [U-Boot] [PATCH v3 4/7] tools: add variable padding of data image in mkimage Stefano Babic
2013-08-19 17:03   ` [U-Boot] [PATCH v3 5/7] tools: add padding of data image file for imximage Stefano Babic
2013-08-27 15:17     ` [U-Boot] [PATCH v4 " Stefano Babic
2013-09-10 22:14       ` York Sun
2013-09-11  7:13         ` Stefano Babic
2013-09-11 15:20           ` York Sun
2013-08-19 17:03   ` [U-Boot] [PATCH v3 6/7] tools: add support for setting the CSF into imximage Stefano Babic
2013-08-19 17:03   ` [U-Boot] [PATCH v3 7/7] imx: add status reporting for HAB status Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376931802-24994-2-git-send-email-sbabic@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.