Skip to contentSkip to conversation

xdp-tools: add recipe

PATCH New Rajkumar Patel 1 participant 3 messages Jun 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 xdp-tools: add recipe

Import xdp-tools recipe from meta-dpdk to meta-oe.

xdp-tools provides a set of utilities and helpers for working with XDP (eXpress Data Path) and eBPF-based packet processing in the Linux networking stack.

Although currently available in meta-dpdk, xdp-tools is a standalone utility with no direct dependency on DPDK, and is generally useful for networking and XDP-based workflows. Adding it to meta-oe makes it available without requiring the meta-dpdk layer.

---
 ...0001-configure-skip-toolchain-checks.patch | 44 +++++++++++++++++++
 ...-not-detect-libbpf-header-from-sysro.patch | 44 +++++++++++++++++++
 .../0003-Makefile-fix-KeyError-failure.patch  | 31 +++++++++++++
 .../0004-Makefile-fix-libxdp.pc-error.patch   | 34 ++++++++++++++
 .../xdp-tools/xdp-tools_1.2.10.bb             | 36 +++++++++++++++
 5 files changed, 189 insertions(+)
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0001-configure-skip-toolchain-checks.patch
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0003-Makefile-fix-KeyError-failure.patch
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0004-Makefile-fix-libxdp.pc-error.patch
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools_1.2.10.bb
meta-oe/recipes-support/xdp-tools/xdp-tools/0001-configure-skip-toolchain-checks.patch new file +44 -0
new file mode 100644
index 0000000000..0c891528cb
@@ -0,0 +1,44 @@
+From 9c9dce2e5f04de65b7b00321f96fff6071546ea1 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Mon, 17 Oct 2022 15:44:16 +0800
+Subject: [PATCH] configure: skip toolchain checks
+
+Current logic fetch full command line along with the tool. i.e
+gcc -m64 -march=skylake -mtune=generic ...
+
+Which throws ERROR: Cannot find tool -m64
+
+So need to re-write for loop, so it can work in cross-compilation
+environment too.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+
+---
+ configure | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/configure b/configure
+index b4e824f..10618fc 100755
+--- a/configure
++++ b/configure
+@@ -69,12 +69,12 @@ check_toolchain()
+     CLANG=$(find_tool clang "$CLANG")
+     LLC=$(find_tool llc "$LLC")
+ 
+-    for TOOL in $PKG_CONFIG $CC $LD $OBJCOPY $CLANG $LLC $M4; do
+-        if [ ! $(command -v ${TOOL} 2>/dev/null) ]; then
+-            echo "*** ERROR: Cannot find tool ${TOOL}" ;
+-            exit 1;
+-        fi;
+-    done
++    #for TOOL in $PKG_CONFIG $CC $LD $OBJCOPY $CLANG $LLC $M4; do
++    #    if [ ! $(command -v ${TOOL} 2>/dev/null) ]; then
++    #        echo "*** ERROR: Cannot find tool ${TOOL}" ;
++    #        exit 1;
++    #    fi;
++    #done
+ 
+     clang_version=$($CLANG --version | grep -Po '(?<=clang version )[[:digit:]]+')
+     if [ "$?" -ne "0" ]; then
meta-oe/recipes-support/xdp-tools/xdp-tools/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch new file +44 -0

44 lines not on this page · raw message

