From 6d035108e8802468361a0ff56fe598fb13d5eb1d Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sun, 30 Apr 2023 16:15:35 +0100 Subject: [PATCH] flasher: add flash_all option Add an option to flash all partitions which are used on the device. This slightly simplifies the process of installing as it can now be done in a single command instead of needing one for each partition. --- pmb/flasher/frontend.py | 7 +++++++ pmb/parse/arguments.py | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pmb/flasher/frontend.py b/pmb/flasher/frontend.py index 4cac01fb..d98e633c 100644 --- a/pmb/flasher/frontend.py +++ b/pmb/flasher/frontend.py @@ -122,6 +122,11 @@ def flash_lk2nd(args): pmb.flasher.run(args, "flash_lk2nd") +def flash_all(args): + for action in ["flash_rootfs", "flash_kernel", "flash_vbmeta", "flash_dtbo"]: + pmb.flasher.run(args, action, ignore_errors=True) + + def frontend(args): action = args.action_flasher method = args.flash_method or args.deviceinfo["flash_method"] @@ -151,6 +156,8 @@ def frontend(args): sideload(args) if action in ["flash_lk2nd"]: flash_lk2nd(args) + if action == "flash_all": + flash_all(args) extra = args.action_extra if extra and "fastboot" in method and action != "boot": diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 00dd3207..11849696 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -277,8 +277,11 @@ def arguments_flasher(subparser): help="partition to flash the dtbo to (defaults" " to deviceinfo_flash_*_partition_dtbo)") + flash_all = sub.add_parser("flash_all", + help="Flash all partitions needed for the device") + for action in [flash_kernel, flash_lk2nd, flash_rootfs, - flash_vbmeta, flash_dtbo]: + flash_vbmeta, flash_dtbo, flash_all]: extra = action.add_argument(dest="action_extra", metavar="EXTRA", help="Additional commands to flasher" -- 2.45.2