Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/build: Use SYSTEM_BPFTOOL for system bpftool

The feature test for system bpftool uses BPFTOOL as the variable to set
its path, defaulting to just "bpftool" if not set by the user.

This conflicts with selftests and a few other utilities, which expect
BPFTOOL to be set to the in-tree bpftool path by default. For example,
bpftool selftests fail to build:

$ make -C tools/testing/selftests/bpf/
make: Entering directory '/home/tglozar/dev/linux/tools/testing/selftests/bpf'

make: *** No rule to make target 'bpftool', needed by '/home/tglozar/dev/linux/tools/testing/selftests/bpf/tools/include/vmlinux.h'. Stop.
make: Leaving directory '/home/tglozar/dev/linux/tools/testing/selftests/bpf'

Fix the problem by renaming the variable used for system bpftool from
BPFTOOL to SYSTEM_BPFTOOL, so that the new usage does not conflict with
the existing one of BPFTOOL.

Cc: John Kacur <jkacur@redhat.com>
Cc: Luis Goncalves <lgoncalv@redhat.com>
Link: https://lore.kernel.org/20250326004018.248357-1-tglozar@redhat.com
Fixes: 8a635c3856dd ("tools/build: Add bpftool-skeletons feature test")
Closes: https://lore.kernel.org/linux-kernel/5df6968a-2e5f-468e-b457-fc201535dd4c@linux.ibm.com/
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Suggested-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Tomas Glozar and committed by
Steven Rostedt (Google)
814d051e dc4d4e7c

+3 -3
+1 -1
tools/build/feature/Makefile
··· 419 419 $(BUILD) -lpfm 420 420 421 421 $(OUTPUT)test-bpftool-skeletons.bin: 422 - $(BPFTOOL) version | grep '^features:.*skeletons' \ 422 + $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \ 423 423 > $(@:.bin=.make.output) 2>&1 424 424 ############################### 425 425
+1 -1
tools/scripts/Makefile.include
··· 92 92 LLVM_STRIP ?= llvm-strip 93 93 94 94 # Some tools require bpftool 95 - BPFTOOL ?= bpftool 95 + SYSTEM_BPFTOOL ?= bpftool 96 96 97 97 ifeq ($(CC_NO_CLANG), 1) 98 98 EXTRA_WARNINGS += -Wstrict-aliasing=3
+1 -1
tools/tracing/rtla/Makefile
··· 78 78 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@ 79 79 80 80 src/timerlat.skel.h: src/timerlat.bpf.o 81 - $(QUIET_GENSKEL)$(BPFTOOL) gen skeleton $< > $@ 81 + $(QUIET_GENSKEL)$(SYSTEM_BPFTOOL) gen skeleton $< > $@ 82 82 else 83 83 src/timerlat.skel.h: 84 84 $(Q)echo '/* BPF skeleton is disabled */' > src/timerlat.skel.h