aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-03-15 14:33:59 +0100
committerFelix Fietkau <nbd@nbd.name>2022-03-19 07:30:06 +0100
commit00cbf6f6ab1d5c45a40c68167af897c9526542e8 (patch)
treef34380b7668b3ed2263ca5793546c447a49e2cf8 /package/network
parent9c8cd1462d939bdd7f01f4daa3cb86f512d0e75f (diff)
downloadupstream-00cbf6f6ab1d5c45a40c68167af897c9526542e8.tar.gz
upstream-00cbf6f6ab1d5c45a40c68167af897c9526542e8.tar.bz2
upstream-00cbf6f6ab1d5c45a40c68167af897c9526542e8.zip
bpftools: update to standalone bpftools + libbpf, use the latest version
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/config/qosify/Makefile2
-rw-r--r--package/network/utils/bpftools/Makefile72
-rw-r--r--package/network/utils/bpftools/patches/001-cflags.patch10
-rw-r--r--package/network/utils/bpftools/patches/002-includes.patch26
-rw-r--r--package/network/utils/bpftools/patches/005-tools-arch-powerpc-fix-EDEADLOCK-redefinition-errors.patch51
-rw-r--r--package/network/utils/bpftools/patches/006-musl-120.patch20
6 files changed, 64 insertions, 117 deletions
diff --git a/package/network/config/qosify/Makefile b/package/network/config/qosify/Makefile
index 881d429613..7aac759bcb 100644
--- a/package/network/config/qosify/Makefile
+++ b/package/network/config/qosify/Makefile
@@ -34,6 +34,8 @@ define Package/qosify
DEPENDS:=+libbpf +libubox +libubus +kmod-sched-cake +kmod-sched-bpf +kmod-ifb +tc-full $(BPF_DEPENDS)
endef
+TARGET_CFLAGS += -Wno-error=deprecated-declarations
+
define Build/Compile
$(call CompileBPF,$(PKG_BUILD_DIR)/qosify-bpf.c)
$(Build/Compile/Default)
diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile
index f044cc81f8..406481d784 100644
--- a/package/network/utils/bpftools/Makefile
+++ b/package/network/utils/bpftools/Makefile
@@ -8,12 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bpftools
-PKG_VERSION:=5.11.16
PKG_RELEASE:=1
-PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
-PKG_HASH:=21163681d130cbce5a6be39019e2c69e44f284855ddd70b1a3bd039249540f43
+PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_DATE:=2022-03-08
+PKG_SOURCE_VERSION:=04c465fd1f561f67796dc68bbfe1aa7cfa956c3c
+PKG_MIRROR_HASH:=e22a954cd186f43228a96586bbdc120b11e6c87360ab88ae96ba37afb9c7cb58
+PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
@@ -21,16 +23,6 @@ PKG_USE_MIPS16:=0
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
-LINUX_VERSION:=$(PKG_VERSION)
-LINUX_TLD:=linux-$(LINUX_VERSION)
-
-BPF_FILES:= \
- kernel/bpf scripts tools/Makefile tools/bpf tools/perf/perf-sys.h \
- tools/arch tools/build tools/include tools/lib tools/scripts
-TAR_OPTIONS+= \
- --transform="s;$(LINUX_TLD)/;$(PKG_NAME)-$(PKG_VERSION)/;" \
- $(addprefix $(LINUX_TLD)/,$(BPF_FILES))
-
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
@@ -77,7 +69,7 @@ define Package/libbpf
TITLE:=libbpf - eBPF helper library
VARIANT:=lib
LICENSE:=LGPL-2.1 OR BSD-2-Clause
- ABI_VERSION:=0
+ ABI_VERSION:=$(PKG_ABI_VERSION)
URL:=http://www.kernel.org
DEPENDS:=+libelf
endef
@@ -93,47 +85,35 @@ ifneq ($(BUILD_VARIANT),lib)
TARGET_LDFLAGS += -Wl,--gc-sections
endif
+ifeq ($(BUILD_VARIANT),full)
+ full:=1
+else
+ full:=0
+endif
+
MAKE_VARS = \
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
MAKE_FLAGS += \
- BPFTOOL_VERSION="$(LINUX_VERSION)" \
- FEATURES_DUMP="$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt" \
OUTPUT="$(PKG_BUILD_DIR)/" \
prefix="/usr" \
- $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
+ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
+ LIBSUBDIR=lib \
+ check_feat=0 \
+ feature-clang-bpf-co-re=0 \
+ feature-reallocarray=1 \
+ feature-zlib=1 \
+ feature-libbfd=$(full) \
+ feature-libcap=0 \
+ feature-disassembler-four-args=$(full)
-ifeq ($(BUILD_VARIANT),full)
- HAVE_LIBBFD:=1
- HAVE_LIBCAP:=0
- HAVE_CLANG:=0
- MAKE_PATH:=tools/bpf/bpftool
-else ifeq ($(BUILD_VARIANT),minimal)
- HAVE_LIBBFD:=0
- HAVE_LIBCAP:=0
- HAVE_CLANG:=0
- MAKE_PATH:=tools/bpf/bpftool
-else ifeq ($(BUILD_VARIANT),lib)
- HAVE_LIBBFD:=0
- HAVE_LIBCAP:=0
- HAVE_CLANG:=0
- MAKE_PATH:=tools/lib/bpf
+ifeq ($(BUILD_VARIANT),lib)
+ MAKE_PATH = libbpf/src
+else
+ MAKE_PATH = src
endif
-# Perform a "throw-away" make to create a FEATURE-DUMP.* file to edit later.
-# The "//" in the make target is actually needed, very unPOSIXly.
-define Build/Configure
- +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tools/bpf/bpftool \
- $(MAKE_FLAGS) FEATURES_DUMP= $(PKG_BUILD_DIR)//libbpf/libbpf.a
- (cd $(PKG_BUILD_DIR); cat FEATURE-DUMP.bpftool libbpf/FEATURE-DUMP.libbpf \
- | sort | uniq > FEATURE-DUMP.openwrt)
- $(SED) 's/feature-libbfd=1/feature-libbfd=$(HAVE_LIBBFD)/' \
- -e 's/feature-libcap=1/feature-libcap=$(HAVE_LIBCAP)/' \
- -e 's/feature-clang-bpf-co-re=1/feature-clang-bpf-co-re=$(HAVE_CLANG)/' \
- $(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt
-endef
-
define Build/InstallDev/libbpf
$(INSTALL_DIR) $(1)/usr/include/bpf
$(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/
diff --git a/package/network/utils/bpftools/patches/001-cflags.patch b/package/network/utils/bpftools/patches/001-cflags.patch
new file mode 100644
index 0000000000..48617e302b
--- /dev/null
+++ b/package/network/utils/bpftools/patches/001-cflags.patch
@@ -0,0 +1,10 @@
+--- a/libbpf/src/Makefile
++++ b/libbpf/src/Makefile
+@@ -25,6 +25,7 @@ ALL_CFLAGS := $(INCLUDES)
+
+ SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED
+
++CFLAGS = $(EXTRA_CFLAGS)
+ CFLAGS ?= -g -O2 -Werror -Wall -std=gnu89
+ ALL_CFLAGS += $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+ ALL_LDFLAGS += $(LDFLAGS)
diff --git a/package/network/utils/bpftools/patches/002-includes.patch b/package/network/utils/bpftools/patches/002-includes.patch
new file mode 100644
index 0000000000..589d71c31e
--- /dev/null
+++ b/package/network/utils/bpftools/patches/002-includes.patch
@@ -0,0 +1,26 @@
+--- a/libbpf/include/linux/list.h
++++ b/libbpf/include/linux/list.h
+@@ -3,6 +3,8 @@
+ #ifndef __LINUX_LIST_H
+ #define __LINUX_LIST_H
+
++#include <linux/types.h>
++
+ #define LIST_HEAD_INIT(name) { &(name), &(name) }
+ #define LIST_HEAD(name) \
+ struct list_head name = LIST_HEAD_INIT(name)
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -73,10 +73,10 @@ CFLAGS += -W -Wall -Wextra -Wno-unused-p
+ CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
+ CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
+ -I$(if $(OUTPUT),$(OUTPUT),.) \
+- -I$(LIBBPF_INCLUDE) \
+ -I$(srctree)/src/kernel/bpf/ \
+ -I$(srctree)/include \
+- -I$(srctree)/include/uapi
++ -I$(srctree)/include/uapi \
++ -I$(LIBBPF_INCLUDE)
+ ifneq ($(BPFTOOL_VERSION),)
+ CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
+ endif
diff --git a/package/network/utils/bpftools/patches/005-tools-arch-powerpc-fix-EDEADLOCK-redefinition-errors.patch b/package/network/utils/bpftools/patches/005-tools-arch-powerpc-fix-EDEADLOCK-redefinition-errors.patch
deleted file mode 100644
index 996ffc43ee..0000000000
--- a/package/network/utils/bpftools/patches/005-tools-arch-powerpc-fix-EDEADLOCK-redefinition-errors.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From afe3f4c765b17ced23811fe652c7f7adf7a0c0cf Mon Sep 17 00:00:00 2001
-From: Tony Ambardar <Tony.Ambardar@gmail.com>
-Date: Mon, 14 Sep 2020 23:05:26 -0700
-Subject: [PATCH] tools/arch/powerpc: fix EDEADLOCK redefinition errors in
- errno.h
-
-A few archs like powerpc have different errno.h values for macros
-EDEADLOCK and EDEADLK. In code including both libc and linux versions of
-errno.h, this can result in multiple definitions of EDEADLOCK in the
-include chain. Definitions to the same value (e.g. seen with mips) do
-not raise warnings, but on powerpc there are redefinitions changing the
-value, which raise warnings and errors (with "-Werror").
-
-Guard against these redefinitions to avoid build errors like the following,
-first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with
-musl 1.1.24:
-
- In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
- from ../../include/linux/err.h:8,
- from libbpf.c:29:
- ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
- #define EDEADLOCK EDEADLK
-
- In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
- from libbpf.c:26:
- toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
- #define EDEADLOCK 58
-
- cc1: all warnings being treated as errors
- make[5]: *** [target-powerpc_8540_musl/bpftools-5.8.9/tools/build/Makefile.build:97: /home/kodidev/openwrt-project/build_dir/target-powerpc_8540_musl/bpftools-minimal/bpftools-5.8.9//libbpf/staticobjs/libbpf.o] Error 1
-
-Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's
- supported by perf")
-Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm")
-
-Reported-by: Rosen Penev <rosenp@gmail.com>
-Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
----
- tools/arch/powerpc/include/uapi/asm/errno.h | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/tools/arch/powerpc/include/uapi/asm/errno.h
-+++ b/tools/arch/powerpc/include/uapi/asm/errno.h
-@@ -2,6 +2,7 @@
- #ifndef _ASM_POWERPC_ERRNO_H
- #define _ASM_POWERPC_ERRNO_H
-
-+#undef EDEADLOCK
- #include <asm-generic/errno.h>
-
- #undef EDEADLOCK
diff --git a/package/network/utils/bpftools/patches/006-musl-120.patch b/package/network/utils/bpftools/patches/006-musl-120.patch
deleted file mode 100644
index 53be466f0b..0000000000
--- a/package/network/utils/bpftools/patches/006-musl-120.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/tools/bpf/bpftool/btf_dumper.c
-+++ b/tools/bpf/bpftool/btf_dumper.c
-@@ -5,6 +5,7 @@
- #include <stdio.h> /* for (FILE *) used by json_writer */
- #include <string.h>
- #include <unistd.h>
-+#include <linux/compiler.h>
- #include <asm/byteorder.h>
- #include <linux/bitops.h>
- #include <linux/btf.h>
---- a/tools/bpf/bpftool/map_perf_ring.c
-+++ b/tools/bpf/bpftool/map_perf_ring.c
-@@ -16,6 +16,7 @@
- #include <time.h>
- #include <unistd.h>
- #include <linux/bpf.h>
-+#include <linux/compiler.h>
- #include <linux/perf_event.h>
- #include <sys/ioctl.h>
- #include <sys/mman.h>