pmb.config, pmb.install: add option to handle Samsung sparse image format (MR 2177)

This commit is contained in:
Enrico Lumetti 2022-04-10 01:45:33 +02:00 committed by Oliver Smith
parent ff569ece14
commit dee8e34298
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 14 additions and 0 deletions

View File

@ -731,6 +731,7 @@ deviceinfo_attributes = [
"flash_pagesize",
"flash_fastboot_max_size",
"flash_sparse",
"flash_sparse_samsung_format",
"rootfs_image_sector_size",
"sd_embed_firmware",
"sd_embed_firmware_step_size",

View File

@ -714,6 +714,19 @@ def install_system_image(args, size_reserve, suffix, step, steps,
pmb.chroot.user(args, ["mv", "-f", sys_image_sparse, sys_image],
working_dir="/home/pmos/rootfs/")
# patch sparse image for Samsung devices if specified
samsungify_strategy = args.deviceinfo["flash_sparse_samsung_format"]
if samsungify_strategy is not None:
logging.info("(native) convert sparse image into Samsung's sparse image format")
pmb.chroot.apk.install(args, ["sm-sparse-image-tool"])
sys_image = f"{args.device}.img"
sys_image_patched = f"{args.device}-patched.img"
pmb.chroot.user(args, ["sm_sparse_image_tool", "samsungify", "--strategy",
samsungify_strategy, sys_image, sys_image_patched],
working_dir="/home/pmos/rootfs/")
pmb.chroot.user(args, ["mv", "-f", sys_image_patched, sys_image],
working_dir="/home/pmos/rootfs/")
def print_flash_info(args):
""" Print flashing information, based on the deviceinfo data and the