summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb7
-rw-r--r--meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch76
2 files changed, 82 insertions, 1 deletions
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
index 08b0c60c6c..1e18caedda 100644
--- a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb
@@ -12,9 +12,14 @@ S = "${UNPACKDIR}"
12SRC_URI:append:libc-musl = "\ 12SRC_URI:append:libc-musl = "\
13 file://userfaultfd.patch \ 13 file://userfaultfd.patch \
14 " 14 "
15
16# Fix liburing detection (from Linux v7.0)
17MM_PATCH = "file://0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch"
18
15SRC_URI += "file://run-ptest \ 19SRC_URI += "file://run-ptest \
16 file://COPYING \ 20 file://COPYING \
17 file://0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch \ 21 file://0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch \
22 ${@bb.utils.contains('PACKAGECONFIG', 'mm', '${MM_PATCH}', '', d)} \
18 " 23 "
19 24
20# now we just test bpf and mm (formerly known as vm) 25# now we just test bpf and mm (formerly known as vm)
@@ -35,7 +40,7 @@ PACKAGECONFIG:remove:riscv32 = "bpf"
35 40
36PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," 41PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native,"
37PACKAGECONFIG[firmware] = ",,libcap, bash" 42PACKAGECONFIG[firmware] = ",,libcap, bash"
38PACKAGECONFIG[mm] = ",,libcap, libgcc bash" 43PACKAGECONFIG[mm] = ",,libcap liburing numactl, libgcc bash"
39 44
40do_patch[depends] += "virtual/kernel:do_shared_workdir" 45do_patch[depends] += "virtual/kernel:do_shared_workdir"
41do_compile[depends] += "virtual/kernel:do_install" 46do_compile[depends] += "virtual/kernel:do_install"
diff --git a/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch
new file mode 100644
index 0000000000..a115d56dd1
--- /dev/null
+++ b/meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch
@@ -0,0 +1,76 @@
1From 8f9e6395f1f8121b577eeb4cb54f671a9088bddd Mon Sep 17 00:00:00 2001
2From: Kevin Brodsky <kevin.brodsky@arm.com>
3Date: Thu, 22 Jan 2026 17:02:18 +0000
4Subject: [PATCH] selftests/mm: pass down full CC and CFLAGS to check_config.sh
5
6check_config.sh checks that liburing is available by running the compiler
7provided as its first argument. This makes two assumptions:
8
91. CC consists of only one word
102. No extra flag is required
11
12Unfortunately, there are many situations where these assumptions don't
13hold. For instance:
14
15- When using Clang, CC consists of multiple words
16- When cross-compiling, extra flags may be required to allow the
17 compiler to find headers
18
19Remove these assumptions by passing down CC and CFLAGS as-is from the
20Makefile, so that the same command line is used as when actually building
21the tests.
22
23Link: https://lkml.kernel.org/r/20260122170224.4056513-4-kevin.brodsky@arm.com
24Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
25Reviewed-by: Mark Brown <broonie@kernel.org>
26Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
27Cc: Jason Gunthorpe <jgg@nvidia.com>
28Cc: John Hubbard <jhubbard@nvidia.com>
29Cc: Dev Jain <dev.jain@arm.com>
30Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
31Cc: Paolo Abeni <pabeni@redhat.com>
32Cc: Ryan Roberts <ryan.roberts@arm.com>
33Cc: SeongJae Park <sj@kernel.org>
34Cc: Shuah Khan <shuah@kernel.org>
35Cc: Usama Anjum <Usama.Anjum@arm.com>
36Cc: wang lian <lianux.mm@gmail.com>
37Cc: Yunsheng Lin <linyunsheng@huawei.com>
38Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
39
40Upstream-Status: Backport [from commit 7f532d19c8be7, in tag v7.0]
41
42---
43 tools/testing/selftests/mm/Makefile | 2 +-
44 tools/testing/selftests/mm/check_config.sh | 3 +--
45 2 files changed, 2 insertions(+), 3 deletions(-)
46
47diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
48index ae6f994d3add..fc9b9ec367c3 100644
49--- a/tools/testing/selftests/mm/Makefile
50+++ b/tools/testing/selftests/mm/Makefile
51@@ -228,7 +228,7 @@ $(OUTPUT)/ksm_tests: LDLIBS += -lnuma
52 $(OUTPUT)/migration: LDLIBS += -lnuma
53
54 local_config.mk local_config.h: check_config.sh
55- /bin/sh ./check_config.sh $(CC)
56+ CC="$(CC)" CFLAGS="$(CFLAGS)" ./check_config.sh
57
58 EXTRA_CLEAN += local_config.mk local_config.h
59
60diff --git a/tools/testing/selftests/mm/check_config.sh b/tools/testing/selftests/mm/check_config.sh
61index 3954f4746161..b84c82bbf875 100755
62--- a/tools/testing/selftests/mm/check_config.sh
63+++ b/tools/testing/selftests/mm/check_config.sh
64@@ -16,8 +16,7 @@ echo "#include <sys/types.h>" > $tmpfile_c
65 echo "#include <liburing.h>" >> $tmpfile_c
66 echo "int func(void) { return 0; }" >> $tmpfile_c
67
68-CC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}
69-$CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1
70+$CC $CFLAGS -c $tmpfile_c -o $tmpfile_o
71
72 if [ -f $tmpfile_o ]; then
73 echo "#define LOCAL_CONFIG_HAVE_LIBURING 1" > $OUTPUT_H_FILE
74--
752.47.0
76