diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-08-12 17:17:36 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-08-12 17:54:24 +0000 |
commit | a940a0e873f9163d4585555b3f3d38e99400d237 (patch) | |
tree | 433217abba121d9415a0d2090173d8f2d6fc6c26 | |
parent | f7bb126b3947abff3e44ebe0a23399a5fb52d8dc (diff) | |
download | meta-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.inc | 18 | ||||
-rw-r--r-- | recipes-kernel/linux/yocto-cfg-fragments-6.10.bb | 37 | ||||
-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 | ||
36 | def 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 | |||
49 | KERNEL_CFG_DEPENDS ?= "${@kernel_meta_ver_depends(d)}" | ||
50 | |||
36 | KERNEL_CACHE_FEATURES ?= "${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')} \ | 51 | KERNEL_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 |
50 | do_kernel_metadata[depends] += "${@['', 'yocto-cfg-fragments-native:do_populate_sysroot'][(bb.data.inherits_class('kernel-yocto', d))]}" | 65 | do_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)}" |
59 | KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}" | 74 | KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}" |
60 | KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k3s', d )}" | 75 | KERNEL_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 @@ | |||
1 | HOMEPAGE = "https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/" | ||
2 | SUMMARY = "Kernel configuration fragments" | ||
3 | DESCRIPTION = "Typically used as part of a kernel clone, this is the standalone \ | ||
4 | fragment repository. Making it available to other fragment management schemes \ | ||
5 | " | ||
6 | SECTION = "devel" | ||
7 | |||
8 | LICENSE = "MIT" | ||
9 | LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
10 | |||
11 | do_configure[noexec] = "1" | ||
12 | do_compile[noexec] = "1" | ||
13 | INHIBIT_DEFAULT_DEPS = "1" | ||
14 | |||
15 | LINUX_VERSION ?= "6.10" | ||
16 | PV = "v${LINUX_VERSION}+git${SRCREV}" | ||
17 | |||
18 | SRCREV = "5161bedbdc3ff6f22a75fb5afb96a4077f4b4ab0" | ||
19 | SRC_URI = "\ | ||
20 | git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \ | ||
21 | " | ||
22 | |||
23 | S = "${WORKDIR}/git" | ||
24 | |||
25 | do_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 | |||
34 | FILES:${PN} += "kcfg/" | ||
35 | SYSROOT_DIRS += "${base_prefix}/kcfg" | ||
36 | BBCLASSEXTEND = "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" | |||
15 | LINUX_VERSION ?= "6.6" | 15 | LINUX_VERSION ?= "6.6" |
16 | PV = "v${LINUX_VERSION}+git${SRCREV}" | 16 | PV = "v${LINUX_VERSION}+git${SRCREV}" |
17 | 17 | ||
18 | SRCREV = "eb283ea577df80542d48f0c498365960b4c4ecd9" | 18 | SRCREV = "4a494b202029e94a72ebb3c3966d9f1d249900f3" |
19 | SRC_URI = "\ | 19 | SRC_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 | " |