All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes
@ 2020-02-18  5:25 Leo Yan
  2020-02-18  5:25 ` [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version Leo Yan
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Leo Yan @ 2020-02-18  5:25 UTC (permalink / raw)
  To: openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain

This patch series add recipes for three eBPF tools into OpenEmbedded:
Ply, BCC and bpftrace; BCC is dependent on luajit so also adds a recipe
for luajit 2.1.0-beta3 building.

These tools have been tested with MACHINE=qemuarm64 building.

Leo Yan (2):
  Ply: Add recipe for git version
  luajit: Add luajit 2.1.0-beta3 recipe

Sumit Garg (2):
  BCC: Add build recipe
  bpftrace: Add build recipe

 ...-with-OE-LLVM-cross-compiled-package.patch | 32 +++++++
 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb    | 37 ++++++++
 ...ith-OE-llvm-clang-cross-compiled-pac.patch | 65 +++++++++++++
 .../bpftrace/bpftrace_0.9.4.bb                | 34 +++++++
 .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
 meta-oe/recipes-devtools/ply/ply_git.bb       | 27 ++++++
 6 files changed, 287 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
 create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
 create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb

-- 
2.17.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version
  2020-02-18  5:25 [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes Leo Yan
@ 2020-02-18  5:25 ` Leo Yan
  2020-02-20 15:41   ` Khem Raj
  2020-02-18  5:25 ` [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe Leo Yan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2020-02-18  5:25 UTC (permalink / raw)
  To: openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain

Ply is a light-weight eBPF tool which compiles ply script or one-liner
to Linux BPF programs and attaches to kprobes and tracepoints.  It
doesn't require external dependencies except libc, so it's very friendly
for embedded system usage.

This patch adds the recipe to support ply building for git version.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 meta-oe/recipes-devtools/ply/ply_git.bb | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb

diff --git a/meta-oe/recipes-devtools/ply/ply_git.bb b/meta-oe/recipes-devtools/ply/ply_git.bb
new file mode 100644
index 000000000..b8295386c
--- /dev/null
+++ b/meta-oe/recipes-devtools/ply/ply_git.bb
@@ -0,0 +1,27 @@
+SUMMARY = "Ply: A light-weight dynamic tracer for eBPF"
+HOMEPAGE = "https://github.com/iovisor/ply"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS += "bison-native"
+
+SRC_URI = "git://github.com/iovisor/ply"
+SRCREV = "aa5b9ac31307ec1acece818be334ef801c802a12"
+
+S = "${WORKDIR}/git"
+
+do_configure_prepend() {
+    ( cd ${S}; ./autogen.sh; cd - )
+}
+
+do_configure() {
+    ( cd ${S}; ./configure --host=${TARGET_SYS} --prefix=${D}${prefix}; cd - )
+}
+
+do_compile() {
+    ( cd ${S}; oe_runmake; cd - )
+}
+
+do_install() {
+    ( cd ${S}; oe_runmake install; cd - )
+}
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe
  2020-02-18  5:25 [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes Leo Yan
  2020-02-18  5:25 ` [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version Leo Yan
@ 2020-02-18  5:25 ` Leo Yan
  2020-02-19 23:07   ` Khem Raj
  2020-02-18  5:25 ` [meta-oe][PATCH v1 3/4] BCC: Add build recipe Leo Yan
  2020-02-18  5:25 ` [meta-oe][PATCH v1 4/4] bpftrace: " Leo Yan
  3 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2020-02-18  5:25 UTC (permalink / raw)
  To: openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain

Since luajit 2.1.0-beta3 can support architecture aarch64 and the old
misses to support aarch64, this patch adds recipe for luajit
2.1.0-beta3 building.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb

diff --git a/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb b/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
new file mode 100644
index 000000000..167b5d229
--- /dev/null
+++ b/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
@@ -0,0 +1,92 @@
+SUMMARY = "Just-In-Time Compiler for Lua"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=10a96c93403affcc34765f4c2612bc22"
+HOMEPAGE = "http://luajit.org"
+
+PV .= "+git${SRCPV}"
+SRCREV = "v2.1.0-beta3"
+SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1"
+
+S = "${WORKDIR}/git"
+
+inherit pkgconfig binconfig siteinfo
+
+BBCLASSEXTEND = "native"
+
+# http://luajit.org/install.html#cross
+# Host luajit needs to be compiled with the same pointer size
+# If you want to cross-compile to any 32 bit target on an x64 OS,
+# you need to install the multilib development package (e.g.
+# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
+# (HOST_CC="gcc -m32").
+BUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
+
+# The lua makefiles expect the TARGET_SYS to be from uname -s
+# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
+LUA_TARGET_OS = "Unknown"
+LUA_TARGET_OS_darwin = "Darwin"
+LUA_TARGET_OS_linux = "Linux"
+LUA_TARGET_OS_linux-gnueabi = "Linux"
+LUA_TARGET_OS_mingw32 = "Windows"
+
+# We don't want the lua buildsystem's compiler optimizations, or its
+# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
+# to both host and target compiles
+EXTRA_OEMAKE = "\
+    Q= E='@:' \
+    \
+    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
+    \
+    'TARGET_SYS=${LUA_TARGET_OS}' \
+    \
+    'CC=${CC}' \
+    'TARGET_AR=${AR} rcus' \
+    'TARGET_CFLAGS=${CFLAGS}' \
+    'TARGET_LDFLAGS=${LDFLAGS}' \
+    'TARGET_SHLDFLAGS=${LDFLAGS}' \
+    'HOST_CC=${BUILD_CC}' \
+    'HOST_CFLAGS=${BUILD_CFLAGS}' \
+    \
+    'PREFIX=${prefix}' \
+    'MULTILIB=${baselib}' \
+    'LDCONFIG=:' \
+"
+
+do_compile () {
+    oe_runmake
+}
+
+# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
+# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
+# expectations.
+EXTRA_OEMAKEINST = "\
+    'DESTDIR=${D}' \
+    'INSTALL_BIN=${D}${bindir}' \
+    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
+    'INSTALL_MAN=${D}${mandir}/man1' \
+"
+do_install () {
+    oe_runmake ${EXTRA_OEMAKEINST} install
+    rmdir ${D}${datadir}/lua/5.* \
+          ${D}${datadir}/lua \
+          ${D}${libdir}/lua/5.* \
+          ${D}${libdir}/lua
+}
+
+PACKAGES += 'luajit-common'
+
+# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
+# paths are packaged regardless of what the libdir and datadir paths are.
+FILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
+FILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
+    ${libdir}/libluajit-5.1.so.${PV} \
+"
+FILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
+    ${libdir}/libluajit-5.1.so \
+    ${libdir}/pkgconfig/luajit.pc \
+"
+FILES_luajit-common = "${datadir}/${BPN}-${PV}"
+
+# mips64 is not supported in this release
+COMPATIBLE_HOST_mipsarchn32 = "null"
+COMPATIBLE_HOST_mipsarchn64 = "null"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-oe][PATCH v1 3/4] BCC: Add build recipe
  2020-02-18  5:25 [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes Leo Yan
  2020-02-18  5:25 ` [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version Leo Yan
  2020-02-18  5:25 ` [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe Leo Yan
@ 2020-02-18  5:25 ` Leo Yan
  2020-02-18  6:30   ` Khem Raj
  2020-02-18  5:25 ` [meta-oe][PATCH v1 4/4] bpftrace: " Leo Yan
  3 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2020-02-18  5:25 UTC (permalink / raw)
  To: openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain

From: Sumit Garg <sumit.garg@linaro.org>

BPF Compiler Collection (BCC) is a toolkit for creating efficient kernel
tracing and manipulation programs, and includes versatile tools and
examples which based on eBPF.  This tool is very widely used on server
section, but we also can use it for embedded system, e.g. use its
function trace utilities (trace.py and argdist.py) to trace kernel
function parameters and return values.

This patch adds recipe for BCC version 0.12.0.  This patch also contains
a patch to change cmake file so can look for libraries and headers which
are installed in target sysroot-recipe path for cross compilation.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Co-developed-by: Leo Yan <leo.yan@linaro.org>
---
 ...-with-OE-LLVM-cross-compiled-package.patch | 32 ++++++++++++++++
 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb    | 37 +++++++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb

diff --git a/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
new file mode 100644
index 000000000..b5acadc1b
--- /dev/null
+++ b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
@@ -0,0 +1,32 @@
+From 93cf25ba663e68a6a6f4237fbe0ef8349b3f37ef Mon Sep 17 00:00:00 2001
+From: Sumit Garg <sumit.garg@linaro.org>
+Date: Fri, 14 Feb 2020 07:40:11 +0000
+Subject: [PATCH] Allow to build with OE LLVM cross compiled package
+
+The default LLVM cmake package requires all libraries, headers and tools
+to be present but in case of cross compilation, OE only provides
+target specific libraries and headers and requires native llvm tools.
+
+So instead of looking for a complete llvm package, look for libraries and
+headers which are installed in target sysroot-recipe path.
+
+Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
+---
+ CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7bd0f3b2..6f1f12c0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,8 +39,6 @@ endif()
+ if(NOT PYTHON_ONLY AND ENABLE_CLANG_JIT)
+ find_package(BISON)
+ find_package(FLEX)
+-find_package(LLVM REQUIRED CONFIG)
+-message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION}")
+ find_package(LibElf REQUIRED)
+
+ # clang is linked as a library, but the library path searching is
+--
+2.17.1
diff --git a/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
new file mode 100644
index 000000000..687fb64c7
--- /dev/null
+++ b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
@@ -0,0 +1,37 @@
+SUMMARY = "BPF Compiler Collection (BCC)"
+HOMEPAGE = "https://github.com/iovisor/bcc"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
+            luajit \
+            clang \
+            "
+
+RDEPENDS_${PN} += "bash python"
+
+SRC_URI = "git://github.com/iovisor/bcc \
+           file://0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch \
+           "
+SRCREV = "368a5b0714961953f3e3f61607fa16cb71449c1b"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = " \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DENABLE_LLVM_SHARED=ON \
+    -DENABLE_CLANG_JIT=ON \
+    -DENABLE_MAN=OFF \
+    -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
+    -DPYTHON_CMD=python3 \
+"
+
+FILES_${PN} += "${libdir}/python*/dist-packages"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-oe][PATCH v1 4/4] bpftrace: Add build recipe
  2020-02-18  5:25 [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes Leo Yan
                   ` (2 preceding siblings ...)
  2020-02-18  5:25 ` [meta-oe][PATCH v1 3/4] BCC: Add build recipe Leo Yan
@ 2020-02-18  5:25 ` Leo Yan
  3 siblings, 0 replies; 12+ messages in thread
From: Leo Yan @ 2020-02-18  5:25 UTC (permalink / raw)
  To: openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain

From: Sumit Garg <sumit.garg@linaro.org>

bpftrace is a high-level tracing language for eBPF, its language is
inspired by awk and C, and predecessor tracers such as DTrace and
SystemTap.  bpftrace was created by Alastair Robertson.  bpftrace
language supports the usages for one-liner and script, it's very
powerful for tracing and profiling.  bpftrace internal mechanism
depends on BCC and LLVM/Clang, so the building dependency has contains
these modules.

Add recipe for bpftrace version 0.9.4.  This patch also contains a
patch to change cmake file so can look for libraries and headers which
are installed in target sysroot-recipe path for cross compilation.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Co-developed-by: Leo Yan <leo.yan@linaro.org>
---
 ...ith-OE-llvm-clang-cross-compiled-pac.patch | 65 +++++++++++++++++++
 .../bpftrace/bpftrace_0.9.4.bb                | 34 ++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb

diff --git a/meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch b/meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
new file mode 100644
index 000000000..d6cb32222
--- /dev/null
+++ b/meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
@@ -0,0 +1,65 @@
+From cdfd9284c7e83b1bd18c94c0f39c020f31759178 Mon Sep 17 00:00:00 2001
+From: Sumit Garg <sumit.garg@linaro.org>
+Date: Mon, 17 Feb 2020 09:45:38 +0000
+Subject: [PATCH] Allow to build with OE llvm & clang cross compiled packages
+
+The default llvm and clang cmake packages requires all libraries, headers
+and tools to be present but in case of cross compilation, OE only
+provides target specific libraries and headers and requires native llvm
+or clang tools.
+
+So instead of looking for a complete llvm & clang packages, look for
+libraries and headers which are installed in target sysroot-recipe path.
+
+Also, fix name for clang library lookup.
+
+Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
+---
+ CMakeLists.txt         | 6 +++---
+ src/ast/CMakeLists.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b766669..e4de1e3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,7 +14,7 @@ set(STATIC_LIBC OFF CACHE BOOL "Attempt to embed libc, only known to work with m
+ set(EMBED_LLVM OFF CACHE BOOL "Build LLVM static libs as an ExternalProject and link to these instead of system libs.")
+ set(EMBED_CLANG OFF CACHE BOOL "Build Clang static libs as an ExternalProject and link to these instead of system libs.")
+ set(EMBED_LIBCLANG_ONLY OFF CACHE BOOL "Build only libclang.a, and link to system libraries statically")
+-set(LLVM_VERSION "8" CACHE STRING "Embedded LLVM/Clang version to build and link against.")
++set(LLVM_VERSION "9" CACHE STRING "Embedded LLVM/Clang version to build and link against.")
+ set(BUILD_ASAN OFF CACHE BOOL "Build bpftrace with -fsanitize=address")
+
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+@@ -122,7 +122,7 @@ check_include_file("sys/sdt.h" HAVE_SYSTEMTAP_SYS_SDT_H)
+
+ if (EMBED_LLVM)
+   include(embed_llvm)
+-else()
++elseif(0)
+   # Some users have multiple versions of llvm installed and would like to specify
+   # a specific llvm version.
+   if(${LLVM_REQUESTED_VERSION})
+@@ -142,7 +142,7 @@ endif()
+
+ if(EMBED_CLANG)
+   include(embed_clang)
+-else()
++elseif(0)
+   find_package(Clang REQUIRED)
+   include_directories(SYSTEM ${CLANG_INCLUDE_DIRS})
+ endif()
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index f280f47..f8b9dff 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -57,5 +57,5 @@ else()
+     llvm_expand_dependencies(llvm_libs ${_llvm_libs})
+     target_link_libraries(ast ${llvm_libs})
+   endif()
+-  target_link_libraries(ast libclang)
++  target_link_libraries(ast clang)
+ endif()
+--
+2.17.1
diff --git a/meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb b/meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
new file mode 100644
index 000000000..32a8b0baf
--- /dev/null
+++ b/meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
@@ -0,0 +1,34 @@
+SUMMARY = "bpftrace"
+HOMEPAGE = "https://github.com/iovisor/bpftrace"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            gtest-native \
+            git-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
+            clang \
+            bcc \
+            "
+
+RDEPENDS_${PN} += "bash python3"
+
+SRC_URI = "git://github.com/iovisor/bpftrace \
+           file://0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch \
+           "
+SRCREV = "85f9eea624c83443816e37654d0c1c93366a2e66"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
+
+EXTRA_OECMAKE = " \
+    -DCMAKE_BUILD_TYPE=Release \
+"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 3/4] BCC: Add build recipe
  2020-02-18  5:25 ` [meta-oe][PATCH v1 3/4] BCC: Add build recipe Leo Yan
@ 2020-02-18  6:30   ` Khem Raj
  2020-02-18  7:27     ` Leo Yan
  0 siblings, 1 reply; 12+ messages in thread
From: Khem Raj @ 2020-02-18  6:30 UTC (permalink / raw)
  To: Leo Yan; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

On Mon, Feb 17, 2020 at 9:27 PM Leo Yan <leo.yan@linaro.org> wrote:
>
> From: Sumit Garg <sumit.garg@linaro.org>
>
> BPF Compiler Collection (BCC) is a toolkit for creating efficient kernel
> tracing and manipulation programs, and includes versatile tools and
> examples which based on eBPF.  This tool is very widely used on server
> section, but we also can use it for embedded system, e.g. use its
> function trace utilities (trace.py and argdist.py) to trace kernel
> function parameters and return values.
>
> This patch adds recipe for BCC version 0.12.0.  This patch also contains
> a patch to change cmake file so can look for libraries and headers which
> are installed in target sysroot-recipe path for cross compilation.
>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> Co-developed-by: Leo Yan <leo.yan@linaro.org>
> ---
>  ...-with-OE-LLVM-cross-compiled-package.patch | 32 ++++++++++++++++
>  meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb    | 37 +++++++++++++++++++
>  2 files changed, 69 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
>  create mode 100644 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
>
> diff --git a/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
> new file mode 100644
> index 000000000..b5acadc1b
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
> @@ -0,0 +1,32 @@
> +From 93cf25ba663e68a6a6f4237fbe0ef8349b3f37ef Mon Sep 17 00:00:00 2001
> +From: Sumit Garg <sumit.garg@linaro.org>
> +Date: Fri, 14 Feb 2020 07:40:11 +0000
> +Subject: [PATCH] Allow to build with OE LLVM cross compiled package
> +
> +The default LLVM cmake package requires all libraries, headers and tools
> +to be present but in case of cross compilation, OE only provides
> +target specific libraries and headers and requires native llvm tools.
> +
> +So instead of looking for a complete llvm package, look for libraries and
> +headers which are installed in target sysroot-recipe path.
> +
> +Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> +---
> + CMakeLists.txt | 2 --
> + 1 file changed, 2 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 7bd0f3b2..6f1f12c0 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -39,8 +39,6 @@ endif()
> + if(NOT PYTHON_ONLY AND ENABLE_CLANG_JIT)
> + find_package(BISON)
> + find_package(FLEX)
> +-find_package(LLVM REQUIRED CONFIG)
> +-message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION}")
> + find_package(LibElf REQUIRED)
> +
> + # clang is linked as a library, but the library path searching is
> +--
> +2.17.1
> diff --git a/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
> new file mode 100644
> index 000000000..687fb64c7
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
> @@ -0,0 +1,37 @@
> +SUMMARY = "BPF Compiler Collection (BCC)"
> +HOMEPAGE = "https://github.com/iovisor/bcc"
> +LICENSE = "Apache-2.0"
> +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
> +
> +DEPENDS += "bison-native \
> +            ninja-native \
> +            elfutils-native \
> +            flex-native \
> +            ${MLPREFIX}elfutils \
> +            ${MLPREFIX}binutils \
> +            ${MLPREFIX}flex \
> +            luajit \
> +            clang \
> +            "
> +

this will add meta-clang dependency directly into meta-oe, which is not desired
is it possible to make it optional or perhaps marked when meta-clang
is not in BBLAYERS

> +RDEPENDS_${PN} += "bash python"
> +
> +SRC_URI = "git://github.com/iovisor/bcc \
> +           file://0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch \
> +           "
> +SRCREV = "368a5b0714961953f3e3f61607fa16cb71449c1b"
> +
> +S = "${WORKDIR}/git"
> +
> +inherit cmake
> +
> +EXTRA_OECMAKE = " \
> +    -DCMAKE_INSTALL_PREFIX=/usr \
> +    -DENABLE_LLVM_SHARED=ON \
> +    -DENABLE_CLANG_JIT=ON \
> +    -DENABLE_MAN=OFF \
> +    -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
> +    -DPYTHON_CMD=python3 \
> +"
> +
> +FILES_${PN} += "${libdir}/python*/dist-packages"
> --
> 2.17.1
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 3/4] BCC: Add build recipe
  2020-02-18  6:30   ` Khem Raj
@ 2020-02-18  7:27     ` Leo Yan
  2020-02-19  9:44       ` Leo Yan
  0 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2020-02-18  7:27 UTC (permalink / raw)
  To: Khem Raj; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

Hi Khem,

On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:

[...]

> > +DEPENDS += "bison-native \
> > +            ninja-native \
> > +            elfutils-native \
> > +            flex-native \
> > +            ${MLPREFIX}elfutils \
> > +            ${MLPREFIX}binutils \
> > +            ${MLPREFIX}flex \
> > +            luajit \
> > +            clang \
> > +            "
> > +
> 
> this will add meta-clang dependency directly into meta-oe, which is not desired
> is it possible to make it optional or perhaps marked when meta-clang
> is not in BBLAYERS

Thanks a lot for reviewing.  clang is mandotory for BCC to compile
eBPF programs, so I think we cannot build clang as optional for BCC.

For marking the recipe when meta-clang is not in BBLAYERS, I searched
with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable
for this case.  Could you give more detailed info for how to do this?

Thanks,
Leo


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 3/4] BCC: Add build recipe
  2020-02-18  7:27     ` Leo Yan
