Dynamic partitions: change size of a slot 62/311562/3
authorJacek Kryszyn <j.kryszyn@samsung.com>
Wed, 22 May 2024 08:02:42 +0000 (10:02 +0200)
committerJacek Kryszyn <j.kryszyn@samsung.com>
Wed, 22 May 2024 13:01:37 +0000 (15:01 +0200)
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>
scripts/tizen/sd_fusing.py

index 0d2bd22..7624f69 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}",