]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
kernel-yocto: allow annotated options to be modified
authorBruce Ashfield <bruce.ashfield@gmail.com>
Tue, 6 May 2025 16:32:55 +0000 (12:32 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 8 May 2025 22:15:12 +0000 (23:15 +0100)
Bumping the kern-tools SRCREV to pickup the following commits:

    tools: allow fixups to conditionally change options

    Sometimes we have options that should either be =y or =m depending
    on the use case.

    Rather than force the options into multiple parallel and very similar
    fragments (which is error prone and labour intensive), we can allow
    an annotation in the configuration fragment that allows the default
    value to be overriden by a variable.

    The variable in question comes from a -D<var>=<value> on the scc
    or spp command line. If the define evaluates to a non-zero value
    a fixup is created that will modify the value when scc finishes
    gathering meta-data.

    An example of a notation would be:

      CONFIG_INET_TUNNEL=y # OVERRIDE:$MODULE_OR_Y

    CONFIG_INET_TUNNEL will be =y when standard tools (like merge-config)
    are used. But when scc/spp see this notation, they check the value
    of the variable MODULE_OR_Y, if that variable evalutes to a non-zero
    value, a fixup is created that will change CONFIG_INET_TUNNEL to
    that value before the kernel is configured.

To use the annotations, scc needs to be passed a value that is used
in the override expression. This has always been possible with defines
(-Dx=y), so we leverage that to control these conditional overrides.

In kernel-yocto, we now have a variable: KMETA_CONFIG_FEATURES

  KMETA_CONFIG_FEATURES ?= ""

Which defaults to empty, the only feature that is currently
implemented is "prefer-modules". When prefer-modules is detected
in the kmeta config features, the following define is passed to
scc:

   -DMODULE_OR_Y=m

Which as you can see from the above INET_TUNNEL example, will
evaluate to "m" and will override the default of "y".

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/kernel-yocto.bbclass
meta/recipes-kernel/kern-tools/kern-tools-native_git.bb

index cef6b9ec3fac12a3de08646f5ed6b0b1ac05c8b4..ba93145fd3d59d774585062113e19dcdd3db4640 100644 (file)
@@ -25,6 +25,7 @@ KCONF_AUDIT_LEVEL ?= "1"
 KCONF_BSP_AUDIT_LEVEL ?= "0"
 KMETA_AUDIT ?= "yes"
 KMETA_AUDIT_WERROR ?= ""
+KMETA_CONFIG_FEATURES ?= ""
 
 # returns local (absolute) path names for all valid patches in the
 # src_uri
@@ -298,7 +299,11 @@ do_kernel_metadata() {
                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_FINAL
+                       echo "${KMETA_CONFIG_FEATURES}" | grep -q "prefer-modules"
+                       if [ $? -eq 0 ]; then
+                               scc_defines="-DMODULE_OR_Y=m"
+                       fi
+                       scc --force $scc_defines -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
index 6dd19f1f0953d9516a290844967ab34376f4fa0d..20b1bcaf37bba234d9618a8e8a3dcb937cc863c1 100644 (file)
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "\
 
 DEPENDS += "git-replacement-native"
 
-SRCREV = "c8c1f17867d0cc7d04be225ba4901f2373428be2"
+SRCREV = "fe67c98d2e9b74af44d0c4b660fa18e3a95e7edd"
 PV = "0.3+git"
 
 inherit native