@ 2020-02-19  9:44       ` Leo Yan
  2020-02-19 17:16         ` Khem Raj
  0 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2020-02-19  9:44 UTC (permalink / raw)
  To: Khem Raj; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

Hi Khem,

On Tue, Feb 18, 2020 at 03:27:26PM +0800, Leo Yan wrote:
> Hi Khem,
> 
> On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:
> 
> [...]
> 
> > > +DEPENDS += "bison-native \
> > > +            ninja-native \
> > > +            elfutils-native \
> > > +            flex-native \
> > > +            ${MLPREFIX}elfutils \
> > > +            ${MLPREFIX}binutils \
> > > +            ${MLPREFIX}flex \
> > > +            luajit \
> > > +            clang \
> > > +            "
> > > +
> > 
> > this will add meta-clang dependency directly into meta-oe, which is not desired
> > is it possible to make it optional or perhaps marked when meta-clang
> > is not in BBLAYERS
> 
> Thanks a lot for reviewing.  clang is mandotory for BCC to compile
> eBPF programs, so I think we cannot build clang as optional for BCC.
> 
> For marking the recipe when meta-clang is not in BBLAYERS, I searched
> with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable
> for this case.  Could you give more detailed info for how to do this?

Just want to ask a following question.

Since BCC and bpftrace both are heavily relying on LLVM/Clang for their
tracing, do you think it's a good idea to merge BCC and bpftrace into
meta-clang layer, e.g. place into /meta-clang/recipes-devtools/?
If so, we can easily resolve the dependency issue and avoid to introduce
mess between meta-oe and meta-clang.

