summaryrefslogtreecommitdiff
path: root/tools/mtk_image.c
diff options
context:
space:
mode:
authorWeijie Gao <weijie.gao@mediatek.com>2023-07-19 12:17:45 +0300
committerTom Rini <trini@konsulko.com>2023-08-03 16:40:50 +0300
commit2bff97ad5ad57f2b1f989a27c6a6906eabe43ddb (patch)
treee8f52b87a904ea67486bc2a5c75e3b32ec50f355 /tools/mtk_image.c
parent93eb707c2825a63adf3fbea0e32bf928da495d23 (diff)
downloadu-boot-2bff97ad5ad57f2b1f989a27c6a6906eabe43ddb.tar.xz
tools: mtk_image: use uint32_t for ghf header magic and version
This patch converts magic and version fields of ghf common header to one field with the type of uint32_t to make this header flexible for futher updates. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Diffstat (limited to 'tools/mtk_image.c')
-rw-r--r--tools/mtk_image.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/mtk_image.c b/tools/mtk_image.c
index 30f54c8e8d..1b1aed5992 100644
--- a/tools/mtk_image.c
+++ b/tools/mtk_image.c
@@ -542,11 +542,13 @@ static void put_brom_layout_header(struct brom_layout_header *hdr, int type)
hdr->type = cpu_to_le32(type);
}
-static void put_ghf_common_header(struct gfh_common_header *gfh, int size,
- int type, int ver)
+static void put_ghf_common_header(struct gfh_common_header *gfh, uint16_t size,
+ uint16_t type, uint8_t ver)
{
- memcpy(gfh->magic, GFH_HEADER_MAGIC, sizeof(gfh->magic));
- gfh->version = ver;
+ uint32_t magic_version = GFH_HEADER_MAGIC |
+ (uint32_t)ver << GFH_HEADER_VERSION_SHIFT;
+
+ gfh->magic_version = cpu_to_le32(magic_version);
gfh->size = cpu_to_le16(size);
gfh->type = cpu_to_le16(type);
}