summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorHaris Okanovic <haris.okanovic@ni.com>2017-11-07 12:40:39 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-02 17:24:37 +0000
commit5b4aab6b40cf21471442e21abc8051b38985de84 (patch)
tree5ef7f35eed15902da0356765f068d57af99f5c23 /meta/recipes-kernel
parent2362b78887a63e2e7e5afe1c1cc539c4a6be959d (diff)
downloadpoky-5b4aab6b40cf21471442e21abc8051b38985de84.tar.gz
kernel: Add support for multiple kernel packages
Some distros may want to provide alternate kernel "flavors" via feeds or within bootable images. For example, readily available builds which provide certain diagnostic features can enable developers and testers to more quickly resolve issues by avoiding lengthy kernel builds. This change allows for building multiple flavors of the kernel and module packages by templatizing kernel package names via a new KERNEL_PACKAGE_NAME variable in kernel.bbclass. It defaults to the old name of "kernel", but can be overridden by certain recipes providing alternate kernel flavors. To maintain compatibility, recipes providing alternate kernel flavors cannot be the "preferred provider" for virtual/kernel. This is because OE puts the preferred provider's build and source at "tmp-glibc/work-shared/$MACHINE/kernel-build-artifacts/" and "tmp-glibc/work-shared/$MACHINE/kernel-source/" instead of "tmp-glibc/work/*/$PN/" like other recipes. Therefore, recipes using the default KERNEL_PACKAGE_NAME="kernel" follows the old semantics -- build in the old location and may be preferred provider -- while recipes using all other KERNEL_PACKAGE_NAME's build from the normal WORKDIR and don't provide "virtual/kernel". Testing: 1. Add `KERNEL_PACKAGE_NAME_pn-linux-yocto-tiny = "tiny-linux"` to local.conf so that linux-yocto-tiny may build alongside the main kernel (linux-yocto). 2. `bitbake linux-yocto linux-yocto-tiny` to build both kernel flavors. 3. Verified image and modules IPKs exist for both: tmp-glibc/deploy/ipk/qemux86/kernel-* for linux-yocto tmp-glibc/deploy/ipk/qemux86/tiny-linux* for linux-yocto-tiny 4. Verified linux-yocto is the "preferred provider", and was built in shared directory: tmp-glibc/work-shared/qemux86/kernel-* 5. Add `CORE_IMAGE_BASE_INSTALL_append_pn-core-image-base = "tiny-linux"` to local.conf to install both kernel flavors in core-image-base. 6. `bitbake core-image-base` to build an image. 7. Verified image contains two bzImage's under /boot/, with "yocto-standard" (linux-yocto recipe) selected to boot via symlink. Discussion threads: http://lists.openembedded.org/pipermail/openembedded-core/2015-December/thread.html#114122 http://lists.openembedded.org/pipermail/openembedded-core/2017-July/thread.html#139130 [YOCTO #11363] (From OE-Core rev: 6c8c899849d101fd1b86aad0b8eed05c7c785924) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com> Coauthored-by: Gratian Crisan <gratian.crisan@ni.com> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb14
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb2
-rw-r--r--meta/recipes-kernel/linux/linux-yocto.inc2
6 files changed, 10 insertions, 14 deletions
diff --git a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index 68d3f84c0b..48f012918a 100644
--- a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -23,17 +23,13 @@ if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
23 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2 23 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
24 exit 1 24 exit 1
25fi 25fi
26if [ ! -r ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion ]; then 26
27 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" >&2 27kernelabi=""
28else 28if [ -r "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion" ]; then
29 kernelabi=\$(cat ${PKGDATA_DIR}/kernel-depmod/kernel-abiversion) 29 kernelabi=\$(cat "${PKGDATA_DIR}/kernel-depmod/kernel-abiversion")
30 if [ "\$kernelabi" != "\$4" ]; then
31 echo "Error: Kernel version \$4 does not match kernel-abiversion (\$kernelabi)" >&2
32 exit 1
33 fi
34fi 30fi
35 31
36if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ]; then 32if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
37 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2 33 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
38 exec env depmod "\$1" "\$2" "\$3" "\$4" 34 exec env depmod "\$1" "\$2" "\$3" "\$4"
39else 35else
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
index fd31bf986c..40d6e4ac23 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
index 25f3963c74..ed65f77a91 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.12.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
index c1cbf35a25..e1547e9960 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
index d225339c14..fa25629861 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
@@ -7,7 +7,7 @@ require recipes-kernel/linux/linux-yocto.inc
7# to build multiple virtual/kernel providers, e.g. as dependency of 7# to build multiple virtual/kernel providers, e.g. as dependency of
8# core-image-rt-sdk, core-image-rt. 8# core-image-rt-sdk, core-image-rt.
9python () { 9python () {
10 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": 10 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 9c1f61be75..8a70eb5018 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -12,7 +12,7 @@ INC_PR = "r4"
12# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required 12# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required
13# by the use of AUTOREV SRCREVs, which are the default for this recipe. 13# by the use of AUTOREV SRCREVs, which are the default for this recipe.
14python () { 14python () {
15 if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != d.getVar("PN"): 15 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
16 d.delVar("BB_DONT_CACHE") 16 d.delVar("BB_DONT_CACHE")
17 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN"))) 17 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN")))
18} 18}