[meta-arm,3/8] arm-autonomy/classes: Introduce alternate-kernel.bbclass

Submitted by Diego Sueiro on Nov. 17, 2020, 10:04 a.m. | Patch ID: 178082

Details

Message ID 20201117100449.20111-4-diego.sueiro@arm.com
State New
Headers show

Commit Message

Diego Sueiro Nov. 17, 2020, 10:04 a.m.
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 <diego.sueiro@arm.com>

---
 .../classes/alternate-kernel.bbclass          | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta-arm-autonomy/classes/alternate-kernel.bbclass

-- 
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#1380): https://lists.yoctoproject.org/g/meta-arm/message/1380
Mute This Topic: https://lists.yoctoproject.org/mt/78313137/1003190
Group Owner: meta-arm+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [mhalstead@linuxfoundation.org]
-=-=-=-=-=-=-=-=-=-=-=-

Patch hide | download patch | download mbox

diff --git a/meta-arm-autonomy/classes/alternate-kernel.bbclass b/meta-arm-autonomy/classes/alternate-kernel.bbclass
new file mode 100644
index 0000000..9ca59e2
--- /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 )
+}