For the tool ply, it's simple and doesn't depend on Clang.  So should
keep it into meta-oe/recipes-devtools/ folder?  Also welcome any
suggestion for this.

Thanks,
Leo Yan


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 3/4] BCC: Add build recipe
  2020-02-19  9:44       ` Leo Yan
@ 2020-02-19 17:16         ` Khem Raj
  0 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2020-02-19 17:16 UTC (permalink / raw)
  To: Leo Yan; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

On Wed, Feb 19, 2020 at 1:45 AM Leo Yan <leo.yan@linaro.org> wrote:
>
> Hi Khem,
>
> On Tue, Feb 18, 2020 at 03:27:26PM +0800, Leo Yan wrote:
> > Hi Khem,
> >
> > On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:
> >
> > [...]
> >
> > > > +DEPENDS += "bison-native \
> > > > +            ninja-native \
> > > > +            elfutils-native \
> > > > +            flex-native \
> > > > +            ${MLPREFIX}elfutils \
> > > > +            ${MLPREFIX}binutils \
> > > > +            ${MLPREFIX}flex \
> > > > +            luajit \
> > > > +            clang \
> > > > +            "
> > > > +
> > >
> > > this will add meta-clang dependency directly into meta-oe, which is not desired
> > > is it possible to make it optional or perhaps marked when meta-clang
> > > is not in BBLAYERS
> >
> > Thanks a lot for reviewing.  clang is mandotory for BCC to compile
> > eBPF programs, so I think we cannot build clang as optional for BCC.
> >
> > For marking the recipe when meta-clang is not in BBLAYERS, I searched
> > with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable
> > for this case.  Could you give more detailed info for how to do this?
>
> Just want to ask a following question.
>
> Since BCC and bpftrace both are heavily relying on LLVM/Clang for their
> tracing, do you think it's a good idea to merge BCC and bpftrace into
> meta-clang layer, e.g. place into /meta-clang/recipes-devtools/?
> If so, we can easily resolve the dependency issue and avoid to introduce
> mess between meta-oe and meta-clang.
>
> For the tool ply, it's simple and doesn't depend on Clang.  So should
> keep it into meta-oe/recipes-devtools/ folder?  Also welcome any
> suggestion for this.

