package/llvm: add BPF backend
PATCH v6 1/5 package/llvm: add BPF backend
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.
BCC requires enabling LLVM backend BPF support.
--- package/llvm/Config.in | 6 ++++++ package/llvm/llvm.mk | 5 +++++ 2 files changed, 11 insertions(+)
package/llvm/Config.in +6 -0
@@ -47,6 +47,12 @@ config BR2_PACKAGE_LLVM_RTTI https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html +config BR2_PACKAGE_LLVM_BPF + bool "BPF backend" + help + Build BPF target. Select this option if you are going + to install bcc on the target. + endif comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
package/llvm/llvm.mk +5 -0
@@ -61,6 +61,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) LLVM_TARGETS_TO_BUILD += AMDGPU endif +# Build BPF backend +ifeq ($(BR2_PACKAGE_LLVM_BPF),y) +LLVM_TARGETS_TO_BUILD += BPF +endif + # Use native llvm-tblgen from host-llvm (needed for cross-compilation) LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen
Signature · 1 line
2.25.4
PATCH v6 2/5 package/bcc: new package
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.
bcc can help to troubleshoot issues quickly on
embedded systems (as long as Linux kernel
version >= 4.1).
bcc can also make it easy to create observabilty tools, SDN configuration, ddos mitigation, intrusion detection and secure containers. More information is available at:
https://ebpf.io/
BCC can be tested on the target :
$ mount -t debugfs none /sys/kernel/debug $ cd /usr/share/bcc/tools $ ./execsnoop
---
v6
- Add missing python patch from Qais
- remove luajit patch since the luajit support is explicitely disabled
- keep tested-by from Qais since he tested bcc (but not the luajit support)
- drop the reviewed-by due to luajit and python changes
- Add Romain in DEVELOPERS file
v5
- Add a patch to disable luajit support
- remove iperf3, netperf, audit optional runtime dependencies (Qais)
v4
- Bump to version 0.17.0.
- Remove kernel dependency (Qais)
- Remove optional kernel option handling (Quais)
- Update ebpf url (Quais)
- Fix tools path in the commit log (Quais)
- Add full tar dependency (used to extract the kernel sources from IKHEADERS module) (Quais)
- Make luajit optional dependeny (Quais)
- Remove python module install hook (Quais)
- Keep BCC_LINUX_CONFIG_FIXUPS but only for kernel built by Buildroot.
V3
- Bump to version 0.16.0.
- Add required python dependency.
- Remove unnecessary and duplicated
kernel flags (#Testing section) in bcc.mk.
V2
- Add eBPF's required Kernel flags.
- Fix submodule source fetch problem.
- Add toolchain dependency.
--- DEVELOPERS | 2 + package/Config.in | 1 + ...-an-option-to-disable-luajit-support.patch | 45 +++++++++++++++++++ ...sts.txt-Fix-python-installation-path.patch | 34 ++++++++++++++ package/bcc/Config.in | 39 ++++++++++++++++ package/bcc/bcc.hash | 3 ++ package/bcc/bcc.mk | 43 ++++++++++++++++++ 7 files changed, 167 insertions(+) create mode 100644 package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch create mode 100644 package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch create mode 100644 package/bcc/Config.in create mode 100644 package/bcc/bcc.hash create mode 100644 package/bcc/bcc.mk
DEVELOPERS +2 -0
@@ -1392,6 +1392,7 @@ N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/ N: Jugurtha BELKALEM <[email protected]> +F: package/bcc/ F: package/python-aiofiles/ F: package/python-crayons/ F: package/python-cycler/
@@ -2233,6 +2234,7 @@ F: board/qemu/ F: configs/qemu_* F: package/alure/ F: package/aubio/ +F: package/bcc/ F: package/binutils/ F: package/bullet/ F: package/clang/
package/Config.in +1 -0
@@ -83,6 +83,7 @@ endmenu menu "Debugging, profiling and benchmark" source "package/babeltrace2/Config.in" + source "package/bcc/Config.in" source "package/blktrace/Config.in" source "package/bonnie/Config.in" source "package/cache-calibrator/Config.in"
package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch new file +45 -0
45 lines not on this page · raw message
package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 15d8445905b6023eb369083392dd1018d31e9664 Mon Sep 17 00:00:00 2001 +From: Qais Yousef <[email protected]> +Date: Fri, 18 Dec 2020 16:36:15 +0000 +Subject: [PATCH] python/CMakeLists.txt: Fix python installation path + +The check for /etc/debian_version is unfriendly to cross build +environment like buildroot. It tries to identify the distro of the host, +but since we're in cross build environment this obviously breaks. + +Remove this check for now. + +Signed-off-by: Qais Yousef <[email protected]> +--- + src/python/CMakeLists.txt | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt +index fa602397..797e0d14 100644 +--- a/src/python/CMakeLists.txt ++++ b/src/python/CMakeLists.txt +@@ -5,10 +5,6 @@ if(NOT PYTHON_CMD) + set(PYTHON_CMD "python") + endif() + +-if(EXISTS "/etc/debian_version") +- set(PYTHON_FLAGS "${PYTHON_FLAGS} --install-layout deb") +-endif() +- + file(GLOB_RECURSE PYTHON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/*.py) + file(GLOB_RECURSE PYTHON_INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} +-- +2.25.1 +
package/bcc/Config.in new file +39 -0
@@ -0,0 +1,39 @@ +config BR2_PACKAGE_BCC + bool "bcc" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_USES_GLIBC # hardcode GNU tuple (x86_64-unknown-linux-gnu) + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # clang + depends on BR2_INSTALL_LIBSTDCPP # clang + select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # to select tar package + select BR2_PACKAGE_CLANG + select BR2_PACKAGE_ELFUTILS + select BR2_PACKAGE_FLEX # needs FlexLexer.h + select BR2_PACKAGE_LLVM_BPF + select BR2_PACKAGE_PYTHON3 + select BR2_PACKAGE_TAR # Decompress kernel headers required by BCC + help + BPF Compiler Collection (BCC) + + BCC is a toolkit for creating efficient kernel tracing and + manipulation programs, and includes several useful tools and + examples. It makes use of extended BPF (Berkeley Packet + Filters), formally known as eBPF, a new feature that was + first added to Linux 3.15. Much of what BCC uses requires + Linux 4.1 and above. + + Note: Before using bcc, you need either need to : + - For kernel_ver = [4.1, 5.2) : Copy kernel source code + to target folder /lib/module/<kernel_ver>/build. + - Or kernel_ver >= 5.2 : Compile kernel with CONFIG_IKHEADERS + and use generated headers under /sys/kernel/kheaders.tar.xz + to populate /lib/module/<kernel_ver>/build. + + That's because the clang frontend build eBPF code at runtime. + + https://github.com/iovisor/bcc + http://www.ebpf.io + +comment "bcc needs a glibc toolchain, C++, gcc >= 4.8, host gcc >= 4.8" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
package/bcc/bcc.hash new file +3 -0
@@ -0,0 +1,3 @@ +# locally calculated +sha256 7a3ef28a493dcd7ee0797ebca8f13b30ffca08efc93ff73ff8fa9ba0234d7947 bcc-v0.17.0.tar.gz +sha256 b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1 LICENSE.txt
package/bcc/bcc.mk new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.25.4
PATCH v6 2/5 package/bcc: new package
Quoted 25 lines · Romain Naour
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.bcc can help to troubleshoot issues quickly on
embedded systems (as long as Linux kernel
version >= 4.1).bcc can also make it easy to create observabilty tools, SDN configuration, ddos mitigation, intrusion detection and secure containers. More information is available at:
https://ebpf.io/BCC can be tested on the target :
$ mount -t debugfs none /sys/kernel/debug $ cd /usr/share/bcc/tools $ ./execsnoopSigned-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Tested-by Qais Yousef <[email protected]>Cc Qais Yousef <[email protected]>
Quoted 7 lines
---
v6
- Add missing python patch from Qais
- remove luajit patch since the luajit support is explicitely disabled
- keep tested-by from Qais since he tested bcc (but not the luajit support)
- drop the reviewed-by due to luajit and python changes
- Add Romain in DEVELOPERS file
Thanks!
--
Qais Yousef
PATCH v6 2/5 package/bcc: new package
In reply to Romain NaourI still have comments and it's a bit too much to fix up while applying :-(
Quoted 16 lines · Romain Naour
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.bcc can help to troubleshoot issues quickly on
embedded systems (as long as Linux kernel
version >= 4.1).bcc can also make it easy to create observabilty tools, SDN configuration, ddos mitigation, intrusion detection and secure containers. More information is available at:
https://ebpf.io/
Quoted 4 lines
BCC can be tested on the target :
$ mount -t debugfs none /sys/kernel/debug $ cd /usr/share/bcc/tools $ ./execsnoop
It would be nice to create a runtime test that does exactly this!
Quoted 93 lines
Signed-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Tested-by Qais Yousef <[email protected]>Cc Qais Yousef <[email protected]>---
v6
- Add missing python patch from Qais
- remove luajit patch since the luajit support is explicitely disabled
- keep tested-by from Qais since he tested bcc (but not the luajit support)
- drop the reviewed-by due to luajit and python changes
- Add Romain in DEVELOPERS filev5
- Add a patch to disable luajit support
- remove iperf3, netperf, audit optional runtime dependencies (Qais)v4
- Bump to version 0.17.0.
- Remove kernel dependency (Qais)
- Remove optional kernel option handling (Quais)
- Update ebpf url (Quais)
- Fix tools path in the commit log (Quais)
- Add full tar dependency (used to extract the kernel sources from IKHEADERS module) (Quais)
- Make luajit optional dependeny (Quais)
- Remove python module install hook (Quais)
- KeepBCC_LINUX_CONFIG_FIXUPSbut only for kernel built by Buildroot.V3
- Bump to version 0.16.0.
- Add required python dependency.
- Remove unnecessary and duplicated
kernel flags (#Testing section) in bcc.mk.V2
- Add eBPF's required Kernel flags.
- Fix submodule source fetch problem.
- Add toolchain dependency.--- DEVELOPERS | 2 + package/Config.in | 1 + ...-an-option-to-disable-luajit-support.patch | 45 +++++++++++++++++++ ...sts.txt-Fix-python-installation-path.patch | 34 ++++++++++++++ package/bcc/Config.in | 39 ++++++++++++++++ package/bcc/bcc.hash | 3 ++ package/bcc/bcc.mk | 43 ++++++++++++++++++ 7 files changed, 167 insertions(+) create mode 100644 package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch create mode 100644 package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch create mode 100644 package/bcc/Config.in create mode 100644 package/bcc/bcc.hash create mode 100644 package/bcc/bcc.mkDEVELOPERS +2
-0@@ -1392,6 +1392,7 @@ N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/ N: Jugurtha BELKALEM <[email protected]> +F: package/bcc/ F: package/python-aiofiles/ F: package/python-crayons/ F: package/python-cycler/@@ -2233,6 +2234,7 @@ F: board/qemu/ F: configs/qemu_* F: package/alure/ F: package/aubio/ +F: package/bcc/ F: package/binutils/ F: package/bullet/ F: package/clang/package/Config.in +1
-0@@ -83,6 +83,7 @@ endmenu menu "Debugging, profiling and benchmark" source "package/babeltrace2/Config.in" + source "package/bcc/Config.in" source "package/blktrace/Config.in" source "package/bonnie/Config.in" source "package/cache-calibrator/Config.in"package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch new file +2
-0@@ -0,0 +1,45 @@ +From b61c5eb0b2c385a6d3bbabf2396cb363588b32ab Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]>
package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch line 12
Quoted 10 lines
package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch new file +10
-0+Date: Sun, 6 Dec 2020 17:15:25 +0100 +Subject: [PATCH] CMake: add an option to disable luajit support + +bcc luajit support is optional and should be disabled +when luajit is not available. + +This option allow to explicitely disable luajit when +cross-compiling. + +Signed-off-by: Romain Naour <[email protected]>
Was this patch sent upstream?
Quoted 40 lines
package/bcc/0001-CMake-add-an-option-to-disable-luajit-support.patch new file +32
-0+--- + CMakeLists.txt | 2 ++ + src/CMakeLists.txt | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74fe4f19..c87b28c4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,6 +40,8 @@ option(ENABLE_LLVM_SHARED "Enable linking LLVM as a shared library" OFF) + option(ENABLE_CLANG_JIT "Enable Loading BPF through Clang Frontend" ON) + option(ENABLE_USDT "Enable User-level Statically Defined Tracing" ON) + option(ENABLE_MAN "Build man pages" ON) ++cmake_dependent_option(ENABLE_LUAJIT "Use Luajit" ON "ENABLE_CLANG_JIT" OFF) ++ + CMAKE_DEPENDENT_OPTION(ENABLE_CPP_API "Enable C++ API" ON "ENABLE_USDT" OFF) + + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 37b7e289..78c5fe58 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -17,5 +17,7 @@ add_subdirectory(cc) + endif() + if(ENABLE_CLANG_JIT) + add_subdirectory(python) ++if(ENABLE_LUAJIT) + add_subdirectory(lua) + endif() ++endif()> +-- +2.25.4 +package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch new file +2
-0@@ -0,0 +1,34 @@ +From 15d8445905b6023eb369083392dd1018d31e9664 Mon Sep 17 00:00:00 2001 +From: Qais Yousef <[email protected]>
package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch line 12
Quoted 10 lines
package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch new file +10
-0+Date: Fri, 18 Dec 2020 16:36:15 +0000 +Subject: [PATCH] python/CMakeLists.txt: Fix python installation path + +The check for /etc/debian_version is unfriendly to cross build +environment like buildroot. It tries to identify the distro of the host, +but since we're in cross build environment this obviously breaks. + +Remove this check for now. + +Signed-off-by: Qais Yousef <[email protected]>
Was this patch sent upstream? Or was an issue created?
Quoted 28 lines
package/bcc/0002-python-CMakeLists.txt-Fix-python-installation-path.patch new file +22
-0+--- + src/python/CMakeLists.txt | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt +index fa602397..797e0d14 100644 +--- a/src/python/CMakeLists.txt ++++ b/src/python/CMakeLists.txt +@@ -5,10 +5,6 @@ if(NOT PYTHON_CMD) + set(PYTHON_CMD "python") + endif() + +-if(EXISTS "/etc/debian_version") +- set(PYTHON_FLAGS "${PYTHON_FLAGS} --install-layout deb") +-endif() +- + file(GLOB_RECURSE PYTHON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/*.py) + file(GLOB_RECURSE PYTHON_INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} +-- +2.25.1 +package/bcc/Config.in new file +0
-0
package/bcc/Config.in line 7
Quoted 7 lines
package/bcc/Config.in new file +7
-0@@ -0,0 +1,39 @@ +config BR2_PACKAGE_BCC + bool "bcc" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_USES_GLIBC # hardcode GNU tuple (x86_64-unknown-linux-gnu) + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # clang + depends on BR2_INSTALL_LIBSTDCPP # clang + select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # to select tar package
Busybox tar is not sufficient? Why not? Is it for xz support?
package/bcc/Config.in line 8
Quoted 1 line
package/bcc/Config.in new file +1
-0+ select BR2_PACKAGE_CLANG
You didn't propagate
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
package/bcc/Config.in line 11
Quoted 3 lines
package/bcc/Config.in new file +3
-0+ select BR2_PACKAGE_ELFUTILS + select BR2_PACKAGE_FLEX # needs FlexLexer.h + select BR2_PACKAGE_LLVM_BPF
This looks weird because it depends on LLVM. It's implicit through clang, of
course, but still I think we should have select BR2_PACKAGE_LLVM as well.
package/bcc/Config.in line 12
Quoted 1 line
package/bcc/Config.in new file +1
-0+ select BR2_PACKAGE_PYTHON3
Isn't python optional on ENABLE_CLANG_JIT?
You didn't propagate python3's dependencies. Most are implied by glibc, but the
glibc constraint may go away in the future, and it does not include the MMU dependency.
package/bcc/Config.in line 13
Quoted 1 line
package/bcc/Config.in new file +1
-0+ select BR2_PACKAGE_TAR # Decompress kernel headers required by BCC
Isn't this a runtime dependency? tar doesn't install to staging so it's
unlikely to be a build-time dependency.
Quoted 8 lines
package/bcc/Config.in new file +8
-0+ help + BPF Compiler Collection (BCC) + + BCC is a toolkit for creating efficient kernel tracing and + manipulation programs, and includes several useful tools and + examples. It makes use of extended BPF (Berkeley Packet + Filters), formally known as eBPF, a new feature that was + first added to Linux 3.15. Much of what BCC uses requires
package/bcc/Config.in line 31
Quoted 10 lines
package/bcc/Config.in new file +10
-0+ Linux 4.1 and above. + + Note: Before using bcc, you need either need to : + - For kernel_ver = [4.1, 5.2) : Copy kernel source code + to target folder /lib/module/<kernel_ver>/build. + - Or kernel_ver >= 5.2 : Compile kernel with CONFIG_IKHEADERS + and use generated headers under /sys/kernel/kheaders.tar.xz + to populate /lib/module/<kernel_ver>/build. + + That's because the clang frontend build eBPF code at runtime.
builds
package/bcc/Config.in line 36
Quoted 5 lines
package/bcc/Config.in new file +5
-0+ + https://github.com/iovisor/bcc + http://www.ebpf.io + +comment "bcc needs a glibc toolchain, C++, gcc >= 4.8, host gcc >= 4.8"
There's no host gcc dependency...
Quoted 18 lines
package/bcc/Config.in new file +3
-0+ depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8package/bcc/bcc.hash new file +3
-0@@ -0,0 +1,3 @@ +# locally calculated +sha256 7a3ef28a493dcd7ee0797ebca8f13b30ffca08efc93ff73ff8fa9ba0234d7947 bcc-v0.17.0.tar.gz +sha256 b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1 LICENSE.txtpackage/bcc/bcc.mk new file +0
-0
package/bcc/bcc.mk line 10
Quoted 10 lines
package/bcc/bcc.mk new file +10
-0@@ -0,0 +1,43 @@ +################################################################################ +# +# bcc +# +################################################################################ + +BCC_VERSION = v0.17.0 +BCC_SITE = https://github.com/iovisor/bcc.git +BCC_SITE_METHOD = git +BCC_GIT_SUBMODULES = YES
Can't the tarball be used?
https://github.com/iovisor/bcc/releases/download/v0.17.0/bcc-src-with-submodule.tar.gz
package/bcc/bcc.mk line 13
Quoted 3 lines
package/bcc/bcc.mk new file +3
-0+BCC_LICENSE = Apache-2.0 +BCC_LICENSE_FILES = LICENSE.txt +# libbcc.so and libbcc_bpf.so
This comment is not very useful - you'd normally put that in the commit message.
However, if it's just .so files, then that's normally not a reason to install
it in staging. Staging is for when another package can have a build-time dependency on it. Typically, that implies headers as well as a library.
package/bcc/bcc.mk line 15
Quoted 2 lines
package/bcc/bcc.mk new file +2
-0+BCC_INSTALL_STAGING = YES +BCC_DEPENDENCIES = host-bison host-flex clang elfutils flex llvm python3 tar
So I'm surprised to see tar here.
package/bcc/bcc.mk line 19
Quoted 4 lines
package/bcc/bcc.mk new file +4
-0+ +# ENABLE_LLVM_SHARED=ON to use llvm.so. +# Force REVISION otherwise bcc will use git describe to generate a version number. +BCC_CONF_OPTS = -DENABLE_LLVM_SHARED=ON \
If the line is split, prefer to do it like this:
BCC_CONF_OPTS = \ -DENABLE_LLVM_SHARED=ON \
Regards,
Arnout
Quoted 25 lines
package/bcc/bcc.mk new file +24
-0+ -DREVISION=$(BCC_VERSION) \ + -DENABLE_CLANG_JIT=ON \ + -DENABLE_MAN=OFF \ + -DENABLE_LUAJIT=OFF + +define BCC_LINUX_CONFIG_FIXUPS + # Enable kernel support for eBPF + $(call KCONFIG_ENABLE_OPT,CONFIG_BPF) + $(call KCONFIG_ENABLE_OPT,CONFIG_BPF_SYSCALL) + $(call KCONFIG_ENABLE_OPT,CONFIG_NET_CLS_BPF) + $(call KCONFIG_ENABLE_OPT,CONFIG_NET_ACT_BPF) + $(call KCONFIG_ENABLE_OPT,CONFIG_BPF_JIT) + # [for Linux kernel versions 4.1 through 4.6] + $(call KCONFIG_ENABLE_OPT,CONFIG_HAVE_BPF_JIT) + # [for Linux kernel versions 4.7 and later] + $(call KCONFIG_ENABLE_OPT,CONFIG_HAVE_EBPF_JIT) + $(call KCONFIG_ENABLE_OPT,CONFIG_BPF_EVENTS) + # [for Linux kernel versions 5.2 and later] + $(call KCONFIG_ENABLE_OPT,CONFIG_IKHEADERS) + # bcc needs debugfs at runtime + $(call KCONFIG_ENABLE_OPT,CONFIG_DEBUG_FS) +endef + +$(eval $(cmake-package))
PATCH v6 2/5 package/bcc: new package
Quoted 5 lines · Arnout Vandecappelle
Quoted 4 lines
BCC can be tested on the target :
$ mount -t debugfs none /sys/kernel/debug $ cd /usr/share/bcc/tools $ ./execsnoopIt would be nice to create a runtime test that does exactly this!
Such a runtime test should build the kernel itself (with a minimal config),
because that way we test if the KCONFIG_ENABLE_OPT calls are correct.
Regards,
Arnout
PATCH v6 3/5 package/libbpf: new package
In reply to Romain NaourA mirror of bpf-next linux tree bpf-next/tools/lib/bpf directory plus its supporting header files. The version of the package reflects the version of ABI.
---
I'm not sure if updating the bpf.h provided by the toolchain linux-headers is the right things to do.
v6: Update DEVELOPERS file
--- DEVELOPERS | 1 + package/Config.in | 1 + package/libbpf/Config.in | 20 ++++++++++++++++++++ package/libbpf/libbpf.mk | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 package/libbpf/Config.in create mode 100644 package/libbpf/libbpf.mk
DEVELOPERS +1 -0
@@ -2249,6 +2249,7 @@ F: package/glibc/ F: package/irrlicht/ F: package/liblinear/ F: package/lensfun/ +F: package/libbpf/ F: package/libclc/ F: package/libgta/ F: package/libspatialindex/
package/Config.in +1 -0
@@ -107,6 +107,7 @@ menu "Debugging, profiling and benchmark" source "package/kvm-unit-tests/Config.in" source "package/kyua/Config.in" source "package/latencytop/Config.in" + source "package/libbpf/Config.in" source "package/lmbench/Config.in" source "package/lsof/Config.in" source "package/ltp-testsuite/Config.in"
package/libbpf/Config.in new file +20 -0
@@ -0,0 +1,20 @@ +config BR2_PACKAGE_LIBBPF + bool "libbpf" + depends on BR2_USE_WCHAR # elfutils + depends on !BR2_STATIC_LIBS # elfutils + depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils + depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils + select BR2_PACKAGE_ELFUTILS + select BR2_PACKAGE_ZLIB + help + libbpf library. + A mirror of bpf-next linux tree bpf-next/tools/lib/bpf + directory plus its supporting header files. The version + of the package reflects the version of ABI. + + https://github.com/libbpf/libbpf + +comment "libbpf needs a uClibc or glibc toolchain w/ wchar, dynamic library, threads" + depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \ + || !BR2_TOOLCHAIN_HAS_THREADS \ + || !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
package/libbpf/libbpf.mk new file +40 -0
@@ -0,0 +1,40 @@ +################################################################################ +# +# libbpf +# +################################################################################ + +LIBBPF_VERSION = 0.2 +LIBBPF_SITE = $(call github,libbpf,libbpf,v$(LIBBPF_VERSION)) +LIBBPF_LICENSE = GPL-2.0, LGPL-2.1, BSD-2-Clause +LIBBPF_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.LPGL-2.1 +LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf elfutils zlib +LIBBPF_INSTALL_STAGING = YES + +define LIBBPF_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D)/src +endef + +# bpf/bpf.h installed by libbpf use enm bpf_iter_link_info that was added since +# kernel 5.9, so we need to update some uapi headers in STAGING_DIR if the +# toolchain is build with linux-headers < 5.9. +# Otherwise bpf/bpf.h is broken due to out of date linux/bpf.h installed by the +# toolchain. +# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a5cbe05a6673b85bed2a63ffcfea6a96c6410cff +ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_9),) +LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers +endif + +define LIBBPF_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D)/src install $(LIBBPF_UPDATE_UAPI_HEADERS) \ + DESTDIR=$(STAGING_DIR) +endef + +define LIBBPF_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D)/src install DESTDIR=$(TARGET_DIR) +endef + +$(eval $(generic-package))
Signature · 1 line
2.25.4
PATCH v6 3/5 package/libbpf: new package
Quoted 4 lines · Romain Naour
A mirror of bpf-next linux tree bpf-next/tools/lib/bpf directory plus its supporting header files. The version of the package reflects the version of ABI.
Quoted 8 lines
Signed-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Qais Yousef <[email protected]>---
I'm not sure if updating thebpf.hprovided by the toolchain linux-headers is the right things to do.v6: Update DEVELOPERS file
LGTM.
Thanks
--
Qais Yousef
Arnout Vandecappelle
AppliedPATCH v6 3/5 package/libbpf: new package
In reply to Romain NaourQuoted 11 lines · Romain Naour
A mirror of bpf-next linux tree bpf-next/tools/lib/bpf directory plus its supporting header files. The version of the package reflects the version of ABI.
Signed-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Qais Yousef <[email protected]>---
I'm not sure if updating thebpf.hprovided by the toolchain linux-headers is the right things to do.
Quoted 6 lines
v6: Update DEVELOPERS file
--- DEVELOPERS | 1 + package/Config.in | 1 + package/libbpf/Config.in | 20 ++++++++++++++++++++ package/libbpf/libbpf.mk | 40 ++++++++++++++++++++++++++++++++++++++++
hash file is missing.
Quoted 4 lines
4 files changed, 62 insertions(+) create mode 100644 package/libbpf/Config.in create mode 100644 package/libbpf/libbpf.mk
[snip]
Quoted 1 line
+#
bpf/bpf.hinstalled by libbpf use enmbpf_iter_link_infothat was added since
I don't know what you meant with "enm", so I just removed it.
Applied to next with those two fixes, thanks.
Regards,
Arnout
Quoted 22 lines
package/libbpf/libbpf.mk new file +21
-0+# kernel 5.9, so we need to update some uapi headers in STAGING_DIR if the +# toolchain is build with linux-headers < 5.9. +# Otherwise bpf/bpf.h is broken due to out of date linux/bpf.h installed by the +# toolchain. +# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a5cbe05a6673b85bed2a63ffcfea6a96c6410cff +ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_9),) +LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers +endif + +define LIBBPF_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D)/src install $(LIBBPF_UPDATE_UAPI_HEADERS) \ + DESTDIR=$(STAGING_DIR) +endef + +define LIBBPF_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D)/src install DESTDIR=$(TARGET_DIR) +endef + +$(eval $(generic-package))
PATCH v6 4/5 package/bpftrace: new package
In reply to Romain NaourFrom: Qais Yousef <[email protected]>
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x).
Only tested on x86_64 and aarch64. The package doesn't support i386 and aarch32.
The libbpf dependency allow to enable the BTF support:
# bpftrace --info System OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020 Arch: aarch64
Build
version: 2020.11-328-g019a9
LLVM: 9.0.1
foreach_sym: yes
unsafe uprobe: no
bfd: yes
bpf_attach_kfunc: yes
bcc_usdt_addsem: yes
bcc bpf_attach_uprobe refcount: yes
libbpf: yes
libbpf btf dump: yes
libbpf btf dump type decl: yes
bfptrace doesn't use the libbpf_bcc library provided by bcc package.
---
v6: Update DEVELOPERS file
v2: patch to build bundled libraries statically
Add glibc dependency
Rework to select bcc, libbpf and llvm RTII dependencies. Add reverse dependencies
Add BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS
Bump the version to the latest (upcoming 0.12)
due to many build issues (and patch to backport) with the latest release.
Add binutils optional dependency to provide libbfd and libopcodes. Disable manpages.
--- DEVELOPERS | 4 ++ package/Config.in | 1 + ...resources-parser-as-static-libraries.patch | 71 +++++++++++++++++++ package/bpftrace/Config.in | 40 +++++++++++ package/bpftrace/bpftrace.hash | 3 + package/bpftrace/bpftrace.mk | 21 ++++++ 6 files changed, 140 insertions(+) create mode 100644 package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch create mode 100644 package/bpftrace/Config.in create mode 100644 package/bpftrace/bpftrace.hash create mode 100644 package/bpftrace/bpftrace.mk
DEVELOPERS +4 -0
@@ -2159,6 +2159,9 @@ F: package/libdvbpsi/ F: package/mraa/ F: package/synergy/ +N: Qais Yousef <[email protected]> +F: package/bpftrace/ + N: Rafal Susz <[email protected]> F: board/avnet/s6lx9_microboard/ F: configs/s6lx9_microboard_defconfig
@@ -2236,6 +2239,7 @@ F: package/alure/ F: package/aubio/ F: package/bcc/ F: package/binutils/ +F: package/bpftrace/ F: package/bullet/ F: package/clang/ F: package/clinfo/
package/Config.in +1 -0
@@ -86,6 +86,7 @@ menu "Debugging, profiling and benchmark" source "package/bcc/Config.in" source "package/blktrace/Config.in" source "package/bonnie/Config.in" + source "package/bpftrace/Config.in" source "package/cache-calibrator/Config.in" source "package/clinfo/Config.in" source "package/dacapo/Config.in"
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch new file +71 -0
71 lines not on this page · raw message
package/bpftrace/Config.in new file +40 -0
@@ -0,0 +1,40 @@ +config BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 || BR2_aarch64_be + default y if BR2_x86_64 + +config BR2_PACKAGE_BPFTRACE + bool "bpftrace" + depends on BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # bcc + depends on BR2_TOOLCHAIN_USES_GLIBC # bcc + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # bcc, clang + depends on BR2_INSTALL_LIBSTDCPP # bcc, clang + select BR2_PACKAGE_BCC + select BR2_PACKAGE_LIBBPF + # LLVM RTTI mendatory: https://github.com/iovisor/bpftrace/issues/1156 + select BR2_PACKAGE_LLVM_RTTI + help + bpftrace is a high-level tracing language for Linux enhanced + Berkeley Packet Filter (eBPF) available in recent Linux + kernels (4.x). + + bpftrace uses LLVM as a backend to compile scripts to + BPF-bytecode and makes use of BCC for interacting with the + Linux BPF system, as well as existing Linux tracing + capabilities: kernel dynamic tracing (kprobes), user-level + dynamic tracing (uprobes), and tracepoints. The bpftrace + language is inspired by awk and C, and predecessor tracers + such as DTrace and SystemTap. + + It's highly recommended to NOT strip bpftrace binary. + To do so, add "bpftrace" to BR2_STRIP_EXCLUDE_FILES. + See: + https://bugzilla.redhat.com/show_bug.cgi?id=1865787 + + https://www.github.com/iovisor/bpftrace + +comment "bpftrace needs a glibc toolchain w/ C++, gcc >= 4.8" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
package/bpftrace/bpftrace.hash new file +3 -0
@@ -0,0 +1,3 @@ +# locally calculated +sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE +sha256 1f08661bac9dfa7d3d76b54b3b4d1738b02c3847049da90a5cff25093a9dc9c9 bpftrace-487dd815bfe4a24908950552f35ef17d6653b2f8.tar.gz
package/bpftrace/bpftrace.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# bpftrace +# +################################################################################ + +# upcoming 0.12 version. +BPFTRACE_VERSION = 487dd815bfe4a24908950552f35ef17d6653b2f8 +BPFTRACE_SITE = $(call github,iovisor,bpftrace,$(BPFTRACE_VERSION)) +BPFTRACE_LICENSE = Apache-2.0 +BPFTRACE_LICENSE_FILES = LICENSE +BPFTRACE_DEPENDENCIES = host-bison host-flex bcc libbpf llvm + +# libbfd, libopcodes +ifeq ($(BR2_PACKAGE_BINUTILS),y) +BPFTRACE_DEPENDENCIES += binutils +endif + +BPFTRACE_CONF_OPTS += -DENABLE_MAN=OFF + +$(eval $(cmake-package))
Signature · 1 line
2.25.4
PATCH v6 4/5 package/bpftrace: new package
Quoted 27 lines · Romain Naour
From: Qais Yousef <[email protected]>
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x).
Only tested on
x86_64and aarch64. The package doesn't support i386 and aarch32.The libbpf dependency allow to enable the BTF support:
# bpftrace --info System OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020 Arch: aarch64Build
version: 2020.11-328-g019a9
LLVM: 9.0.1
foreach_sym: yes
unsafe uprobe: no
bfd: yes
bpf_attach_kfunc: yes
bcc_usdt_addsem: yes
bccbpf_attach_uproberefcount: yes
libbpf: yes
libbpf btf dump: yes
libbpf btf dump type decl: yes
Quoted 7 lines
bfptrace doesn't use the
libbpf_bcclibrary provided by bcc package.Signed-off-by Qais Yousef <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Jugurtha BELKALEM <[email protected]>---
v6: Update DEVELOPERS file
LGTM.
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
Quoted 30 lines · Qais Yousef
Quoted 29 lines · Romain Naour
From: Qais Yousef <[email protected]>
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x).
Only tested on
x86_64and aarch64. The package doesn't support i386 and aarch32.The libbpf dependency allow to enable the BTF support:
# bpftrace --info System OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020 Arch: aarch64Build
version: 2020.11-328-g019a9
LLVM: 9.0.1
foreach_sym: yes
unsafe uprobe: no
bfd: yes
bpf_attach_kfunc: yes
bcc_usdt_addsem: yes
bccbpf_attach_uproberefcount: yes
libbpf: yes
libbpf btf dump: yes
libbpf btf dump type decl: yesbfptrace doesn't use the
libbpf_bcclibrary provided by bcc package.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Qais Yousef <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Jugurtha BELKALEM <[email protected]>---
v6: Update DEVELOPERS fileLGTM.
Ping.
I had issues with building patch 5, but the rest of the series is in good shape IMO and can be merged independently at least.
Is there anything more needs to be done to help get this support merged?
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
Quoted 37 lines · Qais Yousef
Quoted 36 lines · Qais Yousef
Quoted 34 lines · Romain Naour
From: Qais Yousef <[email protected]>
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x).
Only tested on
x86_64and aarch64. The package doesn't support i386 and aarch32.The libbpf dependency allow to enable the BTF support:
# bpftrace --info System OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020 Arch: aarch64Build
version: 2020.11-328-g019a9
LLVM: 9.0.1
foreach_sym: yes
unsafe uprobe: no
bfd: yes
bpf_attach_kfunc: yes
bcc_usdt_addsem: yes
bccbpf_attach_uproberefcount: yes
libbpf: yes
libbpf btf dump: yes
libbpf btf dump type decl: yesbfptrace doesn't use the
libbpf_bcclibrary provided by bcc package.Signed-off-by Qais Yousef <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Jugurtha BELKALEM <[email protected]>---
v6: Update DEVELOPERS file
Quoted 8 lines
Quoted 1 line
LGTM.
Ping.
I had issues with building patch 5, but the rest of the series is in good shape IMO and can be merged independently at least.
Is there anything more needs to be done to help get this support merged?
Ping again. It'd be great to finally have these merged.
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
Hello Quais, All,
Le jeu. 25 f?vr. 2021 ? 11:18, Qais Yousef <[email protected]> a ?crit :
Quoted 43 lines · Qais Yousef
Quoted 8 lines · Qais Yousef
Quoted 7 lines · Romain Naour
Quoted 6 lines
From: Qais Yousef <[email protected]>
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x).
Only tested on
x86_64and aarch64. The package doesn't support i386and
Quoted 33 lines
Quoted 23 lines
Quoted 23 lines
aarch32.
The libbpf dependency allow to enable the BTF support:
# bpftrace --info System OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020 Arch: aarch64Build
version: 2020.11-328-g019a9
LLVM: 9.0.1
foreach_sym: yes
unsafe uprobe: no
bfd: yes
bpf_attach_kfunc: yes
bcc_usdt_addsem: yes
bccbpf_attach_uproberefcount: yes
libbpf: yes
libbpf btf dump: yes
libbpf btf dump type decl: yesbfptrace doesn't use the
libbpf_bcclibrary provided by bcc package.Quoted 7 lines
Quoted 5 lines
Signed-off-by Qais Yousef <[email protected]>Signed-off-by Romain Naour <[email protected]>Cc Jugurtha BELKALEM <[email protected]>---
v6: Update DEVELOPERS fileLGTM.
Ping.
Quoted 8 lines
Quoted 1 line
I had issues with building patch 5, but the rest of the series is in
good shape
Quoted 3 lines
IMO and can be merged independently at least.
Is there anything more needs to be done to help get this support merged?
Ping again. It'd be great to finally have these merged.
Maintainers are currently busy at the release 2021.02 version of Buildroot.
But yes, this work has been reviewed and reworked by Quais and me.
I guess It's good to go.
Best regards,
Romain
Quoted 5 lines
Thanks
--
Qais Yousef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210225/9267291c/attachment.html>
PATCH v6 4/5 package/bpftrace: new package
Quoted 53 lines · Romain Naour
Hello Quais, All,
Le jeu. 25 f?vr. 2021 ? 11:18, Qais Yousef <[email protected]> a ?crit :
On 01/23/21 19:44, Qais Yousef wrote:
> On 12/21/20 13:45, Qais Yousef wrote:
> > On 12/20/20 16:12, Romain Naour wrote:
> > > From: Qais Yousef <[email protected]>
> > >
> > > bpftrace is a high-level tracing language for Linux enhanced Berkeley > > > Packet Filter (eBPF) available in recent Linux kernels (4.x). > > >
> > > Only tested onx86_64and aarch64. The package doesn't support i386 and
> > > aarch32.
> > >
> > > The libbpf dependency allow to enable the BTF support:
> > > # bpftrace --info
> > > System
> > > OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020
> > > Arch: aarch64
> > >
> > > Build
> > > version: 2020.11-328-g019a9
> > > LLVM: 9.0.1
> > >foreach_sym: yes
> > > unsafe uprobe: no
> > > bfd: yes
> > >bpf_attach_kfunc: yes
> > >bcc_usdt_addsem: yes
> > > bccbpf_attach_uproberefcount: yes
> > > libbpf: yes
> > > libbpf btf dump: yes
> > > libbpf btf dump type decl: yes
> > >
> > > bfptrace doesn't use thelibbpf_bcclibrary provided by bcc package. > > >
> > > Signed-off-by: Qais Yousef <[email protected]>
> > > Signed-off-by: Romain Naour <[email protected]>
> > > Cc: Jugurtha BELKALEM <[email protected]>
> > > ---
> > > v6: Update DEVELOPERS file
> >
> > LGTM.
>
> Ping.
>
> I had issues with building patch 5, but the rest of the series is in good shape
> IMO and can be merged independently at least.
>
> Is there anything more needs to be done to help get this support merged?
Quoted 8 lines
Ping again. It'd be great to finally have these merged.
Maintainers are currently busy at the release 2021.02 version of Buildroot.
But yes, this work has been reviewed and reworked by Quais and me.
I guess It's good to go.
Another gentle ping. Hopefully the release is done now for this to be considered.
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
Hello,
Le 06/04/2021 ? 13:54, Qais Yousef a ?crit?:
Quoted 57 lines · Romain Naour
Quoted 56 lines
Hello Quais, All,
Le jeu. 25 f?vr. 2021 ? 11:18, Qais Yousef <[email protected]> a ?crit :
On 01/23/21 19:44, Qais Yousef wrote:
> On 12/21/20 13:45, Qais Yousef wrote:
> > On 12/20/20 16:12, Romain Naour wrote:
> > > From: Qais Yousef <[email protected]>
> > >
> > > bpftrace is a high-level tracing language for Linux enhanced Berkeley > > > Packet Filter (eBPF) available in recent Linux kernels (4.x). > > >
> > > Only tested onx86_64and aarch64. The package doesn't support i386 and
> > > aarch32.
> > >
> > > The libbpf dependency allow to enable the BTF support:
> > > # bpftrace --info
> > > System
> > > OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020
> > > Arch: aarch64
> > >
> > > Build
> > > version: 2020.11-328-g019a9
> > > LLVM: 9.0.1
> > >foreach_sym: yes
> > > unsafe uprobe: no
> > > bfd: yes
> > >bpf_attach_kfunc: yes
> > >bcc_usdt_addsem: yes
> > > bccbpf_attach_uproberefcount: yes
> > > libbpf: yes
> > > libbpf btf dump: yes
> > > libbpf btf dump type decl: yes
> > >
> > > bfptrace doesn't use thelibbpf_bcclibrary provided by bcc package. > > >
> > > Signed-off-by: Qais Yousef <[email protected]>
> > > Signed-off-by: Romain Naour <[email protected]>
> > > Cc: Jugurtha BELKALEM <[email protected]>
> > > ---
> > > v6: Update DEVELOPERS file
> >
> > LGTM.
>
> Ping.
>
> I had issues with building patch 5, but the rest of the series is in good shape
> IMO and can be merged independently at least.
>
> Is there anything more needs to be done to help get this support merged?Ping again. It'd be great to finally have these merged.
Quoted 8 lines
Quoted 5 lines
Maintainers are currently busy at the release 2021.02 version of Buildroot.
But yes, this work has been reviewed and reworked by Quais and me.
I guess It's good to go.
Another gentle ping. Hopefully the release is done now for this to be considered.
Gentle ping too.
The patch series is here:
http://patchwork.ozlabs.org/project/buildroot/list/?series=221413
I didn't work on it since then, only the patch 5/5 needs to be reworked.
Best regards,
Romain
Quoted 6 lines
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
Quoted 69 lines · Romain Naour
Hello,
Le 06/04/2021 ? 13:54, Qais Yousef a ?crit?:
Quoted 57 lines · Romain Naour
Quoted 56 lines
Hello Quais, All,
Le jeu. 25 f?vr. 2021 ? 11:18, Qais Yousef <[email protected]> a ?crit :
On 01/23/21 19:44, Qais Yousef wrote:
> On 12/21/20 13:45, Qais Yousef wrote:
> > On 12/20/20 16:12, Romain Naour wrote:
> > > From: Qais Yousef <[email protected]>
> > >
> > > bpftrace is a high-level tracing language for Linux enhanced Berkeley > > > Packet Filter (eBPF) available in recent Linux kernels (4.x). > > >
> > > Only tested onx86_64and aarch64. The package doesn't support i386 and
> > > aarch32.
> > >
> > > The libbpf dependency allow to enable the BTF support:
> > > # bpftrace --info
> > > System
> > > OS: Linux 5.4.58 #1 SMP Sun Dec 20 15:56:56 CET 2020
> > > Arch: aarch64
> > >
> > > Build
> > > version: 2020.11-328-g019a9
> > > LLVM: 9.0.1
> > >foreach_sym: yes
> > > unsafe uprobe: no
> > > bfd: yes
> > >bpf_attach_kfunc: yes
> > >bcc_usdt_addsem: yes
> > > bccbpf_attach_uproberefcount: yes
> > > libbpf: yes
> > > libbpf btf dump: yes
> > > libbpf btf dump type decl: yes
> > >
> > > bfptrace doesn't use thelibbpf_bcclibrary provided by bcc package. > > >
> > > Signed-off-by: Qais Yousef <[email protected]>
> > > Signed-off-by: Romain Naour <[email protected]>
> > > Cc: Jugurtha BELKALEM <[email protected]>
> > > ---
> > > v6: Update DEVELOPERS file
> >
> > LGTM.
>
> Ping.
>
> I had issues with building patch 5, but the rest of the series is in good shape
> IMO and can be merged independently at least.
>
> Is there anything more needs to be done to help get this support merged?Ping again. It'd be great to finally have these merged.
Quoted 8 lines
Quoted 5 lines
Maintainers are currently busy at the release 2021.02 version of Buildroot.
But yes, this work has been reviewed and reworked by Quais and me.
I guess It's good to go.
Another gentle ping. Hopefully the release is done now for this to be considered.
Quoted 6 lines
Gentle ping too.
The patch series is here:
http://patchwork.ozlabs.org/project/buildroot/list/?series=221413I didn't work on it since then, only the patch 5/5 needs to be reworked.
Ping!
This series has been setting around since forever now. What's the right way forward to get this over the fence?
Thanks
--
Qais Yousef
PATCH v6 4/5 package/bpftrace: new package
In reply to Romain NaourOn 20/12/2020 16:12, Romain Naour wrote:
[snip]
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch line 4
Quoted 10 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch new file +4
-0@@ -0,0 +1,71 @@ +From 960d2b69975462e445733482ac8d6ea319d3c5b2 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Thu, 5 Nov 2020 01:19:54 +0100 +Subject: [PATCH] cmake: link ast, resources parser as static libraries
Why is this needed?
Has the patch been sent upstream?
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch line 6
Quoted 2 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch new file +2
-0+ +Signed-off-by: Romain Naour <[email protected]>
[snip]]
package/bpftrace/Config.in line 4
Quoted 10 lines
package/bpftrace/Config.in new file +4
-0@@ -0,0 +1,40 @@ +config BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 || BR2_aarch64_be + default y if BR2_x86_64
You can add
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # bcc
here as well. The point of _ARCH_SUPPORTS is to make it easier for dependent packages to express the arch dependency, so that should include recursive arch dependencies.
package/bpftrace/Config.in line 11
Quoted 7 lines
package/bpftrace/Config.in new file +7
-0+ +config BR2_PACKAGE_BPFTRACE + bool "bpftrace" + depends on BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # bcc + depends on BR2_TOOLCHAIN_USES_GLIBC # bcc + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # bcc, clang
We write this as # bcc -> clang
package/bpftrace/Config.in line 16
Quoted 5 lines
package/bpftrace/Config.in new file +5
-0+ depends on BR2_INSTALL_LIBSTDCPP # bcc, clang + select BR2_PACKAGE_BCC + select BR2_PACKAGE_LIBBPF + # LLVM RTTI mendatory: https://github.com/iovisor/bpftrace/issues/1156 + select BR2_PACKAGE_LLVM_RTTI
Again, I prefer an explicit select BR2_PACKAGE_LLVM
Quoted 43 lines
package/bpftrace/Config.in new file +24
-0+ help + bpftrace is a high-level tracing language for Linux enhanced + Berkeley Packet Filter (eBPF) available in recent Linux + kernels (4.x). + + bpftrace uses LLVM as a backend to compile scripts to + BPF-bytecode and makes use of BCC for interacting with the + Linux BPF system, as well as existing Linux tracing + capabilities: kernel dynamic tracing (kprobes), user-level + dynamic tracing (uprobes), and tracepoints. The bpftrace + language is inspired by awk and C, and predecessor tracers + such as DTrace and SystemTap. + + It's highly recommended to NOT strip bpftrace binary. + To do so, add "bpftrace" to BR2_STRIP_EXCLUDE_FILES. + See: + https://bugzilla.redhat.com/show_bug.cgi?id=1865787 + + https://www.github.com/iovisor/bpftrace + +comment "bpftrace needs a glibc toolchain w/ C++, gcc >= 4.8" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8package/bpftrace/bpftrace.hash new file +3
-0@@ -0,0 +1,3 @@ +# locally calculated +sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE +sha256 1f08661bac9dfa7d3d76b54b3b4d1738b02c3847049da90a5cff25093a9dc9c9 bpftrace-487dd815bfe4a24908950552f35ef17d6653b2f8.tar.gzpackage/bpftrace/bpftrace.mk new file +4
-0@@ -0,0 +1,21 @@ +################################################################################ +# +# bpftrace +#
package/bpftrace/bpftrace.mk line 14
Quoted 10 lines
package/bpftrace/bpftrace.mk new file +10
-0+################################################################################ + +# upcoming 0.12 version. +BPFTRACE_VERSION = 487dd815bfe4a24908950552f35ef17d6653b2f8 +BPFTRACE_SITE = $(call github,iovisor,bpftrace,$(BPFTRACE_VERSION)) +BPFTRACE_LICENSE = Apache-2.0 +BPFTRACE_LICENSE_FILES = LICENSE +BPFTRACE_DEPENDENCIES = host-bison host-flex bcc libbpf llvm + +# libbfd, libopcodes
What happens if target binutils is not built? Is it using a bundled version? In
that case, we prefer to unbundle it (i.e. select binutils).
Regards,
Arnout
Quoted 8 lines
package/bpftrace/bpftrace.mk new file +7
-0+ifeq ($(BR2_PACKAGE_BINUTILS),y) +BPFTRACE_DEPENDENCIES += binutils +endif + +BPFTRACE_CONF_OPTS += -DENABLE_MAN=OFF + +$(eval $(cmake-package))
PATCH v6 4/5 package/bpftrace: new package
Hi Arnout
Thanks for having a look! Sorry I was away all of last week.
Quoted 4 lines · Arnout Vandecappelle
On 20/12/2020 16:12, Romain Naour wrote:
[snip]
Quoted 12 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch line 4
Quoted 10 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch new file +4
-0@@ -0,0 +1,71 @@ +From 960d2b69975462e445733482ac8d6ea319d3c5b2 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Thu, 5 Nov 2020 01:19:54 +0100 +Subject: [PATCH] cmake: link ast, resources parser as static librariesWhy is this needed?
In my original posting I added
install(TARGETS parser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})Which Romain suggested building as static is a better option.
The problem IIRC was that these libraries weren't installed correctly on the target.
Quoted 2 lines
Has the patch been sent upstream?
I don't think there was an attempt to do that yet.
If Romain doesn't get a chance to address your review comments soon enough I'll address them and post a new version. Both of us have been driving this during our free time on the weekends.
Thanks for the review.
Cheers
--
Qais Yousef
Quoted 111 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch line 6
Quoted 3 lines
package/bpftrace/0001-cmake-link-ast-resources-parser-as-static-libraries.patch new file +2
-0+ +Signed-off-by: Romain Naour <[email protected]>[snip]]
package/bpftrace/Config.in line 4
Quoted 10 lines
package/bpftrace/Config.in new file +4
-0@@ -0,0 +1,40 @@ +config BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + bool + default y if BR2_aarch64 || BR2_aarch64_be + default y if BR2_x86_64You can add
depends on
BR2_PACKAGE_LLVM_ARCH_SUPPORTS# bcchere as well. The point of
_ARCH_SUPPORTSis to make it easier for dependent packages to express the arch dependency, so that should include recursive arch dependencies.package/bpftrace/Config.in line 11
Quoted 7 lines
package/bpftrace/Config.in new file +7
-0+ +config BR2_PACKAGE_BPFTRACE + bool "bpftrace" + depends on BR2_PACKAGE_BPFTRACE_ARCH_SUPPORTS + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # bcc + depends on BR2_TOOLCHAIN_USES_GLIBC # bcc + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # bcc, clangWe write this as # bcc -> clang
package/bpftrace/Config.in line 16
Quoted 5 lines
package/bpftrace/Config.in new file +5
-0+ depends on BR2_INSTALL_LIBSTDCPP # bcc, clang + select BR2_PACKAGE_BCC + select BR2_PACKAGE_LIBBPF + # LLVM RTTI mendatory: https://github.com/iovisor/bpftrace/issues/1156 + select BR2_PACKAGE_LLVM_RTTIAgain, I prefer an explicit select
BR2_PACKAGE_LLVMQuoted 43 lines
package/bpftrace/Config.in new file +24
-0+ help + bpftrace is a high-level tracing language for Linux enhanced + Berkeley Packet Filter (eBPF) available in recent Linux + kernels (4.x). + + bpftrace uses LLVM as a backend to compile scripts to + BPF-bytecode and makes use of BCC for interacting with the + Linux BPF system, as well as existing Linux tracing + capabilities: kernel dynamic tracing (kprobes), user-level + dynamic tracing (uprobes), and tracepoints. The bpftrace + language is inspired by awk and C, and predecessor tracers + such as DTrace and SystemTap. + + It's highly recommended to NOT strip bpftrace binary. + To do so, add "bpftrace" to BR2_STRIP_EXCLUDE_FILES. + See: + https://bugzilla.redhat.com/show_bug.cgi?id=1865787 + + https://www.github.com/iovisor/bpftrace + +comment "bpftrace needs a glibc toolchain w/ C++, gcc >= 4.8" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \ + || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8package/bpftrace/bpftrace.hash new file +3
-0@@ -0,0 +1,3 @@ +# locally calculated +sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE +sha256 1f08661bac9dfa7d3d76b54b3b4d1738b02c3847049da90a5cff25093a9dc9c9 bpftrace-487dd815bfe4a24908950552f35ef17d6653b2f8.tar.gzpackage/bpftrace/bpftrace.mk new file +4
-0@@ -0,0 +1,21 @@ +################################################################################ +# +# bpftrace +#package/bpftrace/bpftrace.mk line 14
Quoted 10 lines
package/bpftrace/bpftrace.mk new file +10
-0+################################################################################ + +# upcoming 0.12 version. +BPFTRACE_VERSION = 487dd815bfe4a24908950552f35ef17d6653b2f8 +BPFTRACE_SITE = $(call github,iovisor,bpftrace,$(BPFTRACE_VERSION)) +BPFTRACE_LICENSE = Apache-2.0 +BPFTRACE_LICENSE_FILES = LICENSE +BPFTRACE_DEPENDENCIES = host-bison host-flex bcc libbpf llvm + +# libbfd, libopcodesWhat happens if target binutils is not built? Is it using a bundled version? In
that case, we prefer to unbundle it (i.e. select binutils).Regards,
ArnoutQuoted 8 lines
package/bpftrace/bpftrace.mk new file +7
-0+ifeq ($(BR2_PACKAGE_BINUTILS),y) +BPFTRACE_DEPENDENCIES += binutils +endif + +BPFTRACE_CONF_OPTS += -DENABLE_MAN=OFF + +$(eval $(cmake-package))
PATCH v6 5/5 package/bcc: add optional luajit dependency
In reply to Romain NaourThe luajit dependency was explicitely disabled when bcc has been added to Buildroot.
Even if the python binding is probably more used, enable luajit binding if luajit package is enabled in the defconfig.
Fix the luajit command line used to build bcc.o, otherwise bcc.o is build for the host.
--- .../bcc/0003-fix-aarch64-cross-compile.patch | 65 +++++++++++++++++++ package/bcc/bcc.mk | 10 ++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 package/bcc/0003-fix-aarch64-cross-compile.patch
package/bcc/0003-fix-aarch64-cross-compile.patch new file +65 -0
@@ -0,0 +1,65 @@ +From 5a5b0f04484e00c88e7be902101367d6d591fb96 Mon Sep 17 00:00:00 2001 +From: Jugurtha BELKALEM <[email protected]> +Date: Thu, 2 May 2019 11:06:23 +0200 +Subject: [PATCH] cmake/luajit: Provide the target architecture to luaJIT while + cross-compiling + +Unlike CMAKE_SYSTEM_PROCESSOR which identifies aarch64 +as a valid architecture, luajit does not recognize it. +luajit defines aarch64 as arm64. + +LuaJIT doesn't use usual arch naming, so we have to convert +between CMake and Luajit for each architectures while +cross-compiling. + +Signed-off-by: Jugurtha BELKALEM <[email protected]> +Signed-off-by: Romain Naour <[email protected]> +--- +v2: Do the same for other architecture supported by LuaJIT. +https://github.com/iovisor/bcc/pull/2480 +--- + src/lua/CMakeLists.txt | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt +index 7541d48df..226e1b1d2 100644 +--- a/src/lua/CMakeLists.txt ++++ b/src/lua/CMakeLists.txt +@@ -13,9 +13,36 @@ if (LUAJIT_LIBRARIES AND LUAJIT) + DEPENDS ${SRC_LUA} ${CMAKE_CURRENT_SOURCE_DIR}/squishy + ) + ++ # LuaJIT doesn't use usual arch naming, so we have to convert ++ # between CMake and Luajit while cross-compiling. ++ if (CMAKE_CROSSCOMPILING) ++ SET (LUAJIT_TARGET_ARCH "-a") ++ # https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L30 ++ # https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L65 ++ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "arm64") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64_be") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "arm64be") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "arm") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86)$") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "x86") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "mips") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "mips") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "mipsel") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "ppc") ++ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++ SET (LUAJIT_TARGET_ARCH ${LUAJIT_TARGET_ARCH} "x64") ++ else() ++ MESSAGE(FATAL_ERROR "${CMAKE_SYSTEM_PROCESSOR} is not supported by LuaJIT") ++ endif() ++ endif() ++ + ADD_CUSTOM_COMMAND( + OUTPUT bcc.o +- COMMAND ${LUAJIT} -bg bcc.lua bcc.o ++ COMMAND ${LUAJIT} -bg bcc.lua ${LUAJIT_TARGET_ARCH} bcc.o + DEPENDS bcc.lua + ) +
package/bcc/bcc.mk +8 -2
@@ -19,8 +19,14 @@ BCC_DEPENDENCIES = host-bison host-flex clang elfutils flex llvm python3 tar BCC_CONF_OPTS = -DENABLE_LLVM_SHARED=ON \ -DREVISION=$(BCC_VERSION) \ -DENABLE_CLANG_JIT=ON \ - -DENABLE_MAN=OFF \ - -DENABLE_LUAJIT=OFF + -DENABLE_MAN=OFF + +ifeq ($(BR2_PACKAGE_LUAJIT),y) +BCC_DEPENDENCIES += luajit +BCC_CONF_OPTS += -DENABLE_LUAJIT=ON +else +BCC_CONF_OPTS += -DENABLE_LUAJIT=OFF +endif define BCC_LINUX_CONFIG_FIXUPS # Enable kernel support for eBPF
Signature · 1 line
2.25.4
PATCH v6 5/5 package/bcc: add optional luajit dependency
Quoted 11 lines · Romain Naour
The luajit dependency was explicitely disabled when bcc has been added to Buildroot.
Even if the python binding is probably more used, enable luajit binding if luajit package is enabled in the defconfig.Fix the luajit command line used to build bcc.o, otherwise bcc.o is build for the host.
Signed-off-by Romain Naour <[email protected]>Cc Qais Yousef <[email protected]>---
This compiles fine for me. And the patch looks good to me too. But when I tried to test it by following the example from the website
$ sudo src/lua/bcc-probe examples/lua/task_switch.lua
I noticed there's no bcc-probe in the target. When I copied it manually and tried to run the above command I ended up with the below error.
# /root/bcc-probe examples/lua/task_switch.lua luajit: /root/bcc-probe:20: module 'bcc.run' not found: no field package.preload['bcc.run'] no file '/root//bcc/run.lua' no file './bcc/run.lua' no file '/usr/share/luajit-2.1.2/bcc/run.lua' no file '/usr/local/share/lua/5.1/bcc/run.lua' no file '/usr/local/share/lua/5.1/bcc/run/init.lua' no file '/usr/share/lua/5.1/bcc/run.lua' no file '/usr/share/lua/5.1/bcc/run/init.lua' no file './bcc/run.so' no file '/usr/local/lib/lua/5.1/bcc/run.so' no file '/usr/lib/lua/5.1/bcc/run.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './bcc.so' no file '/usr/local/lib/lua/5.1/bcc.so' no file '/usr/lib/lua/5.1/bcc.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' /root/bcc-probe:20: in main chunk [C]: at 0x00402414
I admit I enabled luajit after initially building bcc without it. Although I deleted output/build/bcc* to ensure it gets rebuilt against the new dependency.
I'll try again with a full clean build to see if this fixes it.
Thanks
--
Qais Yousef
PATCH v6 5/5 package/bcc: add optional luajit dependency
Quoted 44 lines · Qais Yousef
Quoted 11 lines · Romain Naour
The luajit dependency was explicitely disabled when bcc has been added to Buildroot.
Even if the python binding is probably more used, enable luajit binding if luajit package is enabled in the defconfig.Fix the luajit command line used to build bcc.o, otherwise bcc.o is build for the host.
Signed-off-by Romain Naour <[email protected]>Cc Qais Yousef <[email protected]>---
This compiles fine for me. And the patch looks good to me too. But when I tried to test it by following the example from the website
$ sudo src/lua/bcc-probe examples/lua/task_switch.luaI noticed there's no bcc-probe in the target. When I copied it manually and tried to run the above command I ended up with the below error.
# /root/bcc-probe examples/lua/task_switch.lua luajit: /root/bcc-probe:20: module 'bcc.run' not found: no field package.preload['bcc.run'] no file '/root//bcc/run.lua' no file './bcc/run.lua' no file '/usr/share/luajit-2.1.2/bcc/run.lua' no file '/usr/local/share/lua/5.1/bcc/run.lua' no file '/usr/local/share/lua/5.1/bcc/run/init.lua' no file '/usr/share/lua/5.1/bcc/run.lua' no file '/usr/share/lua/5.1/bcc/run/init.lua' no file './bcc/run.so' no file '/usr/local/lib/lua/5.1/bcc/run.so' no file '/usr/lib/lua/5.1/bcc/run.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './bcc.so' no file '/usr/local/lib/lua/5.1/bcc.so' no file '/usr/lib/lua/5.1/bcc.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' /root/bcc-probe:20: in main chunk [C]: at 0x00402414
Quoted 5 lines
I admit I enabled luajit after initially building bcc without it. Although I deleted output/build/bcc* to ensure it gets rebuilt against the new dependency.
I'll try again with a full clean build to see if this fixes it.
Same thing with a new clean build. I just enabled BR2_PACKAGE_LUAJIT. Is there a dependency on lua 5.1 too?
Thanks
--
Qais Yousef
PATCH v6 5/5 package/bcc: add optional luajit dependency
In reply to Romain NaourQuoted 5 lines · Romain Naour
++ SET (
LUAJIT_TARGET_ARCH"-a")
++ # https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L30
++ # https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L65
++ if (CMAKE_SYSTEM_PROCESSORSTREQUAL "aarch64")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "arm64")
This is a very weird way of adding the -a. Why not just:
SET (LUAJIT_TARGET_ARCH "arm64")
Quoted 19 lines
++ elseif (
CMAKE_SYSTEM_PROCESSORMATCHES "aarch64_be")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "arm64be")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "arm")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "arm")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "^(i.86)$")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "x86")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "mips")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "mips")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "mipsel")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "mipsel")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "powerpc")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "ppc")
++ elseif (CMAKE_SYSTEM_PROCESSORMATCHES "x86_64")
++ SET (LUAJIT_TARGET_ARCH${LUAJIT_TARGET_ARCH} "x64")
++else()
++MESSAGE(FATAL_ERROR "${CMAKE_SYSTEM_PROCESSOR} is not supported by LuaJIT")
++endif()
++endif()
++
package/bcc/0003-fix-aarch64-cross-compile.patch line 62
Quoted 4 lines
package/bcc/0003-fix-aarch64-cross-compile.patch new file +4
-0+ ADD_CUSTOM_COMMAND( + OUTPUT bcc.o +- COMMAND ${LUAJIT} -bg bcc.lua bcc.o ++ COMMAND ${LUAJIT} -bg bcc.lua ${LUAJIT_TARGET_ARCH} bcc.o
and here
COMMAND ${LUAJIT} -bg bcc.lua -a ${LUAJIT_TARGET_ARCH} bcc.oAlso, has this patch been sent upstream?
Regards,
Arnout
Quoted 3 lines
package/bcc/0003-fix-aarch64-cross-compile.patch new file +3
-0+ DEPENDS bcc.lua + ) +
Arnout Vandecappelle
AppliedPATCH v6 1/5 package/llvm: add BPF backend
In reply to Romain NaourQuoted 7 lines · Romain Naour
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.
Quoted 7 lines
BCC requires enabling LLVM backend BPF support.
Signed-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Tested-by Qais Yousef <[email protected]>Reviewed-by Qais Yousef <[email protected]>Cc Qais Yousef <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 39 lines
--- package/llvm/Config.in | 6 ++++++ package/llvm/llvm.mk | 5 +++++ 2 files changed, 11 insertions(+)package/llvm/Config.in +6
-0@@ -47,6 +47,12 @@ config BR2_PACKAGE_LLVM_RTTI https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html +config BR2_PACKAGE_LLVM_BPF + bool "BPF backend" + help + Build BPF target. Select this option if you are going + to install bcc on the target. + endif comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"package/llvm/llvm.mk +5
-0@@ -61,6 +61,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) LLVM_TARGETS_TO_BUILD += AMDGPU endif +# Build BPF backend +ifeq ($(BR2_PACKAGE_LLVM_BPF),y) +LLVM_TARGETS_TO_BUILD += BPF +endif + # Use native llvm-tblgen from host-llvm (needed for cross-compilation) LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen
PATCH v6 1/5 package/llvm: add BPF backend
Quoted 12 lines · Arnout Vandecappelle
Quoted 9 lines · Romain Naour
From: Jugurtha BELKALEM <[email protected]>
bcc is a front-end tool for eBPF :
https://github.com/iovisor/bcc/blob/master/README.md.
eBPF is the most powerful Linux tracer, and bcc
allows to write eBPF scripts in C and PYTHON3.BCC requires enabling LLVM backend BPF support.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Jugurtha BELKALEM <[email protected]>Signed-off-by Romain Naour <[email protected]>Tested-by Qais Yousef <[email protected]>Reviewed-by Qais Yousef <[email protected]>Cc Qais Yousef <[email protected]>Applied to master, thanks.
I mean to next!
Regards,
Arnout
Quoted 43 lines
Regards,
ArnoutQuoted 39 lines
--- package/llvm/Config.in | 6 ++++++ package/llvm/llvm.mk | 5 +++++ 2 files changed, 11 insertions(+)package/llvm/Config.in +6
-0@@ -47,6 +47,12 @@ config BR2_PACKAGE_LLVM_RTTI https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html +config BR2_PACKAGE_LLVM_BPF + bool "BPF backend" + help + Build BPF target. Select this option if you are going + to install bcc on the target. + endif comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"package/llvm/llvm.mk +5
-0@@ -61,6 +61,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) LLVM_TARGETS_TO_BUILD += AMDGPU endif +# Build BPF backend +ifeq ($(BR2_PACKAGE_LLVM_BPF),y) +LLVM_TARGETS_TO_BUILD += BPF +endif + # Use native llvm-tblgen from host-llvm (needed for cross-compilation) LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen