summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2024-08-12 17:17:36 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2024-08-12 17:54:24 +0000
commita940a0e873f9163d4585555b3f3d38e99400d237 (patch)
tree433217abba121d9415a0d2090173d8f2d6fc6c26
parentf7bb126b3947abff3e44ebe0a23399a5fb52d8dc (diff)
downloadmeta-virtualization-a940a0e873f9163d4585555b3f3d38e99400d237.tar.gz
kernel/cfg: allow multiple kernel configuration options
When more than one kernel is supported in oe-core, we may have situations where the options from an older (or newer) kernel are not appropriate for the other version (i.e. options have been added, removed or renamed). To support this we check the preferred version of the kernel and depend on a specific yocto-cfg recipe. This is similar to how the virtualization .inc files are chosen. If this technique proves to be correct, we can factor the common routines into a .inc and just set SRCREVs in the individual .bb files. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-kernel/linux/linux-yocto_virtualization.inc18
-rw-r--r--recipes-kernel/linux/yocto-cfg-fragments-6.10.bb37
-rw-r--r--recipes-kernel/linux/yocto-cfg-fragments-6.6.bb (renamed from recipes-kernel/linux/yocto-cfg-fragments.bb)2
3 files changed, 54 insertions, 3 deletions
diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc
index 5edaef94..88a1fa99 100644
--- a/recipes-kernel/linux/linux-yocto_virtualization.inc
+++ b/recipes-kernel/linux/linux-yocto_virtualization.inc
@@ -33,6 +33,21 @@ def distro_cond_feature(feature_fragment,distro_feature,d):
33 feat = kernel_cache_feature("",feature_fragment) 33 feat = kernel_cache_feature("",feature_fragment)
34 return bb.utils.contains('DISTRO_FEATURES', distro_feature, ' ' + feat, ' ', d) 34 return bb.utils.contains('DISTRO_FEATURES', distro_feature, ' ' + feat, ' ', d)
35 35
36def kernel_meta_ver_depends(d):
37 import re
38
39 t = d.getVar("PREFERRED_PROVIDER_virtual/kernel")
40 pv = d.getVar( "PREFERRED_VERSION_%s" % t )
41 pv = re.sub( '%', '', pv )
42
43 yocto_enabled = bb.data.inherits_class('kernel-yocto', d)
44 if yocto_enabled:
45 return "yocto-cfg-fragments-%s-native:do_populate_sysroot" % pv
46 else:
47 return ""
48
49KERNEL_CFG_DEPENDS ?= "${@kernel_meta_ver_depends(d)}"
50
36KERNEL_CACHE_FEATURES ?= "${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')} \ 51KERNEL_CACHE_FEATURES ?= "${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')} \
37 ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/xt-checksum.scc')} \ 52 ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/xt-checksum.scc')} \
38 ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/vswitch.scc')} \ 53 ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/vswitch.scc')} \
@@ -47,7 +62,7 @@ KERNEL_FEATURES:append = " ${KERNEL_CACHE_FEATURES}"
47# fragment merging suport at the moment, then add a dependency on the 62# fragment merging suport at the moment, then add a dependency on the
48# configuration fragment repository. This allows us to be sure that our 63# configuration fragment repository. This allows us to be sure that our
49# features can be enabled via the fragments 64# features can be enabled via the fragments
50do_kernel_metadata[depends] += "${@['', 'yocto-cfg-fragments-native:do_populate_sysroot'][(bb.data.inherits_class('kernel-yocto', d))]}" 65do_kernel_metadata[depends] += "${KERNEL_CFG_DEPENDS}"
51 66
52# xen kernel support 67# xen kernel support
53# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" 68# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"
@@ -58,4 +73,3 @@ KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/xen.scc', 'xen', d )}"
58# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k3s', ' file://kubernetes.scc', '', d)}" 73# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k3s', ' file://kubernetes.scc', '', d)}"
59KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}" 74KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}"
60KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k3s', d )}" 75KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k3s', d )}"
61
diff --git a/recipes-kernel/linux/yocto-cfg-fragments-6.10.bb b/recipes-kernel/linux/yocto-cfg-fragments-6.10.bb
new file mode 100644
index 00000000..d7e47ab4
--- /dev/null
+++ b/recipes-kernel/linux/yocto-cfg-fragments-6.10.bb
@@ -0,0 +1,37 @@
1HOMEPAGE = "https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/"
2SUMMARY = "Kernel configuration fragments"
3DESCRIPTION = "Typically used as part of a kernel clone, this is the standalone \
4fragment repository. Making it available to other fragment management schemes \
5"
6SECTION = "devel"
7
8LICENSE = "MIT"
9LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
10
11do_configure[noexec] = "1"
12do_compile[noexec] = "1"
13INHIBIT_DEFAULT_DEPS = "1"
14
15LINUX_VERSION ?= "6.10"
16PV = "v${LINUX_VERSION}+git${SRCREV}"
17
18SRCREV = "5161bedbdc3ff6f22a75fb5afb96a4077f4b4ab0"
19SRC_URI = "\
20 git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \
21 "
22
23S = "${WORKDIR}/git"
24
25do_install() {
26 install -d ${D}${base_prefix}/kcfg
27
28 # copy the configuration fragments over to the native deploy
29 cp -r ${S}/* ${D}${base_prefix}/kcfg
30 # scripts bring in a bash dependency we don't want
31 rm -rf ${D}${base_prefix}/kcfg/scripts
32}
33
34FILES:${PN} += "kcfg/"
35SYSROOT_DIRS += "${base_prefix}/kcfg"
36BBCLASSEXTEND = "native nativesdk"
37
diff --git a/recipes-kernel/linux/yocto-cfg-fragments.bb b/recipes-kernel/linux/yocto-cfg-fragments-6.6.bb
index e6815715..6bdc0d03 100644
--- a/recipes-kernel/linux/yocto-cfg-fragments.bb
+++ b/recipes-kernel/linux/yocto-cfg-fragments-6.6.bb
@@ -15,7 +15,7 @@ INHIBIT_DEFAULT_DEPS = "1"
15LINUX_VERSION ?= "6.6" 15LINUX_VERSION ?= "6.6"
16PV = "v${LINUX_VERSION}+git${SRCREV}" 16PV = "v${LINUX_VERSION}+git${SRCREV}"
17 17
18SRCREV = "eb283ea577df80542d48f0c498365960b4c4ecd9" 18SRCREV = "4a494b202029e94a72ebb3c3966d9f1d249900f3"
19SRC_URI = "\ 19SRC_URI = "\
20 git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \ 20 git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \
21 " 21 "