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}",