meta-oe/recipes-support/xdp-tools/xdp-tools/0003-Makefile-fix-KeyError-failure.patch new file +31 -0
new file mode 100644
index 0000000000..41c57f6eb2
@@ -0,0 +1,31 @@
+From 157546fbc4f18751c52b3c8788879c05cf253331 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Mon, 17 Oct 2022 16:02:46 +0800
+Subject: [PATCH 3/4] Makefile: fix KeyError failure
+
+Error:
+Exception: KeyError: 'getpwuid(): uid not found: 11857215'
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+---
+ lib/libxdp/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
+index 8f459d8..9a340a3 100644
+--- a/lib/libxdp/Makefile
++++ b/lib/libxdp/Makefile
+@@ -55,7 +55,7 @@ install: all
+ 	$(Q)install -d -m 0755 $(DESTDIR)$(BPF_OBJECT_DIR)
+ 	$(Q)install -m 0644 $(LIB_HEADERS) $(DESTDIR)$(HDRDIR)/
+ 	$(Q)install -m 0644 $(PC_FILE) $(DESTDIR)$(LIBDIR)/pkgconfig/
+-	$(Q)cp -fpR $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
++	$(Q)cp -fpR --no-preserve=ownership $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
+ 	$(Q)install -m 0755 $(XDP_OBJS) $(DESTDIR)$(BPF_OBJECT_DIR)
+ 	$(if $(MAN_FILES),$(Q)install -m 0755 -d $(DESTDIR)$(MANDIR)/man3)
+ 	$(if $(MAN_FILES),$(Q)install -m 0644 $(MAN_FILES) $(DESTDIR)$(MANDIR)/man3)
+-- 
+2.25.1
+
meta-oe/recipes-support/xdp-tools/xdp-tools/0004-Makefile-fix-libxdp.pc-error.patch new file +34 -0
new file mode 100644
index 0000000000..b1e15e5216
@@ -0,0 +1,34 @@
+From 46b3ff797135574aa0ee42f633a281d44f48da95 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Mon, 17 Oct 2022 16:05:15 +0800
+Subject: [PATCH 4/4] Makefile: fix libxdp.pc error
+
+Error:
+do_populate_sysroot: QA Issue: libxdp.pc failed sanity test (tmpdir) in
+path ... xdp-tools/1.2.8-r0/sysroot-destdir/usr/lib/pkgconfig [pkgconfig]
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+---
+ lib/libxdp/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
+index 9a340a3..bc39177 100644
+--- a/lib/libxdp/Makefile
++++ b/lib/libxdp/Makefile
+@@ -76,8 +76,8 @@ $(OBJDIR)/libxdp.so.$(LIBXDP_VERSION): $(SHARED_OBJS)
+ 		      $^ $(LDFLAGS) $(LDLIBS) -o $@
+ 
+ $(OBJDIR)/libxdp.pc:
+-	$(Q)sed -e "s|@PREFIX@|$(PREFIX)|" \
+-			-e "s|@LIBDIR@|$(LIBDIR)|" \
++	$(Q)sed -e "s|@PREFIX@|$(prefix)|" \
++			-e "s|@LIBDIR@|$(libdir)|" \
+ 			-e "s|@VERSION@|$(TOOLS_VERSION)|" \
+ 			< libxdp.pc.template > $@
+ 
+-- 
+2.25.1
+
meta-oe/recipes-support/xdp-tools/xdp-tools_1.2.10.bb new file +36 -0
new file mode 100644
index 0000000000..4a06124caf
@@ -0,0 +1,36 @@
+SUMMARY = "Utilities and example programs for use with XDP"
+HOMEPAGE = "https://github.com/xdp-project/xdp-tools"
+LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9ee53f8d06bbdb4c11b1557ecc4f8cd5 \
+                    file://LICENSES/GPL-2.0;md5=994331978b428511800bfbd17eea3001 \
+                    file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd \
+                    file://LICENSES/BSD-2-Clause;md5=5d6306d1b08f8df623178dfd81880927"
+
+DEPENDS += " libbpf clang-native zlib elfutils libpcap"
+
+SRC_URI = "git://github.com/xdp-project/xdp-tools.git;branch=v1.2;protocol=https \
+            file://0001-configure-skip-toolchain-checks.patch \
+            file://0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch \
+            file://0003-Makefile-fix-KeyError-failure.patch \
+            file://0004-Makefile-fix-libxdp.pc-error.patch \
+          "
+
+SRCREV = "57a139f9bf6ef644f9c1deb4f7df4bb4c76d6179"
+
+
+inherit pkgconfig
+
+EXTRA_OEMAKE += "PREFIX=${D}${prefix} LIBDIR=${D}${libdir} BUILD_STATIC_ONLY=1 PRODUCTION=1"
+
+CFLAGS += "-fPIC"
+
+export STAGING_INCDIR
+
+do_install () {
+    oe_runmake install
+
+    # Remove object files *.o
+    rm -rf ${D}/${libdir}/bpf
+}
+
+RDEPENDS:${PN} += "bash"
#1 lore raw

PATCH 2/3 xdp-tools: upgrade 1.2.10 -> 1.6.3

