From 7164b290d03921677e04331636aad396d88773b0 Mon Sep 17 00:00:00 2001 From: Jacek Kryszyn Date: Wed, 22 May 2024 10:02:42 +0200 Subject: [PATCH] Dynamic partitions: change size of a slot Slot size was incorrect due to missing brackets. Now it is equal to double size of hal and rootfs. Some additional code is added to take into account metadata size and alignment of super. Change-Id: I7f163d7e4a74b3f5e7a1a2f207ebece9581b4876 Signed-off-by: Jacek Kryszyn --- sd_fusing.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sd_fusing.py b/sd_fusing.py index 0d2bd22..7624f69 100755 --- a/sd_fusing.py +++ b/sd_fusing.py @@ -1035,8 +1035,19 @@ def do_fuse_image_super(tmpd, target): logging.warning(f"{fn} is missing, skipping super partition image") return - group_size = 2 * hal_size + rootfs_size - super_size = metadata_size + 2 * group_size + group_size = 2 * (hal_size + rootfs_size) + super_size = 2 * group_size + + # calculate additional space needed for metadata. + # There are 2 metadata slots having 65536 B each. 131072 B in total + additional_space = (metadata_slots * metadata_size) / target.super_alignment + + if additional_space > 1: + # if metadata takes more than super alignment, add 1 MiB to super + super_size += 1024*1024 + else: + # if metadata takes less than super alignment, add alignment size to super + super_size += target.super_alignment argv = ["lpmake", "-F", f"-o={super_path}", -- 2.34.1