pmb.flasher/export: Add --no-install option to skip kernel/initfs update (!1863)

At the moment, pmbootstrap updates the kernel and the initfs whenever
using the flasher or export. This is useful, but sometimes you just want
to boot exactly the same kernel several times. In that case, having to wait
several seconds for the (redundant) update to complete is quite annoying.

Add a --no-install option that allows skipping the kernel/initfs update.
This commit is contained in:
Minecrell 2020-01-22 19:30:43 +01:00 committed by Oliver Smith
parent 8f4bd7dea1
commit 60217d0818
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
4 changed files with 13 additions and 6 deletions

View File

@ -22,8 +22,9 @@ def frontend(args):
" install' first (without the 'sdcard' parameter).")
# Rebuild the initramfs, just to make sure (see #69)
flavor = pmb.helpers.frontend._parse_flavor(args)
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
flavor = pmb.helpers.frontend._parse_flavor(args, args.autoinstall)
if args.autoinstall:
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Do the export, print all files
logging.info("Export symlinks to: " + target)

View File

@ -31,8 +31,9 @@ import pmb.parse.kconfig
def kernel(args):
# Rebuild the initramfs, just to make sure (see #69)
flavor = pmb.helpers.frontend._parse_flavor(args)
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
flavor = pmb.helpers.frontend._parse_flavor(args, args.autoinstall)
if args.autoinstall:
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Check kernel config
pmb.parse.kconfig.check(args, flavor)

View File

@ -46,13 +46,14 @@ import pmb.parse
import pmb.qemu
def _parse_flavor(args):
def _parse_flavor(args, autoinstall=True):
"""
Verify the flavor argument if specified, or return a default value.
:param autoinstall: make sure that at least one kernel flavor is installed
"""
# Install at least one kernel and get installed flavors
suffix = "rootfs_" + args.device
flavors = pmb.chroot.other.kernel_flavors_installed(args, suffix)
flavors = pmb.chroot.other.kernel_flavors_installed(args, suffix, autoinstall)
# Parse and verify the flavor argument
flavor = args.flavor

View File

@ -50,6 +50,8 @@ def arguments_export(subparser):
" (boot.img/kernel+initramfs only)",
action="store_true", dest="odin_flashable_tar")
ret.add_argument("--flavor", default=None)
ret.add_argument("--no-install", dest="autoinstall", default=True,
help="skip updating kernel/initfs", action="store_false")
return ret
@ -67,6 +69,8 @@ def arguments_flasher(subparser):
flash_kernel = sub.add_parser("flash_kernel", help="flash a kernel")
for action in [boot, flash_kernel]:
action.add_argument("--flavor", default=None)
action.add_argument("--no-install", dest="autoinstall", default=True,
help="skip updating kernel/initfs", action="store_false")
flash_kernel.add_argument("--partition", default=None,
help="partition to flash the kernel to (defaults"
" to deviceinfo_flash_*_partition_kernel)")