Dynamic partitions: change size of a slot
authorJacek Kryszyn <j.kryszyn@samsung.com>
Wed, 22 May 2024 08:02:42 +0000 (10:02 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 4 Dec 2024 11:00:01 +0000 (12:00 +0100)
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 <j.kryszyn@samsung.com>
sd_fusing.py

index 0d2bd228ba6e54a3db0f8f9c8b6e5e6ce375c45d..7624f69097b306c71fa7a3e239f90814b28cdfa8 100755 (executable)
@@ -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}",