kernel-selftest: Fix build on musl

* (Depends upon a linux-libc-headers patch proposed to oe-core)
* Delete unused patch
* Mark Clang 6.0 as minimum required version
* Do not hardcode python3 interpreter path

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Hongzhi.Song <hongzhi.song@windriver.com>
Cc: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Khem Raj
2018-09-12 10:11:13 -07:00
parent e6d2fc45e5
commit 6e9c34d6a1
3 changed files with 5 additions and 54 deletions
@@ -9,7 +9,6 @@ DEPENDS = "rsync-native"
# for musl libc
SRC_URI_append_libc-musl = "\
file://userfaultfd.patch \
file://0001-bpf-test_progs.c-add-support-for-musllibc.patch \
"
SRC_URI += "file://run-ptest \
file://COPYING \
@@ -62,7 +61,7 @@ python __anonymous () {
}
do_compile() {
bbwarn "clang with bpf support is needed with kernel 4.18+ so \
bbwarn "clang >= 6.0 with bpf support is needed with kernel 4.18+ so \
either install it and add it to HOSTTOOLS, or add \
clang-native from meta-clang to dependency"
for i in ${TEST_LIST}
@@ -76,7 +75,9 @@ do_install() {
do
oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
done
if [ -e ${D}/usr/kernel-selftest/bpf/test_offload.py ]; then
sed -i -e '1s,#!.*python3,#! /usr/bin/env python3,' ${D}/usr/kernel-selftest/bpf/test_offload.py
fi
chown root:root -R ${D}/usr/kernel-selftest
}
@@ -115,5 +116,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
INHIBIT_PACKAGE_DEBUG_SPLIT="1"
FILES_${PN} += "/usr/kernel-selftest"
RDEPENDS_${PN} += "python3"
# tools/testing/selftests/vm/Makefile doesn't respect LDFLAGS and tools/testing/selftests/Makefile explicitly overrides to empty
INSANE_SKIP_${PN} += "ldflags"
@@ -1,25 +0,0 @@
From a2e6b8fde28b743b69990a4e16c296e099631ed4 Mon Sep 17 00:00:00 2001
From: "Hongzhi.Song" <hongzhi.song@windriver.com>
Date: Mon, 23 Jul 2018 00:56:19 -0700
Subject: [PATCH] bpf: test_progs.c add support for musllibc
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
tools/testing/selftests/bpf/test_progs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 11ee25c..21b27b7 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -4,6 +4,7 @@
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*/
+#define __always_inline __inline __attribute__ ((__always_inline__))
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
--
2.11.0
@@ -1,26 +0,0 @@
From c21dfb0dfdfec281479e267ad7fe9a8d4ba15a70 Mon Sep 17 00:00:00 2001
From: "Hongzhi.Song" <hongzhi.song@windriver.com>
Date: Tue, 17 Jul 2018 23:47:48 -0700
Subject: [PATCH] add micro define to support musl libc
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
recipe-sysroot/usr/include/linux/swab.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/recipe-sysroot/usr/include/linux/swab.h b/recipe-sysroot/usr/include/linux/swab.h
index afb7eb7..33efa10 100644
--- a/recipe-sysroot/usr/include/linux/swab.h
+++ b/recipe-sysroot/usr/include/linux/swab.h
@@ -6,6 +6,8 @@
#include <asm/swab.h>
+#define __always_inline __inline __attribute__ ((__always_inline__))
+
/*
* casts are necessary for constants, because we never know how for sure
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
--
2.11.0