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 <jo...@kwiboo.se>
---
 tools/rkcommon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 4ff48e81a636..952b76297dd9 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -150,12 +150,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];
 };
 
@@ -366,7 +370,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.48.1

Reply via email to