diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 937ae47b..e0b1fc1b 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -242,9 +242,10 @@ Flasher abstraction. Allowed variables: $BOOT: Path to the /boot partition $FLAVOR: Kernel flavor $IMAGE: Path to the system partition image +$PARTITION_SYSTEM: Partition to flash the system image Fastboot specific: $KERNEL_CMDLINE -Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS, $PARTITION_SYSTEM +Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS """ flashers = { "fastboot": { @@ -252,7 +253,7 @@ flashers = { "actions": { "list_devices": [["fastboot", "devices", "-l"]], - "flash_system": [["fastboot", "flash", "system", "$IMAGE"]], + "flash_system": [["fastboot", "flash", "$PARTITION_SYSTEM", "$IMAGE"]], "flash_kernel": [["fastboot", "flash", "boot", "$BOOT/boot.img-$FLAVOR"]], "boot": [["fastboot", "-c", "$KERNEL_CMDLINE", "boot", "$BOOT/boot.img-$FLAVOR"]], diff --git a/pmb/flasher/run.py b/pmb/flasher/run.py index 34934c59..feaf228e 100644 --- a/pmb/flasher/run.py +++ b/pmb/flasher/run.py @@ -34,6 +34,13 @@ def run(args, action, flavor=None): if "cmdline" in args and args.cmdline: _cmdline = args.cmdline + if method == "fastboot": + _partition_system = "system" + else: + _partition_system = args.deviceinfo["flash_heimdall_partition_system"] or "SYSTEM" + if "partition" in args and args.partition: + _partition_system = args.partition + # Variable setup vars = { "$BOOT": "/mnt/rootfs_" + args.device + "/boot", @@ -42,7 +49,7 @@ def run(args, action, flavor=None): "$KERNEL_CMDLINE": _cmdline, "$PARTITION_KERNEL": args.deviceinfo["flash_heimdall_partition_kernel"] or "KERNEL", "$PARTITION_INITFS": args.deviceinfo["flash_heimdall_partition_initfs"] or "RECOVERY", - "$PARTITION_SYSTEM": args.deviceinfo["flash_heimdall_partition_system"] or "SYSTEM", + "$PARTITION_SYSTEM": _partition_system, "$RECOVERY_ZIP": "/mnt/buildroot_" + args.deviceinfo["arch"] + "/var/lib/postmarketos-android-recovery-installer" "/pmos-" + args.device + ".zip", diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index eb4914f0..c2cdc303 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -50,8 +50,12 @@ def arguments_flasher(subparser): for action in [boot, flash_kernel]: action.add_argument("--flavor", default=None) + # Flash system + flash_system = sub.add_parser("flash_system", help="flash the system partition") + flash_system.add_argument("--partition", default=None, help="partition to flash" + " the system image") + # Actions without extra arguments - sub.add_parser("flash_system", help="flash the system partition") sub.add_parser("sideload", help="sideload recovery zip") sub.add_parser("list_flavors", help="list installed kernel flavors" + " inside the device rootfs chroot on this computer")