From 05c9fb784ffb6018327b52bf2d32714db031dbde Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 18 Aug 2021 18:39:08 -0700 Subject: [PATCH] pmb/config/flashers: add support for single kernel 'flavor' (MR 2093) --- pmb/config/__init__.py | 8 ++++---- pmb/flasher/variables.py | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 1b71ddea..b9234720 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -668,7 +668,7 @@ Flasher abstraction. Allowed variables: $BOOT: Path to the /boot partition $DTB: Set to "-dtb" if deviceinfo_append_dtb is set, otherwise "" -$FLAVOR: Kernel flavor +$FLAVOR: Backwards compatibility with old mkinitfs (pma#660) $IMAGE: Path to the combined boot/rootfs image $IMAGE_SPLIT_BOOT: Path to the (split) boot image $IMAGE_SPLIT_ROOT: Path to the (split) rootfs image @@ -687,7 +687,7 @@ flashers = { "flash_rootfs": [["fastboot", "flash", "$PARTITION_SYSTEM", "$IMAGE"]], "flash_kernel": [["fastboot", "flash", "$PARTITION_KERNEL", - "$BOOT/boot.img-$FLAVOR"]], + "$BOOT/boot.img$FLAVOR"]], "flash_vbmeta": [ # Generate vbmeta image with "disable verification" flag ["avbtool", "make_vbmeta_image", "--flags", "2", @@ -699,7 +699,7 @@ flashers = { "flash_dtbo": [["fastboot", "flash", "$PARTITION_DTBO", "$BOOT/dtbo.img"]], "boot": [["fastboot", "--cmdline", "$KERNEL_CMDLINE", - "boot", "$BOOT/boot.img-$FLAVOR"]], + "boot", "$BOOT/boot.img$FLAVOR"]], }, }, # Some devices provide Fastboot but using Android boot images is not @@ -750,7 +750,7 @@ flashers = { "flash_kernel": [ ["heimdall_wait_for_device.sh"], ["heimdall", "flash", "--$PARTITION_KERNEL", - "$BOOT/boot.img-$FLAVOR"]], + "$BOOT/boot.img$FLAVOR"]], "flash_vbmeta": [ ["avbtool", "make_vbmeta_image", "--flags", "2", "--padding_size", "$FLASH_PAGESIZE", diff --git a/pmb/flasher/variables.py b/pmb/flasher/variables.py index ea258a52..4e74911e 100644 --- a/pmb/flasher/variables.py +++ b/pmb/flasher/variables.py @@ -1,5 +1,6 @@ # Copyright 2021 Oliver Smith # SPDX-License-Identifier: GPL-3.0-or-later +import pmb.config.pmaports def variables(args, flavor, method): @@ -43,7 +44,6 @@ def variables(args, flavor, method): vars = { "$BOOT": "/mnt/rootfs_" + args.device + "/boot", "$DTB": _dtb, - "$FLAVOR": flavor if flavor is not None else "", "$IMAGE_SPLIT_BOOT": "/home/pmos/rootfs/" + args.device + "-boot.img", "$IMAGE_SPLIT_ROOT": "/home/pmos/rootfs/" + args.device + "-root.img", "$IMAGE": "/home/pmos/rootfs/" + args.device + ".img", @@ -62,4 +62,11 @@ def variables(args, flavor, method): "/usr/share/uuu/flash_script.lst" } + # Backwards compatibility with old mkinitfs (pma#660) + pmaports_cfg = pmb.config.pmaports.read_config(args) + if pmaports_cfg.get("supported_mkinitfs_without_flavors", False): + vars["$FLAVOR"] = "" + else: + vars["$FLAVOR"] = f"-{flavor}" if flavor is not None else "-" + return vars