Files
LibreELEC.tv/projects/Rockchip/patches/u-boot/rockchip-0046-rockchip-mkimage-Add-option-for-image-load-address-a.patch
2025-09-22 13:54:30 +00:00

55 lines
1.7 KiB
Diff

From e7044c65dc50e4fd005d7262af4f6c5536cce038 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 29 Jan 2025 22:36:32 +0000
Subject: [PATCH 46/51] rockchip: mkimage: Add option for image load address
and flag
The v2 image format supports defining a load address and flag for each
embedded image.
Add initial support for writing the image load address and flag to the
v2 image format header.
This may later be used for RK3576 to embed a minimal initial image that
if required to fix booting from SD-card due to a BootROM issue.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
tools/rkcommon.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 8f0616375c1..8b57ba69cde 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -152,12 +152,16 @@ static struct spl_info spl_infos[] = {
*
* @file: image file path
* @size: aligned size of image in bytes
+ * @address: image load address
+ * @flag: no use
*/
struct spl_params {
struct {
char *file;
uint32_t size;
+ uint32_t address;
+ uint32_t flag;
} images[4];
};
@@ -368,7 +372,8 @@ static void rkcommon_set_header0_v2(void *buf, struct image_tool_params *params)
image_sector_count = spl_params.images[i].size / RK_BLK_SIZE;
hdr->images[i].offset = cpu_to_le16(sector_offset);
hdr->images[i].size = cpu_to_le16(image_sector_count);
- hdr->images[i].address = 0xFFFFFFFF;
+ hdr->images[i].address = spl_params.images[i].address ?: 0xFFFFFFFF;
+ hdr->images[i].flag = spl_params.images[i].flag;
hdr->images[i].counter = cpu_to_le32(i + 1);
image_ptr = buf + sector_offset * RK_BLK_SIZE;
do_sha256_hash(image_ptr, spl_params.images[i].size,
--
2.34.1