pmbootstrap flasher flash_kernel --partition (!1741)
Allow changing the kernel partition for fastboot and heimdall in deviceinfo and on the fly while doing "pmbootstrap flasher flash_kernel". Also allow changing the partition for "... flash_rootfs" with fastboot (this was only possible with heimdall so far). Introduce two new deviceinfo variables: * flash_fastboot_partition_kernel * flash_fastboot_partition_system This is useful for devices with dual partitioning that have boot_a and boot_b.
This commit is contained in:
parent
712dd4e20e
commit
39b3a489ef
|
@ -249,6 +249,8 @@ deviceinfo_attributes = [
|
||||||
"flash_heimdall_partition_kernel",
|
"flash_heimdall_partition_kernel",
|
||||||
"flash_heimdall_partition_initfs",
|
"flash_heimdall_partition_initfs",
|
||||||
"flash_heimdall_partition_system",
|
"flash_heimdall_partition_system",
|
||||||
|
"flash_fastboot_partition_kernel",
|
||||||
|
"flash_fastboot_partition_system",
|
||||||
"generate_legacy_uboot_initfs",
|
"generate_legacy_uboot_initfs",
|
||||||
"kernel_cmdline",
|
"kernel_cmdline",
|
||||||
"generate_bootimg",
|
"generate_bootimg",
|
||||||
|
@ -321,10 +323,11 @@ 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 rootfs image
|
$IMAGE: Path to the rootfs image
|
||||||
|
$PARTITION_KERNEL: Partition to flash the kernel/boot.img to
|
||||||
$PARTITION_SYSTEM: Partition to flash the rootfs to
|
$PARTITION_SYSTEM: Partition to flash the rootfs to
|
||||||
|
|
||||||
Fastboot specific: $KERNEL_CMDLINE, $VENDOR_ID
|
Fastboot specific: $KERNEL_CMDLINE, $VENDOR_ID
|
||||||
Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS
|
Heimdall specific: $PARTITION_INITFS
|
||||||
"""
|
"""
|
||||||
flashers = {
|
flashers = {
|
||||||
"fastboot": {
|
"fastboot": {
|
||||||
|
@ -336,7 +339,7 @@ flashers = {
|
||||||
"flash_rootfs": [["fastboot", "-i", "$VENDOR_ID",
|
"flash_rootfs": [["fastboot", "-i", "$VENDOR_ID",
|
||||||
"flash", "$PARTITION_SYSTEM", "$IMAGE"]],
|
"flash", "$PARTITION_SYSTEM", "$IMAGE"]],
|
||||||
"flash_kernel": [["fastboot", "-i", "$VENDOR_ID",
|
"flash_kernel": [["fastboot", "-i", "$VENDOR_ID",
|
||||||
"flash", "boot", "$BOOT/boot.img-$FLAVOR"]],
|
"flash", "$PARTITION_KERNEL", "$BOOT/boot.img-$FLAVOR"]],
|
||||||
"boot": [["fastboot", "-i", "$VENDOR_ID",
|
"boot": [["fastboot", "-i", "$VENDOR_ID",
|
||||||
"-c", "$KERNEL_CMDLINE", "boot",
|
"-c", "$KERNEL_CMDLINE", "boot",
|
||||||
"$BOOT/boot.img-$FLAVOR"]],
|
"$BOOT/boot.img-$FLAVOR"]],
|
||||||
|
|
|
@ -24,10 +24,15 @@ def variables(args, flavor, method):
|
||||||
_cmdline = args.cmdline
|
_cmdline = args.cmdline
|
||||||
|
|
||||||
if method == "fastboot":
|
if method == "fastboot":
|
||||||
_partition_system = "system"
|
_partition_kernel = args.deviceinfo["flash_fastboot_partition_kernel"] or "boot"
|
||||||
|
_partition_system = args.deviceinfo["flash_fastboot_partition_system"] or "system"
|
||||||
else:
|
else:
|
||||||
|
_partition_kernel = args.deviceinfo["flash_heimdall_partition_kernel"] or "KERNEL"
|
||||||
_partition_system = args.deviceinfo["flash_heimdall_partition_system"] or "SYSTEM"
|
_partition_system = args.deviceinfo["flash_heimdall_partition_system"] or "SYSTEM"
|
||||||
|
|
||||||
if "partition" in args and args.partition:
|
if "partition" in args and args.partition:
|
||||||
|
# Only one of two operations is done at same time so it doesn't matter sharing the arg
|
||||||
|
_partition_kernel = args.partition
|
||||||
_partition_system = args.partition
|
_partition_system = args.partition
|
||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
|
@ -36,7 +41,7 @@ def variables(args, flavor, method):
|
||||||
"$IMAGE": "/home/pmos/rootfs/" + args.device + ".img",
|
"$IMAGE": "/home/pmos/rootfs/" + args.device + ".img",
|
||||||
"$VENDOR_ID": args.deviceinfo["flash_fastboot_vendor_id"],
|
"$VENDOR_ID": args.deviceinfo["flash_fastboot_vendor_id"],
|
||||||
"$KERNEL_CMDLINE": _cmdline,
|
"$KERNEL_CMDLINE": _cmdline,
|
||||||
"$PARTITION_KERNEL": args.deviceinfo["flash_heimdall_partition_kernel"] or "KERNEL",
|
"$PARTITION_KERNEL": _partition_kernel,
|
||||||
"$PARTITION_INITFS": args.deviceinfo["flash_heimdall_partition_initfs"] or "RECOVERY",
|
"$PARTITION_INITFS": args.deviceinfo["flash_heimdall_partition_initfs"] or "RECOVERY",
|
||||||
"$PARTITION_SYSTEM": _partition_system,
|
"$PARTITION_SYSTEM": _partition_system,
|
||||||
"$RECOVERY_ZIP": "/mnt/buildroot_" + args.deviceinfo["arch"] +
|
"$RECOVERY_ZIP": "/mnt/buildroot_" + args.deviceinfo["arch"] +
|
||||||
|
|
|
@ -67,6 +67,9 @@ def arguments_flasher(subparser):
|
||||||
flash_kernel = sub.add_parser("flash_kernel", help="flash a kernel")
|
flash_kernel = sub.add_parser("flash_kernel", help="flash a kernel")
|
||||||
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_kernel.add_argument("--partition", default=None,
|
||||||
|
help="partition to flash the kernel to (defaults"
|
||||||
|
" to deviceinfo_flash_*_partition_kernel)")
|
||||||
|
|
||||||
# Flash rootfs
|
# Flash rootfs
|
||||||
flash_rootfs = sub.add_parser("flash_rootfs", aliases=["flash_system"],
|
flash_rootfs = sub.add_parser("flash_rootfs", aliases=["flash_system"],
|
||||||
|
@ -74,8 +77,9 @@ def arguments_flasher(subparser):
|
||||||
" device (partition layout does not get"
|
" device (partition layout does not get"
|
||||||
" changed)")
|
" changed)")
|
||||||
flash_rootfs.add_argument("--partition", default=None,
|
flash_rootfs.add_argument("--partition", default=None,
|
||||||
help="partition to flash to (Android: default"
|
help="partition to flash the rootfs to (defaults"
|
||||||
" is 'system', but 'userdata' may have more"
|
" to deviceinfo_flash_*_partition_system,"
|
||||||
|
" 'userdata' on Android may have more"
|
||||||
" space)")
|
" space)")
|
||||||
|
|
||||||
# Actions without extra arguments
|
# Actions without extra arguments
|
||||||
|
|
Loading…
Reference in New Issue