From patchwork Thu Jul 11 13:06:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 258447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 875162C030A for ; Thu, 11 Jul 2013 23:07:26 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF1574A22E; Thu, 11 Jul 2013 15:07:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GRimC4qcMjRi; Thu, 11 Jul 2013 15:07:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0FB6F4A1F3; Thu, 11 Jul 2013 15:07:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C0654A1F1 for ; Thu, 11 Jul 2013 15:07:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P5Xi7MLG6vXM for ; Thu, 11 Jul 2013 15:06:59 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtpi4.ngi.it (smtpi4.ngi.it [88.149.128.104]) by theia.denx.de (Postfix) with ESMTP id 5E9B64A1F0 for ; Thu, 11 Jul 2013 15:06:54 +0200 (CEST) Received: from babic.homelinux.org (88-149-182-160.v4.ngi.it [88.149.182.160]) by smtpi4.ngi.it (Postfix) with ESMTP id C72A242462; Thu, 11 Jul 2013 15:06:53 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 90AE64540605; Thu, 11 Jul 2013 15:06:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UT3rM-MOHT7E; Thu, 11 Jul 2013 15:06:47 +0200 (CEST) Received: from papero.lan (papero.lan [192.168.2.247]) by babic.homelinux.org (Postfix) with ESMTP id E1D7F45406C7; Thu, 11 Jul 2013 15:06:46 +0200 (CEST) From: Stefano Babic To: U-Boot Mailing List Date: Thu, 11 Jul 2013 15:06:35 +0200 Message-Id: <1373548001-19728-2-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373548001-19728-1-git-send-email-sbabic@denx.de> References: <1373548001-19728-1-git-send-email-sbabic@denx.de> MIME-Version: 1.0 Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH v1 1/7] tools: imx_header should not include flash_offset X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.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 --- 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 5e8e470..013fa80 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -68,6 +68,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; @@ -343,9 +344,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); @@ -354,7 +355,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; @@ -455,7 +456,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); } @@ -513,14 +514,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 @@ -531,7 +532,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 5c929e4..da1c4ff 100644 --- a/tools/imximage.h +++ b/tools/imximage.h @@ -163,7 +163,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,