Skip to contentSkip to conversation

bpftool,bpftool-native: Separate out native recipe

PATCH New Khem Raj 1 participant 2 messages Sep 6, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 bpftool,bpftool-native: Separate out native recipe

build uses prepared sourcedir for kernel and relying
on target kernel recipe to prepare this is not the correct thing for native package. Since the kernel will need target dependencies cross-compiler etc. to build/prepare the kernel sourcedir

This issue is revealed when bpftool-native is built for riscv64 it ends up in build errors

ERROR: bpftool-native-1.0-r0 do_configure: The sstate manifest for task 'linux-libc-headers:populate_sysroot' (multilib variant '') could not be found. The pkgarchs considered were: qemuriscv64, allarch, x86_64_x86_64-nativesdk.
But none of these manifests exists:
/mnt/b/yoe/master/sources/poky/build/tmp/sstate-control/manifest-qemuriscv64-linux-libc-headers.populate_sysroot /mnt/b/yoe/master/sources/poky/build/tmp/sstate-control/manifest-allarch-linux-libc-headers.populate_sysroot /mnt/b/yoe/master/sources/poky/build/tmp/sstate-control/manifest-x86_64_x86_64-nativesdk-linux-libc-headers.populate_sysroot
ERROR: Logfile of failure stored in: /mnt/b/yoe/master/sources/poky/build/tmp/work/x86_64-linux/bpftool-native/1.0/temp/log.do_configure.2509356

Therefore separate it out into independent recipe and use latest stable kernel to build it.

Enable musl builds as well for bpftool, it works now.

---
 .../{bpftool.bb => bpftool-native_6.16.bb}    | 30 ++++++-------------
 meta-oe/recipes-kernel/bpftool/bpftool.bb     |  3 +-
 2 files changed, 10 insertions(+), 23 deletions(-)
 copy meta-oe/recipes-kernel/bpftool/{bpftool.bb => bpftool-native_6.16.bb} (55%)
meta-oe/recipes-kernel/bpftool/bpftool-native_6.16.bb renamed from meta-oe/recipes-kernel/bpftool/bpftool.bb +9 -21
similarity index 55%
copy from meta-oe/recipes-kernel/bpftool/bpftool.bb
copy to meta-oe/recipes-kernel/bpftool/bpftool-native_6.16.bb
index d19746184c..bc7712ce4d 100644
@@ -2,12 +2,17 @@ SUMMARY = "Inspect and manipulate eBPF programs and maps"
 DESCRIPTION = "bpftool is a kernel tool for inspection and simple manipulation \
 of eBPF programs and maps."
 LICENSE = "GPL-2.0-only"
-DEPENDS = "binutils elfutils elfutils-native"
-PROVIDES = "virtual/bpftool"
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
+UPSTREAM_CHECK_URI = "https://www.kernel.org/"
 
-inherit bash-completion kernelsrc kernel-arch
+DEPENDS = "binutils-native elfutils-native"
 
-do_populate_lic[depends] += "virtual/kernel:do_shared_workdir"
+inherit native bash-completion
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v6.x/linux-${PV}.tar.xz"
+SRC_URI[sha256sum] = "1a4be2fe6b5246aa4ac8987a8a4af34c42a8dd7d08b46ab48516bcc1befbcd83"
+
+S = "${UNPACKDIR}/linux-${PV}"
 
 EXTRA_OEMAKE = "\
     V=1 \
@@ -22,13 +27,6 @@ EXTRA_OEMAKE = "\
     bash_compdir=${prefix}/share/bash-completion \
 "
 
-SECURITY_CFLAGS = ""
-
-do_configure[depends] += "virtual/kernel:do_shared_workdir"
-
-COMPATIBLE_HOST = "(x86_64|aarch64|riscv64).*-linux"
-COMPATIBLE_HOST:libc-musl = 'null'
-
 do_compile() {
     oe_runmake
 }
@@ -37,14 +35,4 @@ do_install() {
     oe_runmake DESTDIR=${D} install
 }
 
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-python do_package:prepend() {
-    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
-}
-
-B = "${WORKDIR}/${BPN}-${PV}"
-
 FILES:${PN} += "${exec_prefix}/sbin/*"
-
-BBCLASSEXTEND = "native nativesdk"
meta-oe/recipes-kernel/bpftool/bpftool.bb +1 -2
index d19746184c..4f4d4a8670 100644
@@ -27,7 +27,6 @@ SECURITY_CFLAGS = ""
 do_configure[depends] += "virtual/kernel:do_shared_workdir"
 
 COMPATIBLE_HOST = "(x86_64|aarch64|riscv64).*-linux"
-COMPATIBLE_HOST:libc-musl = 'null'
 
 do_compile() {
     oe_runmake
@@ -47,4 +46,4 @@ B = "${WORKDIR}/${BPN}-${PV}"
 
 FILES:${PN} += "${exec_prefix}/sbin/*"
 
-BBCLASSEXTEND = "native nativesdk"
+BBCLASSEXTEND = "nativesdk"
author
#1 lore raw

PATCH 2/2 bpftrace: Fix runtime deps and enable musl builds

Remove systemtap from build time dependencies it seems to be not needed and it does not build on musl

---
 .../meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb +1 -2
index 7e9cbf485e..f7b2e7485a 100644
@@ -9,13 +9,13 @@ DEPENDS += "bison-native \
             elfutils \
             bpftool-native \
             bcc \
-            systemtap \
             libcereal \
             libbpf \
             "
 DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native', '', d)}"
 
 RDEPENDS:${PN} += "bash python3 xz"
+RDEPENDS:${PN}-ptest += "bpftool"
 
 SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \
            file://run-ptest \
@@ -63,7 +63,6 @@ EXTRA_OECMAKE = " \
 "
 
 COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux"
-COMPATIBLE_HOST:libc-musl = "null"
 
 INHIBIT_PACKAGE_STRIP_FILES += "\
     ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \