M pmb/config/__init__.py => pmb/config/__init__.py +7 -4
@@ 998,20 998,23 @@ flashers = {
"list_devices": [["heimdall", "detect"]],
"flash_rootfs": [
["heimdall_wait_for_device.sh"],
- ["heimdall", "flash", "--$PARTITION_ROOTFS", "$IMAGE"]],
+ ["heimdall", "flash", "--$PARTITION_ROOTFS", "$IMAGE",
+ "$NO_REBOOT", "$RESUME"]],
"flash_kernel": [
["heimdall_wait_for_device.sh"],
["heimdall", "flash", "--$PARTITION_KERNEL",
- "$BOOT/boot.img$FLAVOR"]],
+ "$BOOT/boot.img$FLAVOR", "$NO_REBOOT", "$RESUME"]],
"flash_vbmeta": [
["avbtool", "make_vbmeta_image", "--flags", "2",
"--padding_size", "$FLASH_PAGESIZE",
"--output", "/vbmeta.img"],
- ["heimdall", "flash", "--$PARTITION_VBMETA", "/vbmeta.img"],
+ ["heimdall", "flash", "--$PARTITION_VBMETA", "/vbmeta.img",
+ "$NO_REBOOT", "$RESUME"],
["rm", "-f", "/vbmeta.img"]],
"flash_lk2nd": [
["heimdall_wait_for_device.sh"],
- ["heimdall", "flash", "--$PARTITION_KERNEL", "$BOOT/lk2nd.img"]]
+ ["heimdall", "flash", "--$PARTITION_KERNEL", "$BOOT/lk2nd.img",
+ "$NO_REBOOT", "$RESUME"]]
},
},
"adb": {
M pmb/flasher/run.py => pmb/flasher/run.py +10 -0
@@ 50,6 50,14 @@ def run(args, action, flavor=None):
" in deviceinfo file. See also:"
" <https://wiki.postmarketos.org/wiki/"
"Deviceinfo_reference>")
+
+ if args.no_reboot and ("flash" not in action or method != "heimdall-bootimg"):
+ raise RuntimeError("The '--no-reboot' option is only"
+ " supported when flashing with heimall-bootimg.")
+
+ if args.resume and ("flash" not in action or method != "heimdall-bootimg"):
+ raise RuntimeError("The '--resume' option is only"
+ " supported when flashing with heimall-bootimg.")
# Run the commands of each action
for command in cfg["actions"][action]:
@@ 66,5 74,7 @@ def run(args, action, flavor=None):
check_partition_blacklist(args, key, value)
command[i] = command[i].replace(key, value)
+ # Remove empty strings
+ command = [x for x in command if x != '']
# Run the action
pmb.chroot.root(args, command, output="interactive")
M pmb/flasher/variables.py => pmb/flasher/variables.py +11 -1
@@ 61,6 61,14 @@ def variables(args, flavor, method):
_dtb = ""
if args.deviceinfo["append_dtb"] == "true":
_dtb = "-dtb"
+
+ _no_reboot = ""
+ if args.no_reboot:
+ _no_reboot = "--no-reboot"
+
+ _resume = ""
+ if args.resume:
+ _resume = "--resume"
vars = {
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
@@ 80,7 88,9 @@ def variables(args, flavor, method):
"/var/lib/postmarketos-android-recovery-installer"
"/pmos-" + args.device + ".zip",
"$UUU_SCRIPT": "/mnt/rootfs_" + args.deviceinfo["codename"] +
- "/usr/share/uuu/flash_script.lst"
+ "/usr/share/uuu/flash_script.lst",
+ "$NO_REBOOT": _no_reboot,
+ "$RESUME": _resume
}
# Backwards compatibility with old mkinitfs (pma#660)
M pmb/parse/arguments.py => pmb/parse/arguments.py +13 -0
@@ 289,6 289,19 @@ def arguments_flasher(subparser):
" inside the device rootfs chroot on this computer")
sub.add_parser("list_devices", help="show connected devices")
+ group = ret.add_argument_group("heimdall options", \
+ "With heimdall as"
+ " flash method, the device automatically"
+ " reboots after each flash command. Use"
+ " --no-reboot and --resume for multiple"
+ " flash actions without reboot.")
+ group.add_argument("--no-reboot", dest="no_reboot",
+ help="don't automatically reboot after flashing",
+ action="store_true")
+ group.add_argument("--resume", dest="resume",
+ help="resume flashing after using --no-reboot",
+ action="store_true")
+
return ret