From 6bb8444fef59c161e389ae7d7b7e17b3a1441d5d Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 30 Mar 2018 01:11:20 +0000 Subject: [PATCH] "...flasher flash_rootfs" instead of "..._system" (#1373) * Change `pmbootstrap flasher flash_system` command to `pmbootstrap flasher flash_rootfs` * The old command still works, but all references have been changed to the new command * Remove obsolete `pmbootstrap flasher export` (that was changed to `pmbootstrap export` a few months ago) * Update `README.md` and ZSH auto completion * Change the description of the generated rootfs image (not talking about a system image anymore, mention that it has subpartitions) * Better description of `pmbootstrap flasher flash_rootfs --partition` --- README.md | 4 ++-- helpers/pmbootstrap-autocompletion.zsh | 3 ++- pmb/config/__init__.py | 6 +++--- pmb/export/symlinks.py | 2 +- pmb/flasher/frontend.py | 22 ++++++++++------------ pmb/helpers/frontend.py | 1 + pmb/install/_install.py | 10 +++++----- pmb/parse/arguments.py | 16 +++++++++------- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 7cf6aa06..baebd8ca 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ $ pmbootstrap qemu --image-size=1G Flash to the device: ``` $ pmbootstrap flasher flash_kernel -$ pmbootstrap flasher flash_system --partition=userdata +$ pmbootstrap flasher flash_rootfs --partition=userdata ``` -Export the system image, kernel, initramfs, `boot.img` etc.: +Export the rootfs, kernel, initramfs, `boot.img` etc.: ``` $ pmbootstrap export ``` diff --git a/helpers/pmbootstrap-autocompletion.zsh b/helpers/pmbootstrap-autocompletion.zsh index 42df2dc5..27033663 100644 --- a/helpers/pmbootstrap-autocompletion.zsh +++ b/helpers/pmbootstrap-autocompletion.zsh @@ -36,7 +36,8 @@ _pmbootstrap_targets() | sed 's/linux-//g' ;; flasher) - echo flash_kernel flash_system + echo boot flash_kernel flash_rootfs sideload list_flavors \ + list_devices ;; esac } diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index fb60705b..39a50ee7 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -318,7 +318,7 @@ flashers = { { "list_devices": [["fastboot", "-i", "$VENDOR_ID", "devices", "-l"]], - "flash_system": [["fastboot", "-i", "$VENDOR_ID", + "flash_rootfs": [["fastboot", "-i", "$VENDOR_ID", "flash", "$PARTITION_SYSTEM", "$IMAGE"]], "flash_kernel": [["fastboot", "-i", "$VENDOR_ID", "flash", "boot", "$BOOT/boot.img-$FLAVOR"]], @@ -337,7 +337,7 @@ flashers = { "actions": { "list_devices": [["heimdall", "detect"]], - "flash_system": [ + "flash_rootfs": [ ["heimdall_wait_for_device.sh"], ["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]], "flash_kernel": [["heimdall_flash_kernel.sh", @@ -352,7 +352,7 @@ flashers = { "actions": { "list_devices": [["heimdall", "detect"]], - "flash_system": [ + "flash_rootfs": [ ["heimdall_wait_for_device.sh"], ["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]], "flash_kernel": [ diff --git a/pmb/export/symlinks.py b/pmb/export/symlinks.py index 1d6b8cd1..b1c3d88f 100644 --- a/pmb/export/symlinks.py +++ b/pmb/export/symlinks.py @@ -41,7 +41,7 @@ def symlinks(args, flavor, folder): "uInitrd-" + flavor: "Initramfs, legacy u-boot image format", "uImage-" + flavor: "Kernel, legacy u-boot image format", "vmlinuz-" + flavor: "Linux kernel", - args.device + ".img": "System partition", + args.device + ".img": "Rootfs with partitions for /boot and /", "pmos-" + args.device + ".zip": "Android recovery flashable zip", } diff --git a/pmb/flasher/frontend.py b/pmb/flasher/frontend.py index f7f77f48..b2917121 100644 --- a/pmb/flasher/frontend.py +++ b/pmb/flasher/frontend.py @@ -25,7 +25,6 @@ import pmb.install import pmb.chroot.apk import pmb.chroot.initfs import pmb.chroot.other -import pmb.export.frontend import pmb.helpers.frontend import pmb.parse.kconfig @@ -60,7 +59,7 @@ def list_flavors(args): logging.info("* " + flavor) -def system(args): +def rootfs(args): # Generate system image, install flasher img_path = "/home/pmos/rootfs/" + args.device + ".img" if not os.path.exists(args.work + "/chroot_native" + img_path): @@ -77,8 +76,8 @@ def system(args): " to flash.") # Run the flasher - logging.info("(native) flash system image") - pmb.flasher.run(args, "flash_system") + logging.info("(native) flash rootfs image") + pmb.flasher.run(args, "flash_rootfs") def list_devices(args): @@ -114,22 +113,21 @@ def frontend(args): action = args.action_flasher method = args.flash_method or args.deviceinfo["flash_method"] - if method == "none" and action in ["boot", "flash_kernel", "flash_system"]: + # Legacy alias + if action == "flash_system": + action = "flash_rootfs" + + if method == "none" and action in ["boot", "flash_kernel", "flash_rootfs"]: logging.info("This device doesn't support any flash method.") return if action in ["boot", "flash_kernel"]: kernel(args) - if action == "flash_system": - system(args) + if action == "flash_rootfs": + rootfs(args) if action == "list_flavors": list_flavors(args) if action == "list_devices": list_devices(args) if action == "sideload": sideload(args) - if action == "export": - logging.info("WARNING: 'pmbootstrap flasher export' is deprecated and" - " will be removed soon. The new syntax is 'pmbootstrap" - " export'.") - pmb.export.frontend(args) diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 45a684da..1f4d7aff 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -32,6 +32,7 @@ import pmb.config import pmb.chroot import pmb.chroot.initfs import pmb.chroot.other +import pmb.export import pmb.flasher import pmb.helpers.logging import pmb.helpers.other diff --git a/pmb/install/_install.py b/pmb/install/_install.py index f60be8d3..31f7cc59 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -306,13 +306,13 @@ def install_system_image(args): # System flash information if not args.sdcard: - logging.info("* pmbootstrap flasher flash_system") - logging.info(" Flashes the system image, that has been" - " generated to your device:") + logging.info("* pmbootstrap flasher flash_rootfs") + logging.info(" Flashes the generated rootfs image to your device:") logging.info(" " + args.work + "/chroot_native/home/pmos/rootfs/" + args.device + ".img") - logging.info(" (NOTE: This file has a partition table," - " which contains a boot- and root subpartition.)") + logging.info(" (NOTE: This file has a partition table, which contains" + " /boot and / subpartitions. That way we don't need to" + " change the partition layout on your device.)") logging.info("* pmbootstrap flasher flash_kernel") logging.info(" Flashes the kernel + initramfs to your device:") diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index b0d4ea00..6aead610 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -50,11 +50,15 @@ def arguments_flasher(subparser): for action in [boot, flash_kernel]: action.add_argument("--flavor", default=None) - # Flash system - flash_system = sub.add_parser( - "flash_system", help="flash the system partition") - flash_system.add_argument("--partition", default=None, help="partition to flash" - " the system image") + # Flash rootfs + flash_rootfs = sub.add_parser("flash_rootfs", aliases=["flash_system"], + help="flash the rootfs to a partition on the" + " device (partition layout does not get" + " changed)") + flash_rootfs.add_argument("--partition", default=None, + help="partition to flash to (Android: default" + " is 'system', but 'userdata' may have more" + " space)") # Actions without extra arguments sub.add_parser("sideload", help="sideload recovery zip") @@ -62,8 +66,6 @@ def arguments_flasher(subparser): " inside the device rootfs chroot on this computer") sub.add_parser("list_devices", help="show connected devices") - # Deprecated "pmbootstrap flasher export" - arguments_export(sub) return ret