From: Bruce Ashfield <bruce.ashfi...@gmail.com>

KERNEL_FEATURES are explicitly checked by the kern-tools, and trigger
and error when not present. This is since the KERNEL_FEATURES are
specified by layers or BSPs as elements that are requied for correct
operation.

That being said, in order to support more kernel recipes that are using
fragments, but not necessarily the yocto kernel-cache for meta-data,
this change introduces: KERNEL_DANGLING_FEATURES_WARN_ONLY

As you'd expect, when set, missing kernel features only print a
message and warn that runtime issues may occur, but otherwise allow
the kernel configuration and build process to continue.

This was noticed/required when meta-virtualization adopted a more
generic kernel bbappend (to serve the needs of more layers in the
ecosystem), but also specifies some KERNEL_FEATURES. If layers using
a recipe derived from kernel-yocto, but not the main kernel-cache,
used meta-virtualization and error would be thrown due to missing
features. We now can both allow them to continue, and also provide
a more useful message to resolve the issue.

Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com>
---
 meta/classes/kernel-yocto.bbclass | 33 +++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass 
b/meta/classes/kernel-yocto.bbclass
index 3311f6e84e..70818cc01c 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -212,11 +212,36 @@ do_kernel_metadata() {
        fi
        meta_dir=$(kgit --meta)
 
+       KERNEL_FEATURES_FINAL=""
+       if [ -n "${KERNEL_FEATURES}" ]; then
+               for feature in ${KERNEL_FEATURES}; do
+                       feature_found=f
+                       for d in $includes; do
+                               path_to_check=$(echo $d | sed 's/-I//g')
+                               if [ "$feature_found" = "f" ] && [ -e 
"$path_to_check/$feature" ]; then
+                                   feature_found=t
+                               fi
+                       done
+                       if [ "$feature_found" = "f" ]; then
+                               if [ -n "${KERNEL_DANGLING_FEATURES_WARN_ONLY}" 
]; then
+                                   bbwarn "Feature '$feature' not found, but 
KERNEL_DANGLING_FEATURES_WARN_ONLY is set"
+                                   bbwarn "This may cause runtime issues, 
dropping feature and allowing configuration to continue"
+                               else
+                                   bberror "Feature '$feature' not found, this 
will cause configuration failures."
+                                   bberror "Check the SRC_URI for meta-data 
repositories or directories that may be missing"
+                                   bbfatal_log "Set 
KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue"
+                               fi
+                       else
+                               KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL 
$feature"
+                       fi
+               done
+        fi
+
        # run1: pull all the configuration fragments, no matter where they come 
from
-       elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} 
${KERNEL_FEATURES}`"
+       elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} 
$KERNEL_FEATURES_FINAL`"
        if [ -n "${elements}" ]; then
                echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
-               scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} 
$sccs_defconfig $bsp_definition $sccs $patches ${KERNEL_FEATURES}
+               scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} 
$sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
                if [ $? -ne 0 ]; then
                        bbfatal_log "Could not generate configuration queue for 
${KMACHINE}."
                fi
@@ -230,9 +255,9 @@ do_kernel_metadata() {
        fi
 
        # run2: only generate patches for elements that have been passed on the 
SRC_URI
-       elements="`echo -n ${sccs} ${patches} ${KERNEL_FEATURES}`"
+       elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
        if [ -n "${elements}" ]; then
-               scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} 
${sccs} ${patches} ${KERNEL_FEATURES}
+               scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} 
${sccs} ${patches} $KERNEL_FEATURES_FINAL
                if [ $? -ne 0 ]; then
                        bbfatal_log "Could not generate configuration queue for 
${KMACHINE}."
                fi
-- 
2.19.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#141162): 
https://lists.openembedded.org/g/openembedded-core/message/141162
Mute This Topic: https://lists.openembedded.org/mt/75964175/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to