diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-configure-skip-toolchain-checks.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-configure-skip-toolchain-checks.patch new file mode 100644 index 00000000..b5f2780e --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-configure-skip-toolchain-checks.patch @@ -0,0 +1,44 @@ +From 9c9dce2e5f04de65b7b00321f96fff6071546ea1 Mon Sep 17 00:00:00 2001 +From: Naveen Saini +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 + +--- + configure | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/configure b/configure +index b4e824f..10618fc 100755 +--- a/configure ++++ b/configure +@@ -70,12 +70,12 @@ 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 +- echo "*** ERROR: Cannot find tool ${TOOL}" ; +- exit 1; +- fi; +- done ++ #for TOOL in $PKG_CONFIG $CC $OBJCOPY $CLANG $M4 $READELF; do ++ # if [ ! $(command -v ${TOOL} 2>/dev/null) ]; then ++ # echo "*** ERROR: Cannot find tool ${TOOL}" ; ++ # exit 1; ++ # fi; ++ #done + + ARCH_NAME=$($CC -print-multiarch 2>/dev/null) + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-defines.mk-Add-missing-prefix-map-settings-for-OE-bu.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-defines.mk-Add-missing-prefix-map-settings-for-OE-bu.patch new file mode 100644 index 00000000..faaf6bc2 --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-defines.mk-Add-missing-prefix-map-settings-for-OE-bu.patch @@ -0,0 +1,40 @@ +From a7698c7172a8a178efd73bdc0ce31d4aa3646f6e Mon Sep 17 00:00:00 2001 +From: Ryan Eatmon +Date: Mon, 5 May 2025 14:30:10 -0500 +Subject: [PATCH] defines.mk: Add missing prefix-map settings for OE builds + +The defines was only pulling in one of the four *-prefix-map options +from CFLAGS. + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Ryan Eatmon +--- + lib/defines.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/defines.mk b/lib/defines.mk +index 411a97e..6061e81 100644 +--- a/lib/defines.mk ++++ b/lib/defines.mk +@@ -26,7 +26,7 @@ TEST_DIR = $(LIB_DIR)/testing + LIBXDP_DIR := $(LIB_DIR)/libxdp + LIBBPF_DIR := $(LIB_DIR)/libbpf + +-DEFINES := -DBPF_DIR_MNT=\"$(BPF_DIR_MNT)\" -DBPF_OBJECT_PATH=\"$(BPF_OBJECT_DIR)\" \ ++DEFINES := -DBPF_DIR_MNT=\"$(BPF_DIR_MNT)\" -DBPF_OBJECT_PATH=\"$(OE_BPF_OBJECT_DIR)\" \ + -DMAX_DISPATCHER_ACTIONS=$(MAX_DISPATCHER_ACTIONS) -DTOOLS_VERSION=\"$(TOOLS_VERSION)\" \ + -DLIBBPF_VERSION=\"$(LIBBPF_VERSION)\" -DRUNDIR=\"$(RUNDIR)\" + +@@ -43,7 +43,7 @@ endif + DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + + CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES) $(ARCH_INCLUDES) +-BPF_CFLAGS += $(DEFINES) $(filter -ffile-prefix-map=%,$(CFLAGS)) $(filter -I%,$(CFLAGS)) $(ARCH_INCLUDES) ++BPF_CFLAGS += $(DEFINES) $(filter -fcoverage-prefix-map=%,$(CFLAGS)) $(filter -fdebug-prefix-map=%,$(CFLAGS)) $(filter -ffile-prefix-map=%,$(CFLAGS)) $(filter -fmacro-prefix-map=%,$(CFLAGS)) $(filter -I%,$(CFLAGS)) $(ARCH_INCLUDES) + + CONFIGMK := $(LIB_DIR)/../config.mk + LIBMK := Makefile $(CONFIGMK) $(LIB_DIR)/defines.mk $(LIB_DIR)/common.mk $(LIB_DIR)/../version.mk +-- +2.17.1 + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-xdpsock-Fix-32bit-compile-error.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-xdpsock-Fix-32bit-compile-error.patch new file mode 100644 index 00000000..da439bf1 --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0001-xdpsock-Fix-32bit-compile-error.patch @@ -0,0 +1,42 @@ +From 9b649be4876a3e42c44e57013840904006530e52 Mon Sep 17 00:00:00 2001 +From: Ryan Eatmon +Date: Tue, 17 Feb 2026 15:11:18 -0600 +Subject: [PATCH] xdpsock: Fix 32bit compile error + +Using UINT64_MAX on a 32bit machine results in a compile error where +unsigned long cannot be cast to an unsigned long long. Since this is +trying to handle an error case and return a big number, switch to +ULONG_MAX to match the type being returned regardless of the compiler +bits (32/64). + +Upstream-Status: Submitted [https://github.com/xdp-project/xdp-tools/pull/553] + +Signed-off-by: Ryan Eatmon +--- + lib/util/xdpsock.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/util/xdpsock.c b/lib/util/xdpsock.c +index 5d71e6a..899c3a3 100644 +--- a/lib/util/xdpsock.c ++++ b/lib/util/xdpsock.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -171,7 +172,7 @@ static unsigned long get_nsecs(clockid_t clock) + res = clock_gettime(clock, &ts); + if (res < 0) { + pr_warn("Error with gettimeofday! (%i)\n", res); +- return UINT64_MAX; ++ return ULONG_MAX; + } + return ts.tv_sec * 1000000000UL + ts.tv_nsec; + } +-- +2.43.0 + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch new file mode 100644 index 00000000..df1543c7 --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0002-Makefile-It-does-not-detect-libbpf-header-from-sysro.patch @@ -0,0 +1,44 @@ +From 2840cf0b89497f545fae2eed7ece3f3c5fc558e3 Mon Sep 17 00:00:00 2001 +From: Naveen Saini +Date: Mon, 17 Oct 2022 15:50:34 +0800 +Subject: [PATCH 2/4] Makefile: It does not detect libbpf header from sysroot + +So adding sysroot headers path. + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Naveen Saini +--- + lib/common.mk | 2 +- + lib/libxdp/Makefile | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/common.mk b/lib/common.mk +index 56c0406..ab0bad8 100644 +--- a/lib/common.mk ++++ b/lib/common.mk +@@ -55,7 +55,7 @@ LIBXDP_SOURCES := $(wildcard $(LIBXDP_DIR)/*.[ch] $(LIBXDP_DIR)/*.in) + KERN_USER_H ?= $(wildcard common_kern_user.h) + + CFLAGS += -I$(HEADER_DIR) -I$(LIB_DIR)/util $(ARCH_INCLUDES) +-BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES) ++BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES) -I${STAGING_INCDIR}/ + + BPF_HEADERS := $(wildcard $(HEADER_DIR)/bpf/*.h) $(wildcard $(HEADER_DIR)/xdp/*.h) + +diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile +index 358b751..8f459d8 100644 +--- a/lib/libxdp/Makefile ++++ b/lib/libxdp/Makefile +@@ -28,7 +28,7 @@ PC_FILE := $(OBJDIR)/libxdp.pc + TEMPLATED_SOURCES := xdp-dispatcher.c + + CFLAGS += -I$(HEADER_DIR) +-BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES) ++BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES) -I${STAGING_INCDIR}/ + + + ifndef BUILD_STATIC_ONLY +-- +2.25.1 + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0003-Makefile-fix-KeyError-failure.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0003-Makefile-fix-KeyError-failure.patch new file mode 100644 index 00000000..d0133bcb --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0003-Makefile-fix-KeyError-failure.patch @@ -0,0 +1,31 @@ +From 157546fbc4f18751c52b3c8788879c05cf253331 Mon Sep 17 00:00:00 2001 +From: Naveen Saini +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 +--- + 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 +@@ -54,7 +54,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 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) +-- +2.25.1 + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0004-Makefile-fix-libxdp.pc-error.patch b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0004-Makefile-fix-libxdp.pc-error.patch new file mode 100644 index 00000000..b1e15e52 --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti/0004-Makefile-fix-libxdp.pc-error.patch @@ -0,0 +1,34 @@ +From 46b3ff797135574aa0ee42f633a281d44f48da95 Mon Sep 17 00:00:00 2001 +From: Naveen Saini +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 +--- + 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 + diff --git a/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti_1.6.1.bb b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti_1.6.1.bb new file mode 100644 index 00000000..e25ae146 --- /dev/null +++ b/meta-ti-test/recipes-support/xdp-tools/xdp-tools-ti_1.6.1.bb @@ -0,0 +1,51 @@ +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 zlib elfutils libpcap" +DEPENDS += " clang-cross-${TARGET_ARCH} bpftool-native" + +SRC_URI = "git://github.com/xdp-project/xdp-tools.git;protocol=https;branch=main \ + 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 \ + file://0001-defines.mk-Add-missing-prefix-map-settings-for-OE-bu.patch \ + file://0001-xdpsock-Fix-32bit-compile-error.patch \ + " + +SRCREV = "84906a0fe98cbb5e5eaa2c888c50a1ab32d5d0b7" + +inherit pkgconfig + +EXTRA_OEMAKE += " PREFIX=${D}${prefix} LIBDIR=${D}${libdir} BUILD_STATIC_ONLY=1 PRODUCTION=1 V=1" +EXTRA_OEMAKE += " OE_BPF_OBJECT_DIR=${libdir}/bpf" +EXTRA_OEMAKE += " CLANG="${TARGET_PREFIX}clang --sysroot=${RECIPE_SYSROOT}"" + +CFLAGS += "-fPIC" + +export STAGING_INCDIR + +do_compile:prepend:aarch64 () { + mkdir -p ${S}/headers/asm + cp ${RECIPE_SYSROOT}/usr/include/asm/bitsperlong-64.h ${S}/headers/asm/bitsperlong-32.h + cp ${RECIPE_SYSROOT}/usr/include/asm/byteorder-64.h ${S}/headers/asm/byteorder-32.h + cp ${RECIPE_SYSROOT}/usr/include/asm/posix_types-64.h ${S}/headers/asm/posix_types-32.h + cp ${RECIPE_SYSROOT}/usr/include/asm/swab-64.h ${S}/headers/asm/swab-32.h + cp ${RECIPE_SYSROOT}/usr/include/asm/types-64.h ${S}/headers/asm/types-32.h +} + +do_install() { + oe_runmake install +} + +FILES:${PN} += "${datadir}/xdp-tools/* \ + ${nonarch_base_libdir}/bpf/* \ + " + +RDEPENDS:${PN} += "bash" +