[PATCH] perf build: Add warning for when vmlinux.h generation fails

From: Ian Rogers
Date: Wed Mar 22 2023 - 14:31:24 EST


The warning advises on the NO_BPF_SKEL=1 option.

Suggested-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/Makefile.perf | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ed6b6a070f79..48aba186ceb5 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1072,7 +1072,11 @@ VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))

$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
ifeq ($(VMLINUX_H),)
- $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
+ $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ || \
+ (echo "Failure to generate vmlinux.h needed for the recommended BPF skeleton support." && \
+ echo "To disable this use the build option NO_BPF_SKEL=1." && \
+ echo "Alternatively point at a pre-generated vmlinux.h with VMLINUX_H=<path>." && \
+ false)
else
$(Q)cp "$(VMLINUX_H)" $@
endif
--
2.40.0.rc1.284.g88254d51c5-goog