diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-12 17:50:02 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-12 19:06:40 +0000 |
| commit | c2eeba33360b0941ff2a89f44712e9212066f786 (patch) | |
| tree | 61f438c4e77a46de8cc5d4651b8fb3958985b69f | |
| parent | d16110ae98c36572dbf39af487f426f60842313e (diff) | |
| download | meta-virtualization-c2eeba33360b0941ff2a89f44712e9212066f786.tar.gz | |
kernel: skip kcfg search path injection for kernels with kernel-cache
The kcfg sysroot search path (type=kmeta) was being injected
unconditionally, which caused fragment conflicts for linux-yocto kernels
that already have their own kernel-cache meta branch. The injected
search path would roll back fragments to an older set.
Make the injection conditional and fix the root cause:
- kernel_cache_feature() now checks SRC_URI for type=kmeta entries.
Kernels with kernel-cache get short paths (e.g. cfg/container.scc)
that resolve directly via the kernel-cache's search path. Kernels
without kernel-cache get the sysroot-relative ../../ paths as before.
- distro_cond_feature() now passes d.getVar('SRC_URI') instead of an
empty string, so kernel_cache_feature() can actually see whether the
kernel has a kernel-cache.
- SRC_URI append and inject_kcfg_search_path prefunc skip when
type=kmeta is already present.
- Remove unused kernel_cache_cond_feature() which was the original
conditional implementation but was never wired up.
This restores the original design intent from commit 5c212911
("allow conditional use of yocto-cfg-fragments"): kernel-cache is
the first choice for fragment resolution, sysroot is the fallback.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | recipes-kernel/linux/linux-yocto_virtualization.inc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc index 8d14ce92..486e77ce 100644 --- a/recipes-kernel/linux/linux-yocto_virtualization.inc +++ b/recipes-kernel/linux/linux-yocto_virtualization.inc | |||
| @@ -11,18 +11,24 @@ KERNEL_FEATURES:append = "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' feat | |||
| 11 | # Always add a local/layer fragment for easy debug and enabling of options | 11 | # Always add a local/layer fragment for easy debug and enabling of options |
| 12 | SRC_URI += "file://extra-configs.cfg" | 12 | SRC_URI += "file://extra-configs.cfg" |
| 13 | 13 | ||
| 14 | # Inject the kcfg sysroot root into the scc search path so compound .scc | 14 | # Inject the kcfg sysroot into the scc search path so compound .scc |
| 15 | # files (like container.scc) can resolve their include directives. | 15 | # files (like container.scc) can resolve their include directives. |
| 16 | # kernel-yocto.bbclass adds type=kmeta directories to -I includes via | 16 | # Only needed for kernels that do NOT have a type=kmeta SRC_URI entry |
| 17 | # find_kernel_feature_dirs/feat_dirs. The prefunc replaces the placeholder | 17 | # (i.e. no kernel-cache). The prefunc replaces this placeholder with |
| 18 | # directory with a symlink to the kcfg sysroot so that spp can resolve | 18 | # a symlink to the kcfg sysroot only for non-kernel-cache kernels. |
| 19 | # include directives within .scc files that reference other fragments | 19 | # For kernel-cache kernels the placeholder stays empty (harmless). |
| 20 | # by relative path (e.g. "include cfg/9p.scc" inside container.scc). | ||
| 21 | SRC_URI:append = " file://kcfg-search-path;type=kmeta;destsuffix=kcfg-sysroot" | 20 | SRC_URI:append = " file://kcfg-search-path;type=kmeta;destsuffix=kcfg-sysroot" |
| 22 | 21 | ||
| 23 | python inject_kcfg_search_path() { | 22 | python inject_kcfg_search_path() { |
| 24 | import os, shutil | 23 | import os, shutil |
| 25 | 24 | ||
| 25 | # Skip if the kernel has its own kmeta (kernel-cache) | ||
| 26 | src_uri = d.getVar('SRC_URI') | ||
| 27 | # Check for type=kmeta entries other than our own kcfg-search-path | ||
| 28 | for entry in src_uri.split(): | ||
| 29 | if 'type=kmeta' in entry and 'kcfg-search-path' not in entry: | ||
| 30 | return | ||
| 31 | |||
| 26 | unpackdir = d.getVar('UNPACKDIR') | 32 | unpackdir = d.getVar('UNPACKDIR') |
| 27 | workdir = d.getVar('WORKDIR') | 33 | workdir = d.getVar('WORKDIR') |
| 28 | search_dir = os.path.join(unpackdir, 'kcfg-sysroot') | 34 | search_dir = os.path.join(unpackdir, 'kcfg-sysroot') |
| @@ -41,26 +47,20 @@ python inject_kcfg_search_path() { | |||
| 41 | 47 | ||
| 42 | do_kernel_metadata[prefuncs] += "inject_kcfg_search_path" | 48 | do_kernel_metadata[prefuncs] += "inject_kcfg_search_path" |
| 43 | 49 | ||
| 44 | # if the kernel-yocto meta-data routine automatically starts to add the | 50 | # Return the correct path for a kernel configuration fragment. |
| 45 | # recipe-sysroot-native, we can do away with this conditional, since all | 51 | # Kernels with their own kernel-cache (type=kmeta in SRC_URI) already |
| 46 | # features will be found at the same relative offset from a search | 52 | # have fragments on spp's search path, so we use short paths that |
| 47 | # directory | 53 | # resolve directly. Kernels without kernel-cache need the sysroot- |
| 48 | def kernel_cache_cond_feature(src_uri,feature): | 54 | # relative path (which requires the kcfg-search-path injection above). |
| 49 | import re | ||
| 50 | kernel_cache = re.search("kernel-cache", src_uri ) | ||
| 51 | if kernel_cache: | ||
| 52 | return feature | ||
| 53 | |||
| 54 | return "../../recipe-sysroot-native/kcfg/" + feature | ||
| 55 | |||
| 56 | # no conditional, just use the yocto-kernel-cache addition, yes | ||
| 57 | # the src_uri isn't used, but we may need to check it in the future | ||
| 58 | def kernel_cache_feature(src_uri,feature): | 55 | def kernel_cache_feature(src_uri,feature): |
| 56 | for entry in src_uri.split(): | ||
| 57 | if 'type=kmeta' in entry and 'kcfg-search-path' not in entry: | ||
| 58 | return feature | ||
| 59 | return "../../recipe-sysroot-native/kcfg/" + feature | 59 | return "../../recipe-sysroot-native/kcfg/" + feature |
| 60 | 60 | ||
| 61 | def distro_cond_feature(feature_fragment,distro_feature,d): | 61 | def distro_cond_feature(feature_fragment,distro_feature,d): |
| 62 | import bb | 62 | import bb |
| 63 | feat = kernel_cache_feature("",feature_fragment) | 63 | feat = kernel_cache_feature(d.getVar('SRC_URI'),feature_fragment) |
| 64 | return bb.utils.contains('DISTRO_FEATURES', distro_feature, ' ' + feat, ' ', d) | 64 | return bb.utils.contains('DISTRO_FEATURES', distro_feature, ' ' + feat, ' ', d) |
| 65 | 65 | ||
| 66 | # kept as a reference if we go back to a dynamically calculated | 66 | # kept as a reference if we go back to a dynamically calculated |
