Skip to content

Commit 9dc3766

Browse files
lenticularis39rostedt
authored andcommitted
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 <[email protected]> Cc: Luis Goncalves <[email protected]> Cc: Gabriele Monaco <[email protected]> Cc: Clark Williams <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Tomas Glozar <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 8a635c3 commit 9dc3766

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

tools/tracing/rtla/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ DOCSRC := ../../../Documentation/tools/rtla/
3333
FEATURE_TESTS := libtraceevent
3434
FEATURE_TESTS += libtracefs
3535
FEATURE_TESTS += libcpupower
36+
FEATURE_TESTS += libbpf
37+
FEATURE_TESTS += clang-bpf-co-re
38+
FEATURE_TESTS += bpftool-skeletons
3639
FEATURE_DISPLAY := libtraceevent
3740
FEATURE_DISPLAY += libtracefs
3841
FEATURE_DISPLAY += libcpupower
42+
FEATURE_DISPLAY += libbpf
43+
FEATURE_DISPLAY += clang-bpf-co-re
44+
FEATURE_DISPLAY += bpftool-skeletons
3945

4046
ifeq ($(V),1)
4147
Q =

tools/tracing/rtla/Makefile.config

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,48 @@ else
5353
$(info Please install libcpupower-dev/kernel-tools-libs-devel)
5454
endif
5555

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+
5698
ifeq ($(STOP_ERROR),1)
5799
$(error Please, check the errors above.)
58100
endif

0 commit comments

Comments
 (0)