flasher flash_system: add possibility to select partition (#565)
Usage example: pmbootstrap flasher flash_system --partition=userdata
This commit is contained in:
parent
d7cc7085f2
commit
a31cd0897b
|
@ -242,9 +242,10 @@ Flasher abstraction. Allowed variables:
|
||||||
$BOOT: Path to the /boot partition
|
$BOOT: Path to the /boot partition
|
||||||
$FLAVOR: Kernel flavor
|
$FLAVOR: Kernel flavor
|
||||||
$IMAGE: Path to the system partition image
|
$IMAGE: Path to the system partition image
|
||||||
|
$PARTITION_SYSTEM: Partition to flash the system image
|
||||||
|
|
||||||
Fastboot specific: $KERNEL_CMDLINE
|
Fastboot specific: $KERNEL_CMDLINE
|
||||||
Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS, $PARTITION_SYSTEM
|
Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS
|
||||||
"""
|
"""
|
||||||
flashers = {
|
flashers = {
|
||||||
"fastboot": {
|
"fastboot": {
|
||||||
|
@ -252,7 +253,7 @@ flashers = {
|
||||||
"actions":
|
"actions":
|
||||||
{
|
{
|
||||||
"list_devices": [["fastboot", "devices", "-l"]],
|
"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"]],
|
"flash_kernel": [["fastboot", "flash", "boot", "$BOOT/boot.img-$FLAVOR"]],
|
||||||
"boot": [["fastboot", "-c", "$KERNEL_CMDLINE", "boot", "$BOOT/boot.img-$FLAVOR"]],
|
"boot": [["fastboot", "-c", "$KERNEL_CMDLINE", "boot", "$BOOT/boot.img-$FLAVOR"]],
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,13 @@ def run(args, action, flavor=None):
|
||||||
if "cmdline" in args and args.cmdline:
|
if "cmdline" in args and args.cmdline:
|
||||||
_cmdline = 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
|
# Variable setup
|
||||||
vars = {
|
vars = {
|
||||||
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
|
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
|
||||||
|
@ -42,7 +49,7 @@ def run(args, action, flavor=None):
|
||||||
"$KERNEL_CMDLINE": _cmdline,
|
"$KERNEL_CMDLINE": _cmdline,
|
||||||
"$PARTITION_KERNEL": args.deviceinfo["flash_heimdall_partition_kernel"] or "KERNEL",
|
"$PARTITION_KERNEL": args.deviceinfo["flash_heimdall_partition_kernel"] or "KERNEL",
|
||||||
"$PARTITION_INITFS": args.deviceinfo["flash_heimdall_partition_initfs"] or "RECOVERY",
|
"$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"] +
|
"$RECOVERY_ZIP": "/mnt/buildroot_" + args.deviceinfo["arch"] +
|
||||||
"/var/lib/postmarketos-android-recovery-installer"
|
"/var/lib/postmarketos-android-recovery-installer"
|
||||||
"/pmos-" + args.device + ".zip",
|
"/pmos-" + args.device + ".zip",
|
||||||
|
|
|
@ -50,8 +50,12 @@ def arguments_flasher(subparser):
|
||||||
for action in [boot, flash_kernel]:
|
for action in [boot, flash_kernel]:
|
||||||
action.add_argument("--flavor", default=None)
|
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
|
# 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("sideload", help="sideload recovery zip")
|
||||||
sub.add_parser("list_flavors", help="list installed kernel flavors" +
|
sub.add_parser("list_flavors", help="list installed kernel flavors" +
|
||||||
" inside the device rootfs chroot on this computer")
|
" inside the device rootfs chroot on this computer")
|
||||||
|
|
Loading…
Reference in New Issue