diff mbox series

[meta-oe,3/3] rtc-testbench: add recipe

Message ID 20260613121024.2957723-3-patel.rajkumar@oss.qualcomm.com
State Under Review
Headers show
Series [meta-oe,1/3] xdp-tools: add recipe | expand

Commit Message

Rajkumar Patel June 13, 2026, 12:10 p.m. UTC
Add recipe for rtc-testbench v5.4, a real-time and non-real-time traffic
validation tool for converged TSN networks from Linutronix. It validates
real-time performance and robustness of hardware, drivers, and the Linux
network stack on TSN-enabled Ethernet networks using AF_PACKET or AF_XDP
with eBPF, supporting protocols like PROFINET and OPC UA PubSub.

rtc-testbench depends on libxdp provided by xdp-tools.

Depends-on: xdp-tools: upgrade 1.2.10 -> 1.6.3

Signed-off-by: Rajkumar Patel <patel.rajkumar@oss.qualcomm.com>
---
 ...ake-BPF-clang-and-include-paths-conf.patch | 54 +++++++++++++++++++
 .../rtc-testbench/rtc-testbench_5.4.bb        | 40 ++++++++++++++
 2 files changed, 94 insertions(+)
 create mode 100644 meta-oe/recipes-test/rtc-testbench/files/0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch
 create mode 100644 meta-oe/recipes-test/rtc-testbench/rtc-testbench_5.4.bb
diff mbox series

Patch

diff --git a/meta-oe/recipes-test/rtc-testbench/files/0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch b/meta-oe/recipes-test/rtc-testbench/files/0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch
new file mode 100644
index 0000000000..da1ea3bb33
--- /dev/null
+++ b/meta-oe/recipes-test/rtc-testbench/files/0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch
@@ -0,0 +1,54 @@ 
+From 53c57b337a51a47b0edca64d88ef9aaacce90044 Mon Sep 17 00:00:00 2001
+From: Rajkumar Patel <patel.rajkumar@oss.qualcomm.com>
+Date: Wed, 10 Jun 2026 11:39:40 +0530
+Subject: [PATCH] CMakeLists.txt: make BPF clang and include paths configurable
+ for cross-builds
+
+The upstream CMakeLists.txt hardcodes the clang binary name and
+derives the BPF include path from CMAKE_C_LIBRARY_ARCHITECTURE,
+which is empty in a cross-compilation environment. This causes
+the BPF kernel programs to be compiled with the host clang and
+-I /usr/include/ (the build host include path), which fails with:
+
+  fatal error: 'asm/types.h' file not found
+
+Fix by converting the hardcoded values to CMake CACHE variables
+so they can be overridden from the recipe via -DCLANG=,
+-DBPF_INCLUDE_DIRS=, and -DBPF_EXTRA_FLAGS=.
+
+Upstream-Status: Inappropriate [OE cross-compilation specific]
+
+Signed-off-by: Rajkumar Patel <patel.rajkumar@oss.qualcomm.com>
+---
+ CMakeLists.txt | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f782304..7f284f9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -174,15 +174,21 @@ include_directories("${PROJECT_BINARY_DIR}")
+ #
+ # Add code for compiling XDP eBPF programes.
+ #
+-set(ASM_INCLUDE "/usr/include/${CMAKE_C_LIBRARY_ARCHITECTURE}")
++set(CLANG "clang" CACHE STRING "Clang binary used for BPF compilation")
++set(BPF_INCLUDE_DIRS "" CACHE STRING "Sysroot include path for BPF compilation")
++set(BPF_EXTRA_FLAGS "" CACHE STRING "Extra flags for BPF clang compilation (space-separated)")
++
++separate_arguments(BPF_EXTRA_FLAGS_LIST UNIX_COMMAND "${BPF_EXTRA_FLAGS}")
++
+ set(CLANG_FLAGS -Wall -O2 -fno-stack-protector
+-    -I ${ASM_INCLUDE}
++    ${BPF_EXTRA_FLAGS_LIST}
++    -I ${BPF_INCLUDE_DIRS}
+     -I ${PROJECT_BINARY_DIR}  # required for app_config.h
+ )
+ 
+ function(add_xdp_prog name)
+   add_custom_target(${name} ALL
+-    COMMAND clang ${CLANG_FLAGS} -target bpf -c -g -o ${CMAKE_BINARY_DIR}/${name}.o ${name}.c
++    COMMAND ${CLANG} ${CLANG_FLAGS} -target bpf -c -g -o ${CMAKE_BINARY_DIR}/${name}.o ${name}.c
+     DEPENDS reference
+     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src
+     SOURCES src/${name}.c
diff --git a/meta-oe/recipes-test/rtc-testbench/rtc-testbench_5.4.bb b/meta-oe/recipes-test/rtc-testbench/rtc-testbench_5.4.bb
new file mode 100644
index 0000000000..81a4d9d01b
--- /dev/null
+++ b/meta-oe/recipes-test/rtc-testbench/rtc-testbench_5.4.bb
@@ -0,0 +1,40 @@ 
+SUMMARY = "Real-time and non-real-time traffic validation tool for converged TSN networks"
+
+DESCRIPTION = "The Linux RealTime Communication Testbench validates real-time \
+performance and robustness of hardware, drivers, and the Linux network stack on \
+TSN-enabled Ethernet networks. It generates and mirrors cyclic traffic using \
+AF_PACKET or AF_XDP with eBPF, supporting protocols like PROFINET and OPC UA PubSub."
+
+HOMEPAGE = "https://github.com/Linutronix/RTC-Testbench"
+LICENSE = "BSD-2-Clause & (GPL-2.0-only | BSD-2-Clause)"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE;md5=f39e57686080f8752e19c4cd3e04e351 \
+    file://LICENSES/BSD-2-Clause.txt;md5=9e16594a228301089d759b4f178db91f \
+    file://LICENSES/GPL-2.0-only.txt;md5=3d26203303a722dedc6bf909d95ba815 \
+"
+SRC_URI = " \
+    git://github.com/Linutronix/RTC-Testbench.git;tag=v${PV};nobranch=1;protocol=https \
+    file://0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch \
+"
+SRCREV = "bf016fdf422094f1ef65c0d88f148f46663ebbd8"
+
+DEPENDS += " \
+    libyaml \
+    libbpf \
+    xdp-tools \
+    openssl \
+    clang-native \
+"
+
+inherit cmake pkgconfig
+
+EXTRA_OECMAKE += " \
+    -DRX_TIMESTAMP=ON \
+    -DTX_TIMESTAMP=ON \
+    -DCLANG=${STAGING_BINDIR_NATIVE}/clang \
+    -DBPF_INCLUDE_DIRS=${STAGING_INCDIR} \
+    -DBPF_EXTRA_FLAGS='-D__${TARGET_ARCH}__ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${STAGING_DIR_HOST}=' \
+"
+
+# Require bash since installed scripts use /bin/bash shebang
+RDEPENDS:${PN} += "bash"