[PATCH u-boot-marvell 21/29] tools: kwboot: Patch destination address to DDR area for SPI image

Marek Behún marek.behun at nic.cz
Wed Aug 25 15:46:26 CEST 2021


From: Pali Rohár <pali at kernel.org>

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 at kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun at nic.cz>
---
 tools/kwboot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 9cc7936959..7c6ea2f75d 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -836,6 +836,13 @@ kwboot_img_patch_hdr(void *img, size_t size)
 		if (hdr->srcaddr == 0xFFFFFFFF)
 			hdr->srcaddr = cpu_to_le32(hdrsz);
 		break;
+
+	case IBR_HDR_SPI_ID:
+		if (hdr->destaddr == 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);
+		}
 	}
 
 	hdr->blockid = IBR_HDR_UART_ID;
-- 
2.31.1



More information about the U-Boot mailing list