diff options
Diffstat (limited to 'package/network/utils/bpftool')
| -rw-r--r-- | package/network/utils/bpftool/Makefile | 99 | ||||
| -rw-r--r-- | package/network/utils/bpftool/patches/001-cflags.patch | 10 | ||||
| -rw-r--r-- | package/network/utils/bpftool/patches/002-includes.patch | 26 |
3 files changed, 135 insertions, 0 deletions
diff --git a/package/network/utils/bpftool/Makefile b/package/network/utils/bpftool/Makefile new file mode 100644 index 00000000000..2782a307353 --- /dev/null +++ b/package/network/utils/bpftool/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2020-2023 Tony Ambardar <itugrok@yahoo.com> +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bpftools +PKG_VERSION:=7.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://github.com/libbpf/bpftool +PKG_MIRROR_HASH:=c8fe336005019fee4d4fd416ce68a749fb479786dead69d6a0b3b04bcd903b98 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=v7.3.0 + +PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com> + +PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/bpftool/Default + SECTION:=net + CATEGORY:=Network + TITLE:=bpftool - eBPF subsystem utility + LICENSE:=GPL-2.0-only OR BSD-2-Clause + URL:=http://www.kernel.org + DEPENDS:=+libelf +endef + +define Package/bpftool-minimal + $(call Package/bpftool/Default) + TITLE+= (Minimal) + VARIANT:=minimal + DEFAULT_VARIANT:=1 + PROVIDES:=bpftool + ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal +endef + +define Package/bpftool-full + $(call Package/bpftool/Default) + TITLE+= (Full) + VARIANT:=full + PROVIDES:=bpftool + ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full + DEPENDS+= +libbfd +libopcodes +endef + +define Package/bpftool-minimal/description + A tool for inspection and simple manipulation of eBPF programs and maps. +endef + +define Package/bpftool-full/description + A tool for inspection and simple manipulation of eBPF programs and maps. + This full version uses libbfd and libopcodes to support disassembly of + eBPF programs and jited code. +endef + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto + +ifeq ($(BUILD_VARIANT),full) + full:=1 +else + full:=0 +endif + +MAKE_VARS = \ + EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" + +MAKE_FLAGS += \ + OUTPUT="$(PKG_BUILD_DIR)/" \ + prefix="/usr" \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ + check_feat=0 \ + feature-clang-bpf-co-re=0 \ + feature-libbfd=$(full) \ + feature-llvm=0 \ + feature-libcap=0 \ + feature-disassembler-four-args=1 \ + feature-disassembler-init-styled=1 + +MAKE_PATH = src + +define Package/bpftool-$(BUILD_VARIANT)/install + $(INSTALL_DIR) $(1)/usr/libexec + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \ + $(1)/usr/libexec/bpftool-$(BUILD_VARIANT) +endef + +$(eval $(call BuildPackage,bpftool-full)) +$(eval $(call BuildPackage,bpftool-minimal)) diff --git a/package/network/utils/bpftool/patches/001-cflags.patch b/package/network/utils/bpftool/patches/001-cflags.patch new file mode 100644 index 00000000000..39cef10c72a --- /dev/null +++ b/package/network/utils/bpftool/patches/001-cflags.patch @@ -0,0 +1,10 @@ +--- a/libbpf/src/Makefile ++++ b/libbpf/src/Makefile +@@ -34,6 +34,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 \ diff --git a/package/network/utils/bpftool/patches/002-includes.patch b/package/network/utils/bpftool/patches/002-includes.patch new file mode 100644 index 00000000000..ac1b5fcc228 --- /dev/null +++ b/package/network/utils/bpftool/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$(or $(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 |
