diff options
| -rw-r--r-- | meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb | 7 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch | 76 |
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}" | |||
| 12 | SRC_URI:append:libc-musl = "\ | 12 | SRC_URI:append:libc-musl = "\ |
| 13 | file://userfaultfd.patch \ | 13 | file://userfaultfd.patch \ |
| 14 | " | 14 | " |
| 15 | |||
| 16 | # Fix liburing detection (from Linux v7.0) | ||
| 17 | MM_PATCH = "file://0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch" | ||
| 18 | |||
| 15 | SRC_URI += "file://run-ptest \ | 19 | SRC_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 | ||
| 36 | PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," | 41 | PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native," |
| 37 | PACKAGECONFIG[firmware] = ",,libcap, bash" | 42 | PACKAGECONFIG[firmware] = ",,libcap, bash" |
| 38 | PACKAGECONFIG[mm] = ",,libcap, libgcc bash" | 43 | PACKAGECONFIG[mm] = ",,libcap liburing numactl, libgcc bash" |
| 39 | 44 | ||
| 40 | do_patch[depends] += "virtual/kernel:do_shared_workdir" | 45 | do_patch[depends] += "virtual/kernel:do_shared_workdir" |
| 41 | do_compile[depends] += "virtual/kernel:do_install" | 46 | do_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 @@ | |||
| 1 | From 8f9e6395f1f8121b577eeb4cb54f671a9088bddd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kevin Brodsky <kevin.brodsky@arm.com> | ||
| 3 | Date: Thu, 22 Jan 2026 17:02:18 +0000 | ||
| 4 | Subject: [PATCH] selftests/mm: pass down full CC and CFLAGS to check_config.sh | ||
| 5 | |||
| 6 | check_config.sh checks that liburing is available by running the compiler | ||
| 7 | provided as its first argument. This makes two assumptions: | ||
| 8 | |||
| 9 | 1. CC consists of only one word | ||
| 10 | 2. No extra flag is required | ||
| 11 | |||
| 12 | Unfortunately, there are many situations where these assumptions don't | ||
| 13 | hold. 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 | |||
| 19 | Remove these assumptions by passing down CC and CFLAGS as-is from the | ||
| 20 | Makefile, so that the same command line is used as when actually building | ||
| 21 | the tests. | ||
| 22 | |||
| 23 | Link: https://lkml.kernel.org/r/20260122170224.4056513-4-kevin.brodsky@arm.com | ||
| 24 | Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> | ||
| 25 | Reviewed-by: Mark Brown <broonie@kernel.org> | ||
| 26 | Acked-by: David Hildenbrand (Red Hat) <david@kernel.org> | ||
| 27 | Cc: Jason Gunthorpe <jgg@nvidia.com> | ||
| 28 | Cc: John Hubbard <jhubbard@nvidia.com> | ||
| 29 | Cc: Dev Jain <dev.jain@arm.com> | ||
| 30 | Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> | ||
| 31 | Cc: Paolo Abeni <pabeni@redhat.com> | ||
| 32 | Cc: Ryan Roberts <ryan.roberts@arm.com> | ||
| 33 | Cc: SeongJae Park <sj@kernel.org> | ||
| 34 | Cc: Shuah Khan <shuah@kernel.org> | ||
| 35 | Cc: Usama Anjum <Usama.Anjum@arm.com> | ||
| 36 | Cc: wang lian <lianux.mm@gmail.com> | ||
| 37 | Cc: Yunsheng Lin <linyunsheng@huawei.com> | ||
| 38 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | ||
| 39 | |||
| 40 | Upstream-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 | |||
| 47 | diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile | ||
| 48 | index 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 | |||
| 60 | diff --git a/tools/testing/selftests/mm/check_config.sh b/tools/testing/selftests/mm/check_config.sh | ||
| 61 | index 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 | -- | ||
| 75 | 2.47.0 | ||
| 76 | |||
