bpf: iterators: Build and use lightweight bootstrap version of bpftool
authorPu Lehui <pulehui@huawei.com>
Thu, 14 Jul 2022 02:46:12 +0000 (10:46 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 15 Jul 2022 19:01:30 +0000 (12:01 -0700)
kernel/bpf/preload/iterators use bpftool for vmlinux.h, skeleton, and
static linking only. So we can use lightweight bootstrap version of
bpftool to handle these, and it will be faster.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220714024612.944071-4-pulehui@huawei.com
kernel/bpf/preload/iterators/Makefile

index bfe24f8..6762b12 100644 (file)
@@ -9,7 +9,7 @@ LLVM_STRIP ?= llvm-strip
 TOOLS_PATH := $(abspath ../../../../tools)
 BPFTOOL_SRC := $(TOOLS_PATH)/bpf/bpftool
 BPFTOOL_OUTPUT := $(abs_out)/bpftool
-DEFAULT_BPFTOOL := $(OUTPUT)/sbin/bpftool
+DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
 BPFTOOL ?= $(DEFAULT_BPFTOOL)
 
 LIBBPF_SRC := $(TOOLS_PATH)/lib/bpf
@@ -61,9 +61,5 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
                    OUTPUT=$(abspath $(dir $@))/ prefix=                       \
                    DESTDIR=$(LIBBPF_DESTDIR) $(abspath $@) install_headers
 
-$(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
-       $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC)                        \
-                   OUTPUT=$(BPFTOOL_OUTPUT)/                                  \
-                   LIBBPF_OUTPUT=$(LIBBPF_OUTPUT)/                            \
-                   LIBBPF_DESTDIR=$(LIBBPF_DESTDIR)/                          \
-                   prefix= DESTDIR=$(abs_out)/ install-bin
+$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT)
+       $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOL_SRC) OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap