flasher flash_system: add possibility to select partition (#565)

Usage example:
pmbootstrap flasher flash_system --partition=userdata
This commit is contained in:
drebrez 2017-09-13 19:50:06 +02:00 committed by Oliver Smith
parent d7cc7085f2
commit a31cd0897b
3 changed files with 16 additions and 4 deletions

View File

@ -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"]],

View File

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

View File

@ -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")