From a940a0e873f9163d4585555b3f3d38e99400d237 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 12 Aug 2024 17:17:36 +0000 Subject: 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 --- .../linux/linux-yocto_virtualization.inc | 18 +++++++++-- recipes-kernel/linux/yocto-cfg-fragments-6.10.bb | 37 ++++++++++++++++++++++ recipes-kernel/linux/yocto-cfg-fragments-6.6.bb | 37 ++++++++++++++++++++++ recipes-kernel/linux/yocto-cfg-fragments.bb | 37 ---------------------- 4 files changed, 90 insertions(+), 39 deletions(-) create mode 100644 recipes-kernel/linux/yocto-cfg-fragments-6.10.bb create mode 100644 recipes-kernel/linux/yocto-cfg-fragments-6.6.bb delete mode 100644 recipes-kernel/linux/yocto-cfg-fragments.bb (limited to 'recipes-kernel') 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): feat = kernel_cache_feature("",feature_fragment) return bb.utils.contains('DISTRO_FEATURES', distro_feature, ' ' + feat, ' ', d) +def kernel_meta_ver_depends(d): + import re + + t = d.getVar("PREFERRED_PROVIDER_virtual/kernel") + pv = d.getVar( "PREFERRED_VERSION_%s" % t ) + pv = re.sub( '%', '', pv ) + + yocto_enabled = bb.data.inherits_class('kernel-yocto', d) + if yocto_enabled: + return "yocto-cfg-fragments-%s-native:do_populate_sysroot" % pv + else: + return "" + +KERNEL_CFG_DEPENDS ?= "${@kernel_meta_ver_depends(d)}" + KERNEL_CACHE_FEATURES ?= "${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')} \ ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/xt-checksum.scc')} \ ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/vswitch.scc')} \ @@ -47,7 +62,7 @@ KERNEL_FEATURES:append = " ${KERNEL_CACHE_FEATURES}" # fragment merging suport at the moment, then add a dependency on the # configuration fragment repository. This allows us to be sure that our # features can be enabled via the fragments -do_kernel_metadata[depends] += "${@['', 'yocto-cfg-fragments-native:do_populate_sysroot'][(bb.data.inherits_class('kernel-yocto', d))]}" +do_kernel_metadata[depends] += "${KERNEL_CFG_DEPENDS}" # xen kernel support # 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 )}" # SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k3s', ' file://kubernetes.scc', '', d)}" KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}" KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k3s', d )}" - 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 @@ +HOMEPAGE = "https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/" +SUMMARY = "Kernel configuration fragments" +DESCRIPTION = "Typically used as part of a kernel clone, this is the standalone \ +fragment repository. Making it available to other fragment management schemes \ +" +SECTION = "devel" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" +INHIBIT_DEFAULT_DEPS = "1" + +LINUX_VERSION ?= "6.10" +PV = "v${LINUX_VERSION}+git${SRCREV}" + +SRCREV = "5161bedbdc3ff6f22a75fb5afb96a4077f4b4ab0" +SRC_URI = "\ + git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \ + " + +S = "${WORKDIR}/git" + +do_install() { + install -d ${D}${base_prefix}/kcfg + + # copy the configuration fragments over to the native deploy + cp -r ${S}/* ${D}${base_prefix}/kcfg + # scripts bring in a bash dependency we don't want + rm -rf ${D}${base_prefix}/kcfg/scripts +} + +FILES:${PN} += "kcfg/" +SYSROOT_DIRS += "${base_prefix}/kcfg" +BBCLASSEXTEND = "native nativesdk" + diff --git a/recipes-kernel/linux/yocto-cfg-fragments-6.6.bb b/recipes-kernel/linux/yocto-cfg-fragments-6.6.bb new file mode 100644 index 00000000..6bdc0d03 --- /dev/null +++ b/recipes-kernel/linux/yocto-cfg-fragments-6.6.bb @@ -0,0 +1,37 @@ +HOMEPAGE = "https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/" +SUMMARY = "Kernel configuration fragments" +DESCRIPTION = "Typically used as part of a kernel clone, this is the standalone \ +fragment repository. Making it available to other fragment management schemes \ +" +SECTION = "devel" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" +INHIBIT_DEFAULT_DEPS = "1" + +LINUX_VERSION ?= "6.6" +PV = "v${LINUX_VERSION}+git${SRCREV}" + +SRCREV = "4a494b202029e94a72ebb3c3966d9f1d249900f3" +SRC_URI = "\ + git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \ + " + +S = "${WORKDIR}/git" + +do_install() { + install -d ${D}${base_prefix}/kcfg + + # copy the configuration fragments over to the native deploy + cp -r ${S}/* ${D}${base_prefix}/kcfg + # scripts bring in a bash dependency we don't want + rm -rf ${D}${base_prefix}/kcfg/scripts +} + +FILES:${PN} += "kcfg/" +SYSROOT_DIRS += "${base_prefix}/kcfg" +BBCLASSEXTEND = "native nativesdk" + diff --git a/recipes-kernel/linux/yocto-cfg-fragments.bb b/recipes-kernel/linux/yocto-cfg-fragments.bb deleted file mode 100644 index e6815715..00000000 --- a/recipes-kernel/linux/yocto-cfg-fragments.bb +++ /dev/null @@ -1,37 +0,0 @@ -HOMEPAGE = "https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/" -SUMMARY = "Kernel configuration fragments" -DESCRIPTION = "Typically used as part of a kernel clone, this is the standalone \ -fragment repository. Making it available to other fragment management schemes \ -" -SECTION = "devel" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -do_configure[noexec] = "1" -do_compile[noexec] = "1" -INHIBIT_DEFAULT_DEPS = "1" - -LINUX_VERSION ?= "6.6" -PV = "v${LINUX_VERSION}+git${SRCREV}" - -SRCREV = "eb283ea577df80542d48f0c498365960b4c4ecd9" -SRC_URI = "\ - git://git.yoctoproject.org/yocto-kernel-cache;branch=yocto-${LINUX_VERSION} \ - " - -S = "${WORKDIR}/git" - -do_install() { - install -d ${D}${base_prefix}/kcfg - - # copy the configuration fragments over to the native deploy - cp -r ${S}/* ${D}${base_prefix}/kcfg - # scripts bring in a bash dependency we don't want - rm -rf ${D}${base_prefix}/kcfg/scripts -} - -FILES:${PN} += "kcfg/" -SYSROOT_DIRS += "${base_prefix}/kcfg" -BBCLASSEXTEND = "native nativesdk" - -- cgit v1.2.3-54-g00ecf