tizen: sd_fusing.py: rpi4s: getting rid of unnecessary alignments 94/309094/5
authorJacek Kryszyn <j.kryszyn@samsung.com>
Thu, 4 Apr 2024 13:17:27 +0000 (15:17 +0200)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 10 Apr 2024 10:01:15 +0000 (12:01 +0200)
In case of rpi4s target (Tizen with dynamic partitions
on rpi4) do not perform unnecessary calculations of aligned
size of partitions.

Change-Id: Ieea75f133d35d29f72a5b2336181b200809e5f14
Signed-off-by: Jacek Kryszyn <j.kryszyn@samsung.com>
scripts/tizen/sd_fusing.py

index bc3de3c..a158f75 100755 (executable)
@@ -254,7 +254,7 @@ class Rpi4Super(InitParams, SdFusingTargetAB):
         {"size": 64,   "fstype": "vfat", "name": "boot_a","start": 4,
          "ptype": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
          "binaries": "boot.img"},
-        {"size": 6656, "fstype": "ext4", "name": "super",
+        {"size": 6657, "fstype": "ext4", "name": "super",
          "binaries": "super.img"},
         {"size": 1344, "fstype": "ext4", "name": "system-data",
          "binaries": "system-data.img"},
@@ -880,13 +880,9 @@ def do_fuse_file(f, name, target):
 #TODO: functions with the target argument should probably
 #      be part of some class
 
-def get_aligned_size(size, target):
-    return target.super_alignment*int(1+(size-1)/target.super_alignment)
-
 def do_fuse_image_super(tmpd, target):
     metadata_slots = 2
     metadata_size = 65536
-    metadata_aligned_size = get_aligned_size(metadata_size, target)
 
     hal_path = os.path.join(tmpd, 'hal.img')
     rootfs_path = os.path.join(tmpd, 'rootfs.img')
@@ -900,10 +896,8 @@ def do_fuse_image_super(tmpd, target):
         logging.warning(f"{fn} is missing, skipping super partition image")
         return
 
-    hal_aligned_size = get_aligned_size(hal_size, target)
-    rootfs_aligned_size = get_aligned_size(rootfs_size, target)
-    group_size = hal_aligned_size + rootfs_aligned_size
-    super_size = metadata_aligned_size + 2 * group_size
+    group_size = 2 * hal_size + rootfs_size
+    super_size = metadata_size + 2 * group_size
 
     argv = ["lpmake", "-F",
             f"-o={super_path}",
@@ -911,11 +905,11 @@ def do_fuse_image_super(tmpd, target):
             f"--metadata-size={metadata_size}",
             f"--metadata-slots={metadata_slots}",
             "-g", f"tizen_a:{group_size}",
-            "-p", f"rootfs_a:none:{rootfs_aligned_size}:tizen_a",
-            "-p", f"hal_a:none:{hal_aligned_size}:tizen_a",
+            "-p", f"rootfs_a:none:{rootfs_size}:tizen_a",
+            "-p", f"hal_a:none:{hal_size}:tizen_a",
             "-g", f"tizen_b:{group_size}",
-            "-p", f"rootfs_b:none:{rootfs_aligned_size}:tizen_b",
-            "-p", f"hal_b:none:{hal_aligned_size}:tizen_b",
+            "-p", f"rootfs_b:none:{rootfs_size}:tizen_b",
+            "-p", f"hal_b:none:{hal_size}:tizen_b",
             "-i", f"rootfs_a={rootfs_path}",
             "-i", f"rootfs_b={rootfs_path}",
             "-i", f"hal_a={hal_path}",