aboutsummaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
authorPali Rohár2021-09-24 23:06:59 +0200
committerStefan Roese2021-10-01 11:07:13 +0200
commitf2c644e0b8bc7dc842c8b27e65c69e503687296f (patch)
tree8f4f55892cf52cbd95f2f5c99ebc15f74bd0aa81 /tools/kwboot.c
parent792e42355083a7d57c156b45ce6701243989c495 (diff)
tools: kwboot: Patch destination address to DDR area for SPI image
SPI/NOR kwbimage may have destination address set to 0xFFFFFFFF, which means that the image is not downloaded to DDR but rather it is executed directly from SPI/NOR. In this case execution address is set to SPI/NOR area. When patching image to UART type, change destination and execution addresses from SPI/NOR XIP area to DDR area 0x00800000 (which is default for A38x). Signed-off-by: Pali Rohár <pali@kernel.org> [ refactored ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 907a574bfc2..b1dcd3796ce 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -836,6 +836,14 @@ kwboot_img_patch_hdr(void *img, size_t size)
if (srcaddr == 0xFFFFFFFF)
hdr->srcaddr = cpu_to_le32(hdrsz);
break;
+
+ case IBR_HDR_SPI_ID:
+ if (hdr->destaddr == cpu_to_le32(0xFFFFFFFF)) {
+ kwboot_printv("Patching destination and execution addresses from SPI/NOR XIP area to DDR area 0x00800000\n");
+ hdr->destaddr = cpu_to_le32(0x00800000);
+ hdr->execaddr = cpu_to_le32(0x00800000);
+ }
+ break;
}
is_secure = kwboot_img_is_secure(img);