Yeah I think thats a fine suggestion. meta-clang is good for it.

>
> Thanks,
> Leo Yan


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe
  2020-02-18  5:25 ` [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe Leo Yan
@ 2020-02-19 23:07   ` Khem Raj
  0 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2020-02-19 23:07 UTC (permalink / raw)
  To: Leo Yan, openembedded-devel, Sumit Garg, Daniel Thompson, Loic Poulain



On 2/17/20 9:25 PM, Leo Yan wrote:
> Since luajit 2.1.0-beta3 can support architecture aarch64 and the old
> misses to support aarch64, this patch adds recipe for luajit
> 2.1.0-beta3 building.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>   .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
>   1 file changed, 92 insertions(+)
>   create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
> 
> diff --git a/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb b/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
> new file mode 100644
> index 000000000..167b5d229
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
> @@ -0,0 +1,92 @@
> +SUMMARY = "Just-In-Time Compiler for Lua"
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=10a96c93403affcc34765f4c2612bc22"
> +HOMEPAGE = "http://luajit.org"
> +
> +PV .= "+git${SRCPV}"

I think its best to call it 2.0.5+${SRCPV}

> +SRCREV = "v2.1.0-beta3"

Please use corresponding SHA1 here instead of tags

> +SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1"
> +
> +S = "${WORKDIR}/git"
> +
> +inherit pkgconfig binconfig siteinfo
> +
> +BBCLASSEXTEND = "native"
> +
> +# http://luajit.org/install.html#cross
> +# Host luajit needs to be compiled with the same pointer size
> +# If you want to cross-compile to any 32 bit target on an x64 OS,
> +# you need to install the multilib development package (e.g.
> +# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
> +# (HOST_CC="gcc -m32").
> +BUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
> +
> +# The lua makefiles expect the TARGET_SYS to be from uname -s
> +# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
> +LUA_TARGET_OS = "Unknown"
> +LUA_TARGET_OS_darwin = "Darwin"
> +LUA_TARGET_OS_linux = "Linux"
> +LUA_TARGET_OS_linux-gnueabi = "Linux"
> +LUA_TARGET_OS_mingw32 = "Windows"
> +
> +# We don't want the lua buildsystem's compiler optimizations, or its
> +# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
> +# to both host and target compiles
> +EXTRA_OEMAKE = "\
> +    Q= E='@:' \
> +    \
> +    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
> +    \
> +    'TARGET_SYS=${LUA_TARGET_OS}' \
> +    \
> +    'CC=${CC}' \
> +    'TARGET_AR=${AR} rcus' \
> +    'TARGET_CFLAGS=${CFLAGS}' \
> +    'TARGET_LDFLAGS=${LDFLAGS}' \
> +    'TARGET_SHLDFLAGS=${LDFLAGS}' \
> +    'HOST_CC=${BUILD_CC}' \
> +    'HOST_CFLAGS=${BUILD_CFLAGS}' \
> +    \
> +    'PREFIX=${prefix}' \
> +    'MULTILIB=${baselib}' \
> +    'LDCONFIG=:' \
> +"
> +
> +do_compile () {
> +    oe_runmake
> +}
> +
> +# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
> +# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
> +# expectations.
> +EXTRA_OEMAKEINST = "\
> +    'DESTDIR=${D}' \
> +    'INSTALL_BIN=${D}${bindir}' \
> +    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
> +    'INSTALL_MAN=${D}${mandir}/man1' \
> +"
> +do_install () {
> +    oe_runmake ${EXTRA_OEMAKEINST} install
> +    rmdir ${D}${datadir}/lua/5.* \
> +          ${D}${datadir}/lua \
> +          ${D}${libdir}/lua/5.* \
> +          ${D}${libdir}/lua
> +}
> +
> +PACKAGES += 'luajit-common'
> +
> +# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
> +# paths are packaged regardless of what the libdir and datadir paths are.
> +FILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
> +FILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
> +    ${libdir}/libluajit-5.1.so.${PV} \
> +"
> +FILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
> +    ${libdir}/libluajit-5.1.so \
> +    ${libdir}/pkgconfig/luajit.pc \
> +"
> +FILES_luajit-common = "${datadir}/${BPN}-${PV}"
> +
> +# mips64 is not supported in this release
> +COMPATIBLE_HOST_mipsarchn32 = "null"
> +COMPATIBLE_HOST_mipsarchn64 = "null"

