self.update = args.update
super().__init__(device, "gpt")
self.with_super = True
- self.super_alignment = 1048576
class Rpi4(InitParams, SdFusingTargetAB):
long_name = "Raspberry Pi 4"
self.update = args.update
super().__init__(device, 'gpt')
self.with_super = True
- self.super_alignment = 1048576
class LicheePi4A(InitParams, SdFusingTargetAB):
long_name = "LicheePi4A"
self.update = args.update
super().__init__(device, 'gpt')
self.with_super = True
- self.super_alignment = 1048576
class X86emu(SdFusingTarget):
def do_fuse_image_super(tmpd, target):
metadata_slots = 2
metadata_size = 65536
+ header_size = 1024 * 1024 # default alignment used in lpmake
+ super_size = 0
+ for p in target.label.part_table:
+ if p.name == "super":
+ super_size = p.size * 1024 * 1024 # size of parts is in MiB. Change to B
+ break
+
+ if super_size == 0:
+ logging.error(f"No information found about super partition, cannot create image")
+ sys.exit(1)
+
+ group_size = int((super_size - header_size) / 2);
hal_path = os.path.join(tmpd, 'hal.img')
rootfs_path = os.path.join(tmpd, 'rootfs.img')
super_path = os.path.join(tmpd, 'super.img')
rootfs_size = os.stat(rootfs_path).st_size
except FileNotFoundError as e:
fn = os.path.split(e.filename)[-1]
- logging.warning(f"{fn} is missing, skipping super partition image")
- return
-
- 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
+ logging.error(f"{fn} is missing, cannot create super partition image")
+ sys.exit(1)
- 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
+ if group_size < hal_size + rootfs_size:
+ logging.error(f"rootfs and hal are too big to fit in a slot on a super partition")
+ sys.exit(1)
argv = ["lpmake", "-F",
f"-o={super_path}",
if proc.returncode != 0:
logging.error("Failed to create super.img")
+ sys.exit(1)
do_fuse_image(super_path, target)
def do_fuse_image_tarball(tarball, tmpd, target):