From 171616a18362988f2ec067e84553453a7f7510b7 Mon Sep 17 00:00:00 2001 From: Diego Sueiro Date: Tue, 17 Nov 2020 10:04:44 +0000 Subject: [PATCH] arm-autonomy/classes: Introduce alternate-kernel.bbclass The alternate-kernel.bbclass is to be inherited by image recipes that want to build and install an alternate kernel (set via PREFERRED_PROVIDER_alternate/kernel). It is mandatory to also set the KERNEL_PACKAGE_NAME for the alternate kernel recipe via KERNEL_PACKAGE_NAME_pn-${PREFERRED_PROVIDER_alternate/kernel} and its value needs to be different from "kernel" since this is the default set for PREFERRED_PROVIDER_virtual/kernel. When building and installing an alternate kernel, the kernel-modules packages for both virtual/kernel and alternate/kernel will be installed. Change-Id: I1cd0c425c39206fe449fb5f8761ed6de95cfb442 Issue-Id: SCM-1654 Signed-off-by: Diego Sueiro Signed-off-by: Jon Mason --- .../classes/alternate-kernel.bbclass | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 meta-arm-autonomy/classes/alternate-kernel.bbclass diff --git a/meta-arm-autonomy/classes/alternate-kernel.bbclass b/meta-arm-autonomy/classes/alternate-kernel.bbclass new file mode 100644 index 00000000..9ca59e2c --- /dev/null +++ b/meta-arm-autonomy/classes/alternate-kernel.bbclass @@ -0,0 +1,26 @@ +# This class is to be inherited by image recipes that want to build and install +# an alternate kernel (set via PREFERRED_PROVIDER_alternate/kernel). +# +# It is mandatory to also set the KERNEL_PACKAGE_NAME for the alternate kernel +# recipe via KERNEL_PACKAGE_NAME_pn-${PREFERRED_PROVIDER_alternate/kernel} and +# its value needs to be different from "kernel" since this is the default set +# for PREFERRED_PROVIDER_virtual/kernel. +# +# An example of these settings can be found at meta-arm-autonomy/dynamic-layers/meta-arm-bsp/conf/machine/n1sdp-extra-settings.inc +# +# When building and installing an alternate kernel, the kernel-modules packages +# for both virtual/kernel and alternate/kernel will be installed. + +PREFERRED_PROVIDER_alternate/kernel ??= "" + +python () { + alternate_kernel = d.getVar('PREFERRED_PROVIDER_alternate/kernel') + if alternate_kernel: + alternate_kernel_pkg_name = d.getVar('KERNEL_PACKAGE_NAME_pn-%s' % alternate_kernel) + if alternate_kernel_pkg_name: + d.appendVar('EXTRA_IMAGEDEPENDS', ' ' + alternate_kernel) + d.appendVar('IMAGE_INSTALL', ' kernel-modules') + d.appendVar('IMAGE_INSTALL', ' ' + alternate_kernel_pkg_name + '-modules') + else: + raise bb.parse.SkipRecipe("No KERNEL_PACKAGE_NAME_pn-%s set" % alternate_kernel ) +}