Skip to contentSkip to conversation

perfect support for musl

PATCH In review Hongzhi.Song 2 participants 3 messages Jul 23, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover perfect support for musl

Hi Raj,
I fix the error about musl.
But the error about glibc, "No libelf found", is not reproduced on my side. And I check some argument(e.g. LD) passed to Makefile and the dependency, elfutils. It seems everything is OK.

So, could you build your project with the new recipe and check the relevant dependency if you have time.

Thanks,
// Hongzhi

v3:
add support for musl when build bpf and modify the recipe

Hongzhi.Song (1):
kernel-selftest: add support for musllibc and perfect the recipe

 .../kernel-selftest/kernel-selftest.bb             | 30 ++++++++--------------
 ...bpf-test_progs.c-add-support-for-musllibc.patch | 25 ++++++++++++++++++
 2 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-bpf-test_progs.c-add-support-for-musllibc.patch
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/1 kernel-selftest: add support for musllibc and perfect the recipe

1. Add support for musllibc
2. Use PACKAGECONFIG to add dependency

---
 .../kernel-selftest/kernel-selftest.bb             | 30 ++++++++--------------
 ...bpf-test_progs.c-add-support-for-musllibc.patch | 25 ++++++++++++++++++
 2 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-bpf-test_progs.c-add-support-for-musllibc.patch
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +10 -20
index 2c23b26b5..71e3bf9b0 100644
@@ -5,27 +5,17 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7 \
 "
 
-# vm
-SRC_URI += "file://COPYING \
-"
+# for musl libc
 SRC_URI_libc-musl += "file://userfaultfd.patch \
+                      file://0001-bpf-test_progs.c-add-support-for-musllibc.patch \
 "
 
-# for bpf and vm
-DEPENDS = " \
-    elfutils \
-    libcap \
-    libcap-ng \
-    fuse \
-    util-linux \
-    rsync-native \
-"
-# for vm
-RDEPENDS_${PN} += "libgcc \
-                   bash \
-"
+PACKAGECONFIG ??= "bpf vm"
+
+PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native,"
+PACKAGECONFIG[vm] = ",,,libgcc bash"
 
-do_configure[depends] += "virtual/kernel:do_shared_workdir"
+do_patch[depends] += "virtual/kernel:do_shared_workdir"
 
 inherit linux-kernel-base kernel-arch
 
@@ -69,10 +59,10 @@ do_compile() {
 do_install() {
     for i in ${TEST_LIST}
     do
-        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/opt/kselftest/${i} install
+        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
     done
 
-    chown root:root  -R ${D}/opt/kselftest
+    chown root:root  -R ${D}/usr/kernel-selftest
 }
 
 do_configure() {
@@ -101,4 +91,4 @@ remove_clang_related() {
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 INHIBIT_PACKAGE_DEBUG_SPLIT="1"
-FILES_${PN} += "/opt/kselftest/"
+FILES_${PN} += "/usr/kernel-selftest"
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-bpf-test_progs.c-add-support-for-musllibc.patch new file +25 -0
new file mode 100644
index 000000000..5f2542681
@@ -0,0 +1,25 @@
+From a2e6b8fde28b743b69990a4e16c296e099631ed4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <[email protected]>
+Date: Mon, 23 Jul 2018 00:56:19 -0700
+Subject: [PATCH] bpf: test_progs.c add support for musllibc
+
+Signed-off-by: Hongzhi.Song <[email protected]>
+---
+ 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
+
Signature · 1 line
2.11.0
#2 lore raw

Re: [meta-oe][PATCH v3 1/1] kernel-selftest: add support for musllibc and perfect the recipe

please squash it into prior commit and send
a single commit.

Quoted 103 lines · Hongzhi.Song

1. Add support for musllibc
2. Use PACKAGECONFIG to add dependency

---
 .../kernel-selftest/kernel-selftest.bb             | 30 ++++++++--------------
 ...bpf-test_progs.c-add-support-for-musllibc.patch | 25 ++++++++++++++++++
 2 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-bpf-test_progs.c-add-support-for-musllibc.patch
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +10 -20
index 2c23b26b5..71e3bf9b0 100644
@@ -5,27 +5,17 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7 \
 "
 
-# vm
-SRC_URI += "file://COPYING \
-"
+# for musl libc
 SRC_URI_libc-musl += "file://userfaultfd.patch \
+                      file://0001-bpf-test_progs.c-add-support-for-musllibc.patch \
 "
 
-# for bpf and vm
-DEPENDS = " \
-    elfutils \
-    libcap \
-    libcap-ng \
-    fuse \
-    util-linux \
-    rsync-native \
-"
-# for vm
-RDEPENDS_${PN} += "libgcc \
-                   bash \
-"
+PACKAGECONFIG ??= "bpf vm"
+
+PACKAGECONFIG[bpf] = ",,elfutils libcap libcap-ng rsync-native,"
+PACKAGECONFIG[vm] = ",,,libgcc bash"
 
-do_configure[depends] += "virtual/kernel:do_shared_workdir"
+do_patch[depends] += "virtual/kernel:do_shared_workdir"
 
 inherit linux-kernel-base kernel-arch
 
@@ -69,10 +59,10 @@ do_compile() {
 do_install() {
     for i in ${TEST_LIST}
     do
-        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/opt/kselftest/${i} install
+        oe_runmake -C ${S}/tools/testing/selftests/${i} INSTALL_PATH=${D}/usr/kernel-selftest/${i} install
     done
 
-    chown root:root  -R ${D}/opt/kselftest
+    chown root:root  -R ${D}/usr/kernel-selftest
 }
 
 do_configure() {
@@ -101,4 +91,4 @@ remove_clang_related() {
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 INHIBIT_PACKAGE_DEBUG_SPLIT="1"
-FILES_${PN} += "/opt/kselftest/"
+FILES_${PN} += "/usr/kernel-selftest"
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-bpf-test_progs.c-add-support-for-musllibc.patch new file +25 -1
new file mode 100644
index 000000000..5f2542681
@@ -0,0 +1,25 @@
+From a2e6b8fde28b743b69990a4e16c296e099631ed4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <[email protected]>
+Date: Mon, 23 Jul 2018 00:56:19 -0700
+Subject: [PATCH] bpf: test_progs.c add support for musllibc
+
+Signed-off-by: Hongzhi.Song <[email protected]>
+---
+ 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
+
--

2.11.0