Drop patches 0002 and 0004 as they are no longer needed with 1.6.3.

Rework patches 0001 and 0003 to properly handle CC tool validation and libxdp symlink installation for cross-compilation.

Set PRODUCTION=1 and pass BPF_CFLAGS with sysroot include paths and ffile-prefix-map for reproducible cross-compilation builds.

Include ${libdir}/bpf/* in FILES:${PN} as libxdp.so resolves BPF objects at runtime from that path. Add bash to RDEPENDS for the test scripts.

---
 ...tly-handle-CC-when-validating-requir.patch | 45 ++++++++++++++++++
 ...ile-use-cp-fRd-to-preserve-symlinks-.patch | 36 ++++++++++++++
 ...0001-configure-skip-toolchain-checks.patch | 44 -----------------
 ...-not-detect-libbpf-header-from-sysro.patch | 44 -----------------
 .../0003-Makefile-fix-KeyError-failure.patch  | 31 ------------
 .../0004-Makefile-fix-libxdp.pc-error.patch   | 34 --------------
 .../xdp-tools/xdp-tools_1.2.10.bb             | 36 --------------
 .../xdp-tools/xdp-tools_1.6.3.bb              | 47 +++++++++++++++++++
 8 files changed, 128 insertions(+), 189 deletions(-)
 create mode 100644 meta-oe/recipes-support/xdp-tools/files/0001-configure-correctly-handle-CC-when-validating-requir.patch
 create mode 100644 meta-oe/recipes-support/xdp-tools/files/0002-lib-libxdp-Makefile-use-cp-fRd-to-preserve-symlinks-.patch
 delete mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0001-configure-skip-toolchain-checks.patch
 delete mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch
 delete mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0003-Makefile-fix-KeyError-failure.patch
 delete mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools/0004-Makefile-fix-libxdp.pc-error.patch
 delete mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools_1.2.10.bb
 create mode 100644 meta-oe/recipes-support/xdp-tools/xdp-tools_1.6.3.bb
meta-oe/recipes-support/xdp-tools/files/0001-configure-correctly-handle-CC-when-validating-requir.patch new file +45 -0
new file mode 100644
index 0000000000..1102566ab9
@@ -0,0 +1,45 @@
+From 2a6d219ec2f5413e38ec502421cce8a2c6d7f054 Mon Sep 17 00:00:00 2001
+From: Rajkumar Patel <[email protected]>
+Date: Tue, 9 Jun 2026 11:22:13 +0530
+Subject: [PATCH 1/2] configure: correctly handle CC when validating required
+ tools
+
+The tool validation loop checks the availability of required
+binaries using `command -v`. However, when CC is defined with
+additional flags (e.g. "aarch64-linux-gnu-gcc -O2 -pipe"),
+the check fails because `command -v` expects only the binary
+name.
+
+Extract the actual compiler executable from CC by taking the
+first word and include it in the validation list.
+
+This ensures tool detection works correctly in cross-compilation
+environments where CC commonly includes compiler flags.
+
+Additionally, quote variable expansions to avoid issues with
+word splitting and empty values.
+
+Upstream-Status: Pending
+
+Signed-off-by: Rajkumar Patel <[email protected]>
+---
+ configure | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index d57b2ae..a234f80 100755
+--- a/configure
++++ b/configure
+@@ -70,8 +70,10 @@ check_toolchain()
+ 
+     CLANG=$(find_tool clang "$CLANG")
+ 
+-    for TOOL in $PKG_CONFIG $CC $OBJCOPY $CLANG $M4 $READELF; do
+-        if [ ! $(command -v ${TOOL} 2>/dev/null) ]; then
++    CC_TOOL=$(echo "$CC" | awk '{print $1}')
++
++    for TOOL in $PKG_CONFIG "$CC_TOOL" $OBJCOPY $CLANG $M4 $READELF; do
++        if [ ! $(command -v "${TOOL}" 2>/dev/null) ]; then
+             echo "*** ERROR: Cannot find tool ${TOOL}" ;
+             exit 1;
+         fi;
meta-oe/recipes-support/xdp-tools/files/0002-lib-libxdp-Makefile-use-cp-fRd-to-preserve-symlinks-.patch new file +36 -0
new file mode 100644
index 0000000000..bc860ada71
@@ -0,0 +1,36 @@
+From 064ccdaf0d84bea86f9cd17383581c3844a33151 Mon Sep 17 00:00:00 2001
+From: Rajkumar Patel <[email protected]>
+Date: Tue, 9 Jun 2026 11:24:51 +0530
+Subject: [PATCH 2/2] lib/libxdp/Makefile: use cp -fRd to preserve symlinks
+ without metadata
+
+cp -fpR preserves ownership and timestamps from the build host,
+which breaks cross-compilation and packaging QA checks.
+
+The `-p` flag is unnecessary for symlink handling. Replace it
+with `-d` to explicitly preserve symlinks without carrying over
+file metadata.
+
+Switch to cp -fRd to maintain symlink structure while avoiding
+host contamination.
+
+Upstream-Status: Pending
+
+Signed-off-by: Rajkumar Patel <[email protected]>
+---
+ lib/libxdp/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
+index 7ea7e7e..3c36b70 100644
+--- a/lib/libxdp/Makefile
++++ b/lib/libxdp/Makefile
+@@ -56,7 +56,7 @@ install: all
+ 	$(Q)install -d -m 0755 $(DESTDIR)$(BPF_OBJECT_DIR)
+ 	$(Q)install -m 0644 $(LIB_HEADERS) $(DESTDIR)$(HDRDIR)/
+ 	$(Q)install -m 0644 $(PC_FILE) $(DESTDIR)$(LIBDIR)/pkgconfig/
+-	$(Q)cp -fpR $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
++	$(Q)cp -fdR $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
+ 	$(Q)install -m 0644 $(XDP_OBJS) $(DESTDIR)$(BPF_OBJECT_DIR)
+ 	$(if $(MAN_FILES),$(Q)install -m 0755 -d $(DESTDIR)$(MANDIR)/man3)
+ 	$(if $(MAN_FILES),$(Q)install -m 0644 $(MAN_FILES) $(DESTDIR)$(MANDIR)/man3)
meta-oe/recipes-support/xdp-tools/xdp-tools/0001-configure-skip-toolchain-checks.patch deleted +0 -44

44 lines not on this page · raw message

meta-oe/recipes-support/xdp-tools/xdp-tools/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch deleted +0 -44

44 lines not on this page · raw message

meta-oe/recipes-support/xdp-tools/xdp-tools/0003-Makefile-fix-KeyError-failure.patch deleted +0 -31
deleted file mode 100644
index 41c57f6eb2..0000000000
@@ -1,31 +0,0 @@
-From 157546fbc4f18751c52b3c8788879c05cf253331 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <[email protected]>
-Date: Mon, 17 Oct 2022 16:02:46 +0800
-Subject: [PATCH 3/4] Makefile: fix KeyError failure
-
-Error:
-Exception: KeyError: 'getpwuid(): uid not found: 11857215'
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Naveen Saini <[email protected]>
----
- lib/libxdp/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
-index 8f459d8..9a340a3 100644
---- a/lib/libxdp/Makefile
-+++ b/lib/libxdp/Makefile
-@@ -55,7 +55,7 @@ install: all
- 	$(Q)install -d -m 0755 $(DESTDIR)$(BPF_OBJECT_DIR)
- 	$(Q)install -m 0644 $(LIB_HEADERS) $(DESTDIR)$(HDRDIR)/
- 	$(Q)install -m 0644 $(PC_FILE) $(DESTDIR)$(LIBDIR)/pkgconfig/
--	$(Q)cp -fpR $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
-+	$(Q)cp -fpR --no-preserve=ownership $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
- 	$(Q)install -m 0755 $(XDP_OBJS) $(DESTDIR)$(BPF_OBJECT_DIR)
- 	$(if $(MAN_FILES),$(Q)install -m 0755 -d $(DESTDIR)$(MANDIR)/man3)
- 	$(if $(MAN_FILES),$(Q)install -m 0644 $(MAN_FILES) $(DESTDIR)$(MANDIR)/man3)
--- 
-2.25.1
-
meta-oe/recipes-support/xdp-tools/xdp-tools/0004-Makefile-fix-libxdp.pc-error.patch deleted +0 -34
deleted file mode 100644
index b1e15e5216..0000000000
@@ -1,34 +0,0 @@
-From 46b3ff797135574aa0ee42f633a281d44f48da95 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <[email protected]>
-Date: Mon, 17 Oct 2022 16:05:15 +0800
-Subject: [PATCH 4/4] Makefile: fix libxdp.pc error
-
-Error:
-do_populate_sysroot: QA Issue: libxdp.pc failed sanity test (tmpdir) in
-path ... xdp-tools/1.2.8-r0/sysroot-destdir/usr/lib/pkgconfig [pkgconfig]
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Naveen Saini <[email protected]>
----
- lib/libxdp/Makefile | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
-index 9a340a3..bc39177 100644
---- a/lib/libxdp/Makefile
-+++ b/lib/libxdp/Makefile
-@@ -76,8 +76,8 @@ $(OBJDIR)/libxdp.so.$(LIBXDP_VERSION): $(SHARED_OBJS)
- 		      $^ $(LDFLAGS) $(LDLIBS) -o $@
- 
- $(OBJDIR)/libxdp.pc:
--	$(Q)sed -e "s|@PREFIX@|$(PREFIX)|" \
--			-e "s|@LIBDIR@|$(LIBDIR)|" \
-+	$(Q)sed -e "s|@PREFIX@|$(prefix)|" \
-+			-e "s|@LIBDIR@|$(libdir)|" \
- 			-e "s|@VERSION@|$(TOOLS_VERSION)|" \
- 			< libxdp.pc.template > $@
- 
--- 
-2.25.1
-
meta-oe/recipes-support/xdp-tools/xdp-tools_1.2.10.bb deleted +0 -36
deleted file mode 100644
index 4a06124caf..0000000000
@@ -1,36 +0,0 @@
-SUMMARY = "Utilities and example programs for use with XDP"
-HOMEPAGE = "https://github.com/xdp-project/xdp-tools"
-LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=9ee53f8d06bbdb4c11b1557ecc4f8cd5 \
-                    file://LICENSES/GPL-2.0;md5=994331978b428511800bfbd17eea3001 \
-                    file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd \
-                    file://LICENSES/BSD-2-Clause;md5=5d6306d1b08f8df623178dfd81880927"
-
-DEPENDS += " libbpf clang-native zlib elfutils libpcap"
-
-SRC_URI = "git://github.com/xdp-project/xdp-tools.git;branch=v1.2;protocol=https \
-            file://0001-configure-skip-toolchain-checks.patch \
-            file://0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch \
-            file://0003-Makefile-fix-KeyError-failure.patch \
-            file://0004-Makefile-fix-libxdp.pc-error.patch \
-          "
-
-SRCREV = "57a139f9bf6ef644f9c1deb4f7df4bb4c76d6179"
-
-
-inherit pkgconfig
-
-EXTRA_OEMAKE += "PREFIX=${D}${prefix} LIBDIR=${D}${libdir} BUILD_STATIC_ONLY=1 PRODUCTION=1"
-
-CFLAGS += "-fPIC"
-
-export STAGING_INCDIR
-
-do_install () {
-    oe_runmake install
-
-    # Remove object files *.o
-    rm -rf ${D}/${libdir}/bpf
-}
-
-RDEPENDS:${PN} += "bash"
meta-oe/recipes-support/xdp-tools/xdp-tools_1.6.3.bb new file +47 -0

47 lines not on this page · raw message

#2 lore raw

PATCH 3/3 rtc-testbench: add recipe

In reply to Rajkumar Patel

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

---
 ...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
meta-oe/recipes-test/rtc-testbench/files/0001-CMakeLists.txt-make-BPF-clang-and-include-paths-conf.patch new file +54 -0
new file mode 100644
index 0000000000..da1ea3bb33
@@ -0,0 +1,54 @@
+From 53c57b337a51a47b0edca64d88ef9aaacce90044 Mon Sep 17 00:00:00 2001
+From: Rajkumar Patel <[email protected]>
+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 <[email protected]>
+---
+ 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
meta-oe/recipes-test/rtc-testbench/rtc-testbench_5.4.bb new file +40 -0
new file mode 100644
index 0000000000..81a4d9d01b
@@ -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"