summaryrefslogtreecommitdiffstats
path: root/recipes-kernel
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2021-06-16 23:10:36 -0400
committerBruce Ashfield <bruce.ashfield@gmail.com>2021-10-14 18:29:05 -0400
commit5c212911879753d875ba76b3ab003502c8b7f900 (patch)
tree2d442a67425225119511fc6738fb2cf29b7ec1cc /recipes-kernel
parentfcf53f6a8c4fb67f60143955c7239f204f633dfe (diff)
downloadmeta-virtualization-5c212911879753d875ba76b3ab003502c8b7f900.tar.gz
virtualization/config: allow conditional use of yocto-cfg-fragments
To help enforce/guide consistent configuration and to avoid duplicating configuration fragments into the meta-virt layer, we leverage a native provider of the yocto-kernel-cache fragment repository. To allow support for kernels that support fragments, but don't have the yocto-kernel-cache in the kernel's SRC_URI, we create two conditional parts of the virtualization configuration. If virtualization is enabled in the distro features, the kernel version matches one of our supported ones, and the kernel inherits kernel-yocto, we add a depedency on the yocto-cfg-fragments-native recipe. That recipe will install the fragment collection to the kernel recipe's native sysroot. We can then check for the kernel-cache on the SRC_URI. If it is present, we use the feature at the standard location. If it is not present, we add the fragment from the native sysroot. While we could always use the native sysroot variant, we want to allow a kernel with a kernel-cache to be the first choice, and provide their own fragments. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-kernel')
-rw-r--r--recipes-kernel/linux/linux-yocto_virtualization.inc21
1 files changed, 20 insertions, 1 deletions
diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc
index 698b7fe2..a27ae7d6 100644
--- a/recipes-kernel/linux/linux-yocto_virtualization.inc
+++ b/recipes-kernel/linux/linux-yocto_virtualization.inc
@@ -15,7 +15,26 @@ KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains('DISTRO_FEATURES', 'kvm', 'kvm',
15# aufs kernel support required for xen-image-minimal 15# aufs kernel support required for xen-image-minimal
16KERNEL_FEATURES:append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" 16KERNEL_FEATURES:append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}"
17 17
18KERNEL_FEATURES:append = " cfg/virtio.scc" 18# if the kernel-yocto meta-data routine automatically starts to add the
19# recipe-sysroot-native, we can do away with this conditional, since all
20# features will be found at the same relative offset from a search
21# directory
22def kernel_cache_cond_feature(src_uri,feature):
23 import re
24 kernel_cache = re.search("kernel-cache", src_uri )
25 if kernel_cache:
26 return feature
27
28 return "../recipe-sysroot-native/kcfg/" + feature
29
30KERNEL_CACHE_FEATURES ?= "${@kernel_cache_cond_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')}"
31KERNEL_FEATURES:append = " ${KERNEL_CACHE_FEATURES}"
32
33# if kernel-yocto has been inherited (how we can check for configuration
34# fragment merging suport at the moment, then add a dependency on the
35# configuration fragment repository. This allows us to be sure that our
36# features can be enabled via the fragments
37do_kernel_metadata[depends] += "${@['', 'yocto-cfg-fragments-native:do_populate_sysroot'][(bb.data.inherits_class('kernel-yocto', d))]}"
19 38
20# xen kernel support 39# xen kernel support
21SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" 40SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"