summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2012-10-03 15:47:05 +0000
committerStefano Babic <sbabic@denx.de>2012-10-20 17:13:01 +0200
commit8d8cc828f456a64143a0b94c751f8cfcecfe5dcc (patch)
tree3ef3b28c662eca533e9db34beccb9b2025e47e45
parentf14e6258f3ff7488a1899d784c6d62957c2df859 (diff)
downloadu-boot-imx-8d8cc828f456a64143a0b94c751f8cfcecfe5dcc.zip
u-boot-imx-8d8cc828f456a64143a0b94c751f8cfcecfe5dcc.tar.gz
u-boot-imx-8d8cc828f456a64143a0b94c751f8cfcecfe5dcc.tar.bz2
imximage: move flash_offset check to common location
Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the same check. Move check to before the set_imx_hdr call. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Acked-by: Stefano Babic <sbabic@denx.de>
-rw-r--r--tools/imximage.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/tools/imximage.c b/tools/imximage.c
index bda1a75..3e9ee6a 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -203,13 +203,6 @@ static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
dcd_v1_t *dcd_v1 = &hdr_v1->dcd_table;
uint32_t base_offset;
- /* Exit if there is no BOOT_FROM field specifying the flash_offset */
- if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
- fprintf(stderr, "Error: Header v1: No BOOT_FROM tag in %s\n",
- params->imagename);
- exit(EXIT_FAILURE);
- }
-
/* Set magic number */
fhdr_v1->app_code_barker = APP_CODE_BARKER;
@@ -243,13 +236,6 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
flash_header_v2_t *fhdr_v2 = &hdr_v2->fhdr;
- /* Exit if there is no BOOT_FROM field specifying the flash_offset */
- if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
- fprintf(stderr, "Error: Header v2: No BOOT_FROM tag in %s\n",
- params->imagename);
- exit(EXIT_FAILURE);
- }
-
/* Set magic number */
fhdr_v2->header.tag = IVT_HEADER_TAG; /* 0xD1 */
fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
@@ -475,6 +461,11 @@ static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
fclose(fd);
+ /* Exit if there is no BOOT_FROM field specifying the flash_offset */
+ if (imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
+ fprintf(stderr, "Error: No BOOT_FROM tag in %s\n", name);
+ exit(EXIT_FAILURE);
+ }
return dcd_len;
}