sync this with latest changes to 5.0.4 recipe there are more arches 
where it is not ported yet.

Also delete the old recipe in the same patch.

> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version
  2020-02-18  5:25 ` [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version Leo Yan
@ 2020-02-20 15:41   ` Khem Raj
  2020-02-21  9:03     ` Leo Yan
  0 siblings, 1 reply; 12+ messages in thread
From: Khem Raj @ 2020-02-20 15:41 UTC (permalink / raw)
  To: Leo Yan; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

fails to build fot x86/musl
http://errors.yoctoproject.org/Errors/Details/391871/

On Mon, Feb 17, 2020 at 9:26 PM Leo Yan <leo.yan@linaro.org> wrote:
>
> Ply is a light-weight eBPF tool which compiles ply script or one-liner
> to Linux BPF programs and attaches to kprobes and tracepoints.  It
> doesn't require external dependencies except libc, so it's very friendly
> for embedded system usage.
>
> This patch adds the recipe to support ply building for git version.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  meta-oe/recipes-devtools/ply/ply_git.bb | 27 +++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb
>
> diff --git a/meta-oe/recipes-devtools/ply/ply_git.bb b/meta-oe/recipes-devtools/ply/ply_git.bb
> new file mode 100644
> index 000000000..b8295386c
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/ply/ply_git.bb
> @@ -0,0 +1,27 @@
> +SUMMARY = "Ply: A light-weight dynamic tracer for eBPF"
> +HOMEPAGE = "https://github.com/iovisor/ply"
> +LICENSE = "GPLv2"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> +
> +DEPENDS += "bison-native"
> +
> +SRC_URI = "git://github.com/iovisor/ply"
> +SRCREV = "aa5b9ac31307ec1acece818be334ef801c802a12"
> +
> +S = "${WORKDIR}/git"
> +
> +do_configure_prepend() {
> +    ( cd ${S}; ./autogen.sh; cd - )
> +}
> +
> +do_configure() {
> +    ( cd ${S}; ./configure --host=${TARGET_SYS} --prefix=${D}${prefix}; cd - )
> +}
> +
> +do_compile() {
> +    ( cd ${S}; oe_runmake; cd - )
> +}
> +
> +do_install() {
> +    ( cd ${S}; oe_runmake install; cd - )
> +}
> --
> 2.17.1
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version
  2020-02-20 15:41   ` Khem Raj
