diff mbox series

[meta-oe] kernel-selftest: remove flag assignments only

Message ID 20261001100847.1218020-1-leonid.iziumtsev@est.tech
State New
Headers show
Series [meta-oe] kernel-selftest: remove flag assignments only | expand

Commit Message

Leonid Iziumtsev Oct. 1, 2026, 10:08 a.m. UTC
The do_compile() step removes flags from the kernel Makefile
before building the selftests.

On older kernels (pre-5.12), -mrecord-mcount is guarded by a
cc-option probe:
    ifeq ($(call cc-option-yn,-mrecord-mcount),y)
        CC_FLAGS_FTRACE += -mrecord-mcount
    endif
Previously, the sed expression matched mrecord-mcount regardless
of its context in the line. This removed both the flag assignment
and the ifeq guard, leaving an orphaned endif and causing the
selftest build to fail.

Anchor the expression on += so that the sed only removes flag
assignments, giving us more precise control over which Makefile
lines are deleted.
Apply the same adjustment to the -Wno-alloc-size-larger-than
expressions for consistency.

Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@est.tech>
---
 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
index 6519b4ee4b..7a27ada2f0 100644
--- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -170,9 +170,9 @@  either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
     fi
     oe_runmake -C ${S} headers
     sed -i -e 's|^all: docs|all:|' ${S}/tools/testing/selftests/bpf/Makefile
-    sed -i -e '/mrecord-mcount/d' ${S}/Makefile
-    sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
-    sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
+    sed -i -e '/+=[[:space:]]*-mrecord-mcount/d' ${S}/Makefile
+    sed -i -e '/+=[[:space:]]*-Wno-alloc-size-larger-than/d' ${S}/Makefile
+    sed -i -e '/+=[[:space:]]*-Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
 
     # Add kernel headers to CFLAGS to fix PTP selftest compilation
     # Required for PTP_MASK_CLEAR_ALL and PTP_MASK_EN_SINGLE definitions