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

rtla: Add optional dependency on BPF tooling

If tooling required for building BPF CO-RE skeletons is present (that
is, libbpf, clang with BPF CO-RE support, and bpftool), turn on
HAVE_BPF_SKEL flag.

Those requirements are similar to what perf requires, with the
difference of using system libbpf and bpftool instead of in-tree
versions.

rtla can be forcefully built without BPF skeleton support by setting
BUILD_BPF_SKEL=0 manually; in that case, a warning is displayed.

Cc: John Kacur <jkacur@redhat.com>
Cc: Luis Goncalves <lgoncalv@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Link: https://lore.kernel.org/20250218145859.27762-4-tglozar@redhat.com
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)
9dc3766e 8a635c38

+48
+6
tools/tracing/rtla/Makefile
··· 33 33 FEATURE_TESTS := libtraceevent 34 34 FEATURE_TESTS += libtracefs 35 35 FEATURE_TESTS += libcpupower 36 + FEATURE_TESTS += libbpf 37 + FEATURE_TESTS += clang-bpf-co-re 38 + FEATURE_TESTS += bpftool-skeletons 36 39 FEATURE_DISPLAY := libtraceevent 37 40 FEATURE_DISPLAY += libtracefs 38 41 FEATURE_DISPLAY += libcpupower 42 + FEATURE_DISPLAY += libbpf 43 + FEATURE_DISPLAY += clang-bpf-co-re 44 + FEATURE_DISPLAY += bpftool-skeletons 39 45 40 46 ifeq ($(V),1) 41 47 Q =
+42
tools/tracing/rtla/Makefile.config
··· 53 53 $(info Please install libcpupower-dev/kernel-tools-libs-devel) 54 54 endif 55 55 56 + ifndef BUILD_BPF_SKEL 57 + # BPF skeletons are used to implement improved sample collection, enable 58 + # them by default. 59 + BUILD_BPF_SKEL := 1 60 + endif 61 + 62 + ifeq ($(BUILD_BPF_SKEL),0) 63 + $(info BPF skeleton support disabled, building without BPF skeleton support.) 64 + endif 65 + 66 + $(call feature_check,libbpf) 67 + ifeq ($(feature-libbpf), 1) 68 + $(call detected,CONFIG_LIBBPF) 69 + else 70 + $(info libbpf is missing, building without BPF skeleton support.) 71 + $(info Please install libbpf-dev/libbpf-devel) 72 + BUILD_BPF_SKEL := 0 73 + endif 74 + 75 + $(call feature_check,clang-bpf-co-re) 76 + ifeq ($(feature-clang-bpf-co-re), 1) 77 + $(call detected,CONFIG_CLANG_BPF_CO_RE) 78 + else 79 + $(info clang is missing or does not support BPF CO-RE, building without BPF skeleton support.) 80 + $(info Please install clang) 81 + BUILD_BPF_SKEL := 0 82 + endif 83 + 84 + $(call feature_check,bpftool-skeletons) 85 + ifeq ($(feature-bpftool-skeletons), 1) 86 + $(call detected,CONFIG_BPFTOOL_SKELETONS) 87 + else 88 + $(info bpftool is missing or not supporting skeletons, building without BPF skeleton support.) 89 + $(info Please install bpftool) 90 + BUILD_BPF_SKEL := 0 91 + endif 92 + 93 + ifeq ($(BUILD_BPF_SKEL),1) 94 + CFLAGS += -DHAVE_BPF_SKEL 95 + EXTLIBS += -lbpf 96 + endif 97 + 56 98 ifeq ($(STOP_ERROR),1) 57 99 $(error Please, check the errors above.) 58 100 endif