~postmarketos/pmbootstrap-devel

pmbootstrap: flasher: heimdall-bootimg: add support for '--no-reboot' and '--resume' v2 APPLIED

~andrisas: 1
 flasher: heimdall-bootimg: add support for '--no-reboot' and '--resume'

 4 files changed, 41 insertions(+), 5 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/48578/mbox | git am -3
Learn more about email & git

[PATCH pmbootstrap v2] flasher: heimdall-bootimg: add support for '--no-reboot' and '--resume' Export this patch

From: Andras Sebok <sebokandris2009@gmail.com>
---
 pmb/config/__init__.py   | 11 +++++++----
 pmb/flasher/run.py       | 10 ++++++++++
 pmb/flasher/variables.py | 12 +++++++++++-
 pmb/parse/arguments.py   | 13 +++++++++++++
 4 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py
index fd75a00f..29557c98 100644
--- a/pmb/config/__init__.py
+++ b/pmb/config/__init__.py
@@ -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": {
diff --git a/pmb/flasher/run.py b/pmb/flasher/run.py
index 7daa7376..ad106f8a 100644
--- a/pmb/flasher/run.py
+++ b/pmb/flasher/run.py
@@ -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")
diff --git a/pmb/flasher/variables.py b/pmb/flasher/variables.py
index 6fd5469a..393a1846 100644
--- a/pmb/flasher/variables.py
+++ b/pmb/flasher/variables.py
@@ -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)
diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py
index 47bd8c69..a8505258 100644
--- a/pmb/parse/arguments.py
+++ b/pmb/parse/arguments.py
@@ -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


-- 
2.38.5
Applied, thanks!

[1/1] flasher: heimdall-bootimg: add support for '--no-reboot' and '--resume'
      commit: e0e3e213ba24720afa431b13f0f878c6fd9dd108

Best regards