projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'u-boot-imx-20211020' of https://source.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git]
/
tools
/
imximage.c
diff --git
a/tools/imximage.c
b/tools/imximage.c
index
6dabb13
..
5c23fba
100644
(file)
--- a/
tools/imximage.c
+++ b/
tools/imximage.c
@@
-1,3
+1,4
@@
+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2009
* Stefano Babic, DENX Software Engineering, sbabic@denx.de.
/*
* (C) Copyright 2009
* Stefano Babic, DENX Software Engineering, sbabic@denx.de.
@@
-5,16
+6,18
@@
* (C) Copyright 2008
* Marvell Semiconductor <www.marvell.com>
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
* (C) Copyright 2008
* Marvell Semiconductor <www.marvell.com>
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include "imagetool.h"
#include <image.h>
#include "imximage.h"
*/
#include "imagetool.h"
#include <image.h>
#include "imximage.h"
+#include <generated/autoconf.h>
#define UNDEFINED 0xFFFFFFFF
#define UNDEFINED 0xFFFFFFFF
+#if !defined(CONFIG_IMX_DCD_ADDR)
+#define CONFIG_IMX_DCD_ADDR 0x00910000
+#endif
/*
* Supported commands for configuration file
*/
/*
* Supported commands for configuration file
*/
@@
-507,8
+510,7
@@
static void print_hdr_v2(struct imx_header *imx_hdr)
genimg_print_size(hdr_v2->boot_data.size);
printf("Load Address: %08x\n", (uint32_t)fhdr_v2->boot_data_ptr);
printf("Entry Point: %08x\n", (uint32_t)fhdr_v2->entry);
genimg_print_size(hdr_v2->boot_data.size);
printf("Load Address: %08x\n", (uint32_t)fhdr_v2->boot_data_ptr);
printf("Entry Point: %08x\n", (uint32_t)fhdr_v2->entry);
- if (fhdr_v2->csf && (imximage_ivt_offset != UNDEFINED) &&
- (imximage_csf_size != UNDEFINED)) {
+ if (fhdr_v2->csf) {
uint16_t dcdlen;
int offs;
uint16_t dcdlen;
int offs;
@@
-516,12
+518,18
@@
static void print_hdr_v2(struct imx_header *imx_hdr)
offs = (char *)&hdr_v2->data.dcd_table
- (char *)hdr_v2;
offs = (char *)&hdr_v2->data.dcd_table
- (char *)hdr_v2;
+ /*
+ * The HAB block is the first part of the image, from
+ * start of IVT header (fhdr_v2->self) to the start of
+ * the CSF block (fhdr_v2->csf). So HAB size is
+ * calculated as:
+ * HAB_size = fhdr_v2->csf - fhdr_v2->self
+ */
printf("HAB Blocks: 0x%08x 0x%08x 0x%08x\n",
(uint32_t)fhdr_v2->self, 0,
printf("HAB Blocks: 0x%08x 0x%08x 0x%08x\n",
(uint32_t)fhdr_v2->self, 0,
- hdr_v2->boot_data.size - imximage_ivt_offset -
- imximage_csf_size);
- printf("DCD Blocks: 00910000 %08x %08x\n",
- offs, be16_to_cpu(dcdlen));
+ (uint32_t)(fhdr_v2->csf - fhdr_v2->self));
+ printf("DCD Blocks: 0x%08x 0x%08x 0x%08x\n",
+ CONFIG_IMX_DCD_ADDR, offs, be16_to_cpu(dcdlen));
}
} else {
imx_header_v2_t *next_hdr_v2;
}
} else {
imx_header_v2_t *next_hdr_v2;
@@
-777,6
+785,11
@@
static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
fclose(fd);
(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
fclose(fd);
+ /* Exit if there is no BOOT_FROM field specifying the flash_offset */
+ if (imximage_ivt_offset == FLASH_OFFSET_UNDEFINED) {
+ fprintf(stderr, "Error: No BOOT_FROM tag in %s\n", name);
+ exit(EXIT_FAILURE);
+ }
return dcd_len;
}
return dcd_len;
}