pmbootstrap flasher: add flash_dtbo (MR 2099)
This commit is contained in:
parent
468d313790
commit
2d3cfbcbb4
|
@ -583,6 +583,7 @@ deviceinfo_attributes = [
|
|||
"flash_fastboot_partition_kernel",
|
||||
"flash_fastboot_partition_system",
|
||||
"flash_fastboot_partition_vbmeta",
|
||||
"flash_fastboot_partition_dtbo",
|
||||
"generate_legacy_uboot_initfs",
|
||||
"kernel_cmdline",
|
||||
"generate_bootimg",
|
||||
|
@ -694,6 +695,8 @@ flashers = {
|
|||
["fastboot", "flash", "$PARTITION_VBMETA", "/vbmeta.img"],
|
||||
["rm", "-f", "/vbmeta.img"]
|
||||
],
|
||||
"flash_dtbo": [["fastboot", "flash", "$PARTITION_DTBO",
|
||||
"$BOOT/dtbo.img"]],
|
||||
"boot": [["fastboot", "--cmdline", "$KERNEL_CMDLINE",
|
||||
"boot", "$BOOT/boot.img-$FLAVOR"]],
|
||||
},
|
||||
|
|
|
@ -20,6 +20,7 @@ def symlinks(args, flavor, folder):
|
|||
info = {
|
||||
"boot.img-" + flavor: "Fastboot compatible boot.img file,"
|
||||
" contains initramfs and kernel",
|
||||
"dtbo.img": "Fastboot compatible dtbo image",
|
||||
"initramfs-" + flavor: "Initramfs",
|
||||
"initramfs-" + flavor + "-extra": "Extra initramfs files in /boot",
|
||||
"uInitrd-" + flavor: "Initramfs, legacy u-boot image format",
|
||||
|
@ -37,6 +38,7 @@ def symlinks(args, flavor, folder):
|
|||
path_buildroot = args.work + "/chroot_buildroot_" + args.deviceinfo["arch"]
|
||||
patterns = [path_boot + "/*-" + flavor,
|
||||
path_boot + "/*-" + flavor + "-extra",
|
||||
path_boot + "/dtbo.img",
|
||||
path_native + "/home/pmos/rootfs/" + args.device + ".img",
|
||||
path_native + "/home/pmos/rootfs/" + args.device + "-boot.img",
|
||||
path_native + "/home/pmos/rootfs/" + args.device + "-root.img",
|
||||
|
|
|
@ -79,6 +79,11 @@ def flash_vbmeta(args):
|
|||
pmb.flasher.run(args, "flash_vbmeta")
|
||||
|
||||
|
||||
def flash_dtbo(args):
|
||||
logging.info("(native) flash dtbo image")
|
||||
pmb.flasher.run(args, "flash_dtbo")
|
||||
|
||||
|
||||
def list_devices(args):
|
||||
pmb.flasher.run(args, "list_devices")
|
||||
|
||||
|
@ -126,6 +131,8 @@ def frontend(args):
|
|||
rootfs(args)
|
||||
if action == "flash_vbmeta":
|
||||
flash_vbmeta(args)
|
||||
if action == "flash_dtbo":
|
||||
flash_dtbo(args)
|
||||
if action == "list_flavors":
|
||||
list_flavors(args)
|
||||
if action == "list_devices":
|
||||
|
|
|
@ -42,6 +42,15 @@ def run(args, action, flavor=None):
|
|||
" <https://wiki.postmarketos.org/wiki/"
|
||||
"Deviceinfo_reference>")
|
||||
|
||||
# dtbo flasher requires dtbo partition to be explicitly specified
|
||||
if action == "flash_dtbo" and not vars["$PARTITION_DTBO"]:
|
||||
raise RuntimeError("Your device does not have 'dtbo' partition"
|
||||
" specified; set"
|
||||
" 'deviceinfo_flash_fastboot_partition_dtbo'"
|
||||
" in deviceinfo file. See also:"
|
||||
" <https://wiki.postmarketos.org/wiki/"
|
||||
"Deviceinfo_reference>")
|
||||
|
||||
# Run the commands of each action
|
||||
for command in cfg["actions"][action]:
|
||||
# Variable replacement
|
||||
|
|
|
@ -16,6 +16,8 @@ def variables(args, flavor, method):
|
|||
or "system"
|
||||
_partition_vbmeta = args.deviceinfo["flash_fastboot_partition_vbmeta"]\
|
||||
or None
|
||||
_partition_dtbo = args.deviceinfo["flash_fastboot_partition_dtbo"]\
|
||||
or None
|
||||
else:
|
||||
_partition_kernel = args.deviceinfo["flash_heimdall_partition_kernel"]\
|
||||
or "KERNEL"
|
||||
|
@ -23,13 +25,16 @@ def variables(args, flavor, method):
|
|||
or "SYSTEM"
|
||||
_partition_vbmeta = args.deviceinfo["flash_heimdall_partition_vbmeta"]\
|
||||
or None
|
||||
_partition_dtbo = args.deviceinfo["flash_heimdall_partition_dtbo"]\
|
||||
or None
|
||||
|
||||
if "partition" in args and args.partition:
|
||||
# Only one of operations is done at same time so it doesn't matter
|
||||
# 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_vbmeta = args.partition
|
||||
_partition_dtbo = args.partition
|
||||
|
||||
_dtb = ""
|
||||
if args.deviceinfo["append_dtb"] == "true":
|
||||
|
@ -48,6 +53,7 @@ def variables(args, flavor, method):
|
|||
"flash_heimdall_partition_initfs"] or "RECOVERY",
|
||||
"$PARTITION_SYSTEM": _partition_system,
|
||||
"$PARTITION_VBMETA": _partition_vbmeta,
|
||||
"$PARTITION_DTBO": _partition_dtbo,
|
||||
"$FLASH_PAGESIZE": flash_pagesize,
|
||||
"$RECOVERY_ZIP": "/mnt/buildroot_" + args.deviceinfo["arch"] +
|
||||
"/var/lib/postmarketos-android-recovery-installer"
|
||||
|
|
|
@ -673,6 +673,14 @@ def print_flash_info(args):
|
|||
logging.info("* pmbootstrap flasher flash_vbmeta")
|
||||
logging.info(" Flashes vbmeta image with verification disabled flag.")
|
||||
|
||||
# if current flasher supports dtbo and partition is explicitly specified
|
||||
# in deviceinfo
|
||||
if "flash_dtbo" in flasher_actions and \
|
||||
(args.deviceinfo["flash_fastboot_partition_dtbo"] or
|
||||
args.deviceinfo["flash_heimdall_partition_dtbo"]):
|
||||
logging.info("* pmbootstrap flasher flash_dtbo")
|
||||
logging.info(" Flashes dtbo image.")
|
||||
|
||||
# Most flash methods operate independently of the boot partition.
|
||||
# (e.g. an Android boot image is generated). In that case, "flash_kernel"
|
||||
# works even when partitions are split or installing for sdcard.
|
||||
|
|
|
@ -242,6 +242,13 @@ def arguments_flasher(subparser):
|
|||
help="partition to flash the vbmeta to (defaults"
|
||||
" to deviceinfo_flash_*_partition_vbmeta")
|
||||
|
||||
# Flash dtbo
|
||||
flash_dtbo = sub.add_parser("flash_dtbo",
|
||||
help="flash dtbo image")
|
||||
flash_dtbo.add_argument("--partition", default=None,
|
||||
help="partition to flash the dtbo to (defaults"
|
||||
" to deviceinfo_flash_*_partition_dtbo)")
|
||||
|
||||
# Actions without extra arguments
|
||||
sub.add_parser("sideload", help="sideload recovery zip")
|
||||
sub.add_parser("list_flavors", help="list installed kernel flavors" +
|
||||
|
|
Loading…
Reference in New Issue