* [Buildroot] [PATCH 1/1] package/linux-tools: add support for bpftool
@ 2021-07-08 20:15 James Hilliard
2021-07-28 20:20 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2021-07-08 20:15 UTC (permalink / raw)
To: buildroot
This tool is available to be compiled since kernel 4.15.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
package/linux-tools/Config.in | 11 ++++++
package/linux-tools/linux-tool-bpftool.mk.in | 37 ++++++++++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 package/linux-tools/linux-tool-bpftool.mk.in
diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index ceb58c668a..87806bc75e 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -5,6 +5,17 @@ menu "Linux Kernel Tools"
config BR2_PACKAGE_LINUX_TOOLS
bool
+config BR2_PACKAGE_LINUX_TOOLS_BPFTOOL
+ bool "bpftool"
+ select BR2_PACKAGE_LINUX_TOOLS
+ select BR2_PACKAGE_BINUTILS
+ select BR2_PACKAGE_ELFUTILS
+ help
+ bpftool is a tool for for inspection and simple manipulation
+ of eBPF programs and maps.
+
+ These tools are available only from kernel version 4.15.
+
config BR2_PACKAGE_LINUX_TOOLS_CPUPOWER
bool "cpupower"
select BR2_PACKAGE_LINUX_TOOLS
diff --git a/package/linux-tools/linux-tool-bpftool.mk.in b/package/linux-tools/linux-tool-bpftool.mk.in
new file mode 100644
index 0000000000..0c4d3693a3
--- /dev/null
+++ b/package/linux-tools/linux-tool-bpftool.mk.in
@@ -0,0 +1,37 @@
+################################################################################
+#
+# bpftool
+#
+################################################################################
+
+LINUX_TOOLS += bpftool
+
+BPFTOOL_DEPENDENCIES = binutils elfutils
+
+ifeq ($(BR2_PACKAGE_LIBCAP),y)
+BPFTOOL_DEPENDENCIES += libcap
+endif
+
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+BPFTOOL_DEPENDENCIES += zlib
+endif
+
+BPFTOOL_MAKE_OPTS = $(LINUX_MAKE_FLAGS)
+
+define BPFTOOL_BUILD_CMDS
+ $(Q)if ! grep install $(LINUX_DIR)/tools/bpf/bpftool/Makefile >/dev/null 2>&1 ; then \
+ echo "Your kernel version is too old and does not have install section in the bpf tools." ; \
+ echo "At least kernel 4.15 must be used." ; \
+ exit 1 ; \
+ fi
+
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/bpf/bpftool \
+ $(BPFTOOL_MAKE_OPTS)
+endef
+
+define BPFTOOL_INSTALL_TARGET_CMDS
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/bpf/bpftool \
+ $(BPFTOOL_MAKE_OPTS) \
+ DESTDIR=$(TARGET_DIR) \
+ install
+endef
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/linux-tools: add support for bpftool
2021-07-08 20:15 [Buildroot] [PATCH 1/1] package/linux-tools: add support for bpftool James Hilliard
@ 2021-07-28 20:20 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2021-07-28 20:20 UTC (permalink / raw)
To: James Hilliard; +Cc: Yann E . MORIN, buildroot
On Thu, 8 Jul 2021 14:15:57 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:
> This tool is available to be compiled since kernel 4.15.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> package/linux-tools/Config.in | 11 ++++++
> package/linux-tools/linux-tool-bpftool.mk.in | 37 ++++++++++++++++++++
> 2 files changed, 48 insertions(+)
> create mode 100644 package/linux-tools/linux-tool-bpftool.mk.in
There was one issue in your patch: you forgot to propagate the "depends
on" of binutils and elfutils to the bpftool option. So I've done that
and applied. Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-28 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-08 20:15 [Buildroot] [PATCH 1/1] package/linux-tools: add support for bpftool James Hilliard
2021-07-28 20:20 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox