Re: bbappend conditional check for advanced metadata (yocto-kernel-cache)?


Matthias Klein
 

Hello Bruce,

Another is to make that append conditional based on something you can test. i.e. test for kernel-cache in the SRC_URI, and if present, do the append. Or you could test for the defconfig in the SRC_URI and don't do the append. There may be other options for this, but without all the details of the recipes, I can't say for sure.
I have a few variations of that theme in meta-virtualization, since there's a broad range of kernel types supported (https://git.yoctoproject.org/meta-virtualization/tree/recipes-kernel/linux/linux-yocto_virtualization.inc).
I chose the variant based on SRC_URI, but used KERNEL_CONFIG_URI because I got endless recursion between SRC_URI and KERNEL_FEATURES in the kernel recipe I use.
I ended up with this function:

def insert_if_kernel_cache_available(feature, d):
import re
if d.getVar('KERNEL_CONFIG_URI'):
config_uri = d.getVar('KERNEL_CONFIG_URI')
kernel_cache = re.search("kernel-cache", config_uri)
if kernel_cache:
return feature
return ""

KERNEL_FEATURES:append = "${@insert_if_kernel_cache_available(' features/overlayfs/overlayfs.scc', d)}"

Many greetings,
Matthias

Join yocto@lists.yoctoproject.org to automatically receive all group messages.