From a4625a1fa2758c0d2496a898ed409b5225efdab1 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 10 Feb 2026 18:33:23 +0000 Subject: kernel: inject local search path to fragment processing Inject the kcfg sysroot root into the scc search path so compound .scc files (like container.scc) can resolve their include directives. kernel-yocto.bbclass adds type=kmeta directories to -I includes via find_kernel_feature_dirs/feat_dirs. The prefunc replaces the placeholder directory with a symlink to the kcfg sysroot so that spp can resolve include directives within scc files that reference other fragments by relative path (e.g. "include cfg/9p.scc" inside container.scc). Signed-off-by: Bruce Ashfield --- .../kcfg-search-path/kcfg-search-path.scc | 1 + .../linux/linux-yocto_virtualization.inc | 30 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 recipes-kernel/linux/linux-yocto/kcfg-search-path/kcfg-search-path.scc diff --git a/recipes-kernel/linux/linux-yocto/kcfg-search-path/kcfg-search-path.scc b/recipes-kernel/linux/linux-yocto/kcfg-search-path/kcfg-search-path.scc new file mode 100644 index 00000000..aff2903e --- /dev/null +++ b/recipes-kernel/linux/linux-yocto/kcfg-search-path/kcfg-search-path.scc @@ -0,0 +1 @@ +# Placeholder - directory replaced by symlink to kcfg sysroot at build time diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc index d67210c4..89e73c48 100644 --- a/recipes-kernel/linux/linux-yocto_virtualization.inc +++ b/recipes-kernel/linux/linux-yocto_virtualization.inc @@ -11,6 +11,36 @@ KERNEL_FEATURES:append = "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' feat # Always add a local/layer fragment for easy debug and enabling of options SRC_URI += "file://extra-configs.cfg" +# Inject the kcfg sysroot root into the scc search path so compound .scc +# files (like container.scc) can resolve their include directives. +# kernel-yocto.bbclass adds type=kmeta directories to -I includes via +# find_kernel_feature_dirs/feat_dirs. The prefunc replaces the placeholder +# directory with a symlink to the kcfg sysroot so that spp can resolve +# include directives within .scc files that reference other fragments +# by relative path (e.g. "include cfg/9p.scc" inside container.scc). +SRC_URI:append = " file://kcfg-search-path;type=kmeta;destsuffix=kcfg-sysroot" + +python inject_kcfg_search_path() { + import os, shutil + + unpackdir = d.getVar('UNPACKDIR') + workdir = d.getVar('WORKDIR') + search_dir = os.path.join(unpackdir, 'kcfg-sysroot') + kcfg_sysroot = os.path.join(workdir, 'recipe-sysroot-native', 'kcfg') + + if os.path.isdir(kcfg_sysroot): + if os.path.isdir(search_dir) and not os.path.islink(search_dir): + shutil.rmtree(search_dir) + if os.path.islink(search_dir) or not os.path.exists(search_dir): + if os.path.islink(search_dir): + os.unlink(search_dir) + os.symlink(kcfg_sysroot, search_dir) + else: + bb.warn("kcfg sysroot not found at %s" % kcfg_sysroot) +} + +do_kernel_metadata[prefuncs] += "inject_kcfg_search_path" + # if the kernel-yocto meta-data routine automatically starts to add the # recipe-sysroot-native, we can do away with this conditional, since all # features will be found at the same relative offset from a search -- cgit v1.2.3-54-g00ecf