From b8d5b9e4e5619f7131dc567def07a5917cfae6ca Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Tue, 6 Jun 2023 00:03:28 +0200 Subject: [PATCH] treewide: rename _system to _rootfs in various places A long time ago we renamed the flash_system action into flash_rootfs. Since we still kept some variables around, it's finally time to clean that up. Keep backwards compatibility for now since we cannot update pmaports at the same time since the new deviceinfo names won't be supported in older pmbootstrap versions. Reviewed-by: Oliver Smith Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230605220329.14328-3-luca@z3ntu.xyz%3E --- pmb/aportgen/device.py | 4 ++-- pmb/config/__init__.py | 21 ++++++++++++--------- pmb/flasher/variables.py | 20 ++++++++++++-------- pmb/install/recovery.py | 3 ++- pmb/parse/arguments.py | 2 +- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/pmb/aportgen/device.py b/pmb/aportgen/device.py index aaff6656..5a4114af 100644 --- a/pmb/aportgen/device.py +++ b/pmb/aportgen/device.py @@ -195,13 +195,13 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, year, arch, content_heimdall_bootimg = """\ deviceinfo_flash_heimdall_partition_kernel="" - deviceinfo_flash_heimdall_partition_system="" + deviceinfo_flash_heimdall_partition_rootfs="" """ content_heimdall_isorec = """\ deviceinfo_flash_heimdall_partition_kernel="" deviceinfo_flash_heimdall_partition_initfs="" - deviceinfo_flash_heimdall_partition_system="" + deviceinfo_flash_heimdall_partition_rootfs="" """ content_0xffff = """\ diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index b18cfdf4..6646be9b 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -790,15 +790,18 @@ deviceinfo_attributes = [ # flash "flash_heimdall_partition_kernel", "flash_heimdall_partition_initfs", - "flash_heimdall_partition_system", + "flash_heimdall_partition_rootfs", + "flash_heimdall_partition_system", # deprecated "flash_heimdall_partition_vbmeta", "flash_heimdall_partition_dtbo", "flash_fastboot_partition_kernel", - "flash_fastboot_partition_system", + "flash_fastboot_partition_rootfs", + "flash_fastboot_partition_system", # deprecated "flash_fastboot_partition_vbmeta", "flash_fastboot_partition_dtbo", "flash_rk_partition_kernel", - "flash_rk_partition_system", + "flash_rk_partition_rootfs", + "flash_rk_partition_system", # deprecated "generate_legacy_uboot_initfs", "kernel_cmdline", "generate_bootimg", @@ -902,7 +905,7 @@ $IMAGE: Path to the combined boot/rootfs image $IMAGE_SPLIT_BOOT: Path to the (split) boot image $IMAGE_SPLIT_ROOT: Path to the (split) rootfs image $PARTITION_KERNEL: Partition to flash the kernel/boot.img to -$PARTITION_SYSTEM: Partition to flash the rootfs to +$PARTITION_ROOTFS: Partition to flash the rootfs to Fastboot specific: $KERNEL_CMDLINE Heimdall specific: $PARTITION_INITFS @@ -913,7 +916,7 @@ flashers = { "depends": [], # pmaports.cfg: supported_fastboot_depends "actions": { "list_devices": [["fastboot", "devices", "-l"]], - "flash_rootfs": [["fastboot", "flash", "$PARTITION_SYSTEM", + "flash_rootfs": [["fastboot", "flash", "$PARTITION_ROOTFS", "$IMAGE"]], "flash_kernel": [["fastboot", "flash", "$PARTITION_KERNEL", "$BOOT/boot.img$FLAVOR"]], @@ -944,7 +947,7 @@ flashers = { "depends": ["android-tools"], "actions": { "list_devices": [["fastboot", "devices", "-l"]], - "flash_rootfs": [["fastboot", "flash", "$PARTITION_SYSTEM", + "flash_rootfs": [["fastboot", "flash", "$PARTITION_ROOTFS", "$IMAGE_SPLIT_ROOT"]], "flash_kernel": [["fastboot", "flash", "$PARTITION_KERNEL", "$IMAGE_SPLIT_BOOT"]], @@ -962,7 +965,7 @@ flashers = { "list_devices": [["heimdall", "detect"]], "flash_rootfs": [ ["heimdall_wait_for_device.sh"], - ["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]], + ["heimdall", "flash", "--$PARTITION_ROOTFS", "$IMAGE"]], "flash_kernel": [["heimdall_flash_kernel.sh", "$BOOT/initramfs$FLAVOR", "$PARTITION_INITFS", "$BOOT/vmlinuz$FLAVOR$DTB", @@ -977,7 +980,7 @@ flashers = { "list_devices": [["heimdall", "detect"]], "flash_rootfs": [ ["heimdall_wait_for_device.sh"], - ["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]], + ["heimdall", "flash", "--$PARTITION_ROOTFS", "$IMAGE"]], "flash_kernel": [ ["heimdall_wait_for_device.sh"], ["heimdall", "flash", "--$PARTITION_KERNEL", @@ -1020,7 +1023,7 @@ flashers = { "actions": { "list_devices": [["rkdeveloptool", "list"]], "flash_rootfs": [ - ["rkdeveloptool", "write-partition", "$PARTITION_SYSTEM", + ["rkdeveloptool", "write-partition", "$PARTITION_ROOTFS", "$IMAGE_SPLIT_ROOT"] ], "flash_kernel": [ diff --git a/pmb/flasher/variables.py b/pmb/flasher/variables.py index df2420fb..e00ed1d7 100644 --- a/pmb/flasher/variables.py +++ b/pmb/flasher/variables.py @@ -10,11 +10,15 @@ def variables(args, flavor, method): flash_pagesize = args.deviceinfo['flash_pagesize'] + # TODO Remove _partition_system deviceinfo support once pmaports has been + # updated and minimum pmbootstrap version bumped. + # See also https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2243 + if method.startswith("fastboot"): _partition_kernel = args.deviceinfo["flash_fastboot_partition_kernel"]\ or "boot" - _partition_system = args.deviceinfo["flash_fastboot_partition_system"]\ - or "userdata" + _partition_rootfs = args.deviceinfo["flash_fastboot_partition_rootfs"]\ + or args.deviceinfo["flash_fastboot_partition_system"] or "userdata" _partition_vbmeta = args.deviceinfo["flash_fastboot_partition_vbmeta"]\ or None _partition_dtbo = args.deviceinfo["flash_fastboot_partition_dtbo"]\ @@ -23,15 +27,15 @@ def variables(args, flavor, method): elif method.startswith("rkdeveloptool"): _partition_kernel = args.deviceinfo["flash_rk_partition_kernel"]\ or None - _partition_system = args.deviceinfo["flash_rk_partition_system"]\ - or None + _partition_rootfs = args.deviceinfo["flash_rk_partition_rootfs"]\ + or args.deviceinfo["flash_rk_partition_system"] or None _partition_vbmeta = None _partition_dtbo = None else: _partition_kernel = args.deviceinfo["flash_heimdall_partition_kernel"]\ or "KERNEL" - _partition_system = args.deviceinfo["flash_heimdall_partition_system"]\ - or "SYSTEM" + _partition_rootfs = args.deviceinfo["flash_heimdall_partition_rootfs"]\ + or args.deviceinfo["flash_heimdall_partition_system"] or "SYSTEM" _partition_vbmeta = args.deviceinfo["flash_heimdall_partition_vbmeta"]\ or None _partition_dtbo = args.deviceinfo["flash_heimdall_partition_dtbo"]\ @@ -41,7 +45,7 @@ def variables(args, flavor, method): # Only one operation is done at same time so it doesn't matter # sharing the arg _partition_kernel = args.partition - _partition_system = args.partition + _partition_rootfs = args.partition _partition_vbmeta = args.partition _partition_dtbo = args.partition @@ -59,7 +63,7 @@ def variables(args, flavor, method): "$PARTITION_KERNEL": _partition_kernel, "$PARTITION_INITFS": args.deviceinfo[ "flash_heimdall_partition_initfs"] or "RECOVERY", - "$PARTITION_SYSTEM": _partition_system, + "$PARTITION_ROOTFS": _partition_rootfs, "$PARTITION_VBMETA": _partition_vbmeta, "$PARTITION_DTBO": _partition_dtbo, "$FLASH_PAGESIZE": flash_pagesize, diff --git a/pmb/install/recovery.py b/pmb/install/recovery.py index c39e0cef..a95e714d 100644 --- a/pmb/install/recovery.py +++ b/pmb/install/recovery.py @@ -35,7 +35,8 @@ def create_zip(args, suffix): "ISOREC": method == "heimdall-isorec", "KERNEL_PARTLABEL": vars["$PARTITION_KERNEL"], "INITFS_PARTLABEL": vars["$PARTITION_INITFS"], - "SYSTEM_PARTLABEL": vars["$PARTITION_SYSTEM"], + # Name is still "SYSTEM", not "ROOTFS" in the recovery installer + "SYSTEM_PARTLABEL": vars["$PARTITION_ROOTFS"], "INSTALL_PARTITION": args.recovery_install_partition, "CIPHER": args.cipher, "FDE": args.full_disk_encryption, diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 3af9dc4b..b5c15bad 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -256,7 +256,7 @@ def arguments_flasher(subparser): " changed)") flash_rootfs.add_argument("--partition", default=None, help="partition to flash the rootfs to (defaults" - " to deviceinfo_flash_*_partition_system," + " to deviceinfo_flash_*_partition_rootfs," " 'userdata' on Android may have more" " space)")