@ 2020-02-21  9:03     ` Leo Yan
  0 siblings, 0 replies; 12+ messages in thread
From: Leo Yan @ 2020-02-21  9:03 UTC (permalink / raw)
  To: Khem Raj; +Cc: Daniel Thompson, Loic Poulain, openembeded-devel

Hi Khem,

On Thu, Feb 20, 2020 at 07:41:35AM -0800, Khem Raj wrote:
> fails to build fot x86/musl
> http://errors.yoctoproject.org/Errors/Details/391871/

Ply doesn't support x86 and it supports x86_64.  Will fix the dependency
issue in the new patch with adding two lines:

COMPATIBLE_HOST_i586 = 'null'
COMPATIBLE_HOST_i686 = 'null'

Thanks a lot for the testing; will send new patch with addressing your
comments and test on qemux86 and qemux86_64.

Thanks,
Leo


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-21  9:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18  5:25 [meta-oe][PATCH v1 0/4] eBPF tools: Add recipes Leo Yan
2020-02-18  5:25 ` [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version Leo Yan
2020-02-20 15:41   ` Khem Raj
2020-02-21  9:03     ` Leo Yan
2020-02-18  5:25 ` [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe Leo Yan
2020-02-19 23:07   ` Khem Raj
2020-02-18  5:25 ` [meta-oe][PATCH v1 3/4] BCC: Add build recipe Leo Yan
2020-02-18  6:30   ` Khem Raj
2020-02-18  7:27     ` Leo Yan
2020-02-19  9:44       ` Leo Yan
2020-02-19 17:16         ` Khem Raj
2020-02-18  5:25 ` [meta-oe][PATCH v1 4/4] bpftrace: " Leo Yan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.