samples/bpf: Add valid info for VMLINUX_BTF
authorTao Chen <chen.dylane@gmail.com>
Sun, 28 Apr 2024 16:10:32 +0000 (00:10 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 29 Apr 2024 23:10:03 +0000 (16:10 -0700)
When I use the command 'make M=samples/bpf' to compile samples/bpf code
in ubuntu 22.04, the error info occured:
Cannot find a vmlinux for VMLINUX_BTF at any of "  /home/ubuntu/code/linux/vmlinux",
build the kernel or set VMLINUX_BTF or VMLINUX_H variable

Others often encounter this kind of issue, new kernel has the vmlinux, so we can
set the path in error info which seems more intuitive, like:
Cannot find a vmlinux for VMLINUX_BTF at any of "  /home/ubuntu/code/linux/vmlinux",
buiild the kernel or set VMLINUX_BTF like "VMLINUX_BTF=/sys/kernel/btf/vmlinux" or
VMLINUX_H variable

Signed-off-by: Tao Chen <chen.dylane@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240428161032.239043-1-chen.dylane@gmail.com
samples/bpf/Makefile

index 933f6c3fe6b04345d6b7df7945b4df66cd6e4f86..9aa027b144df6d775dfc59b69f53595d5ad0cd58 100644 (file)
@@ -337,7 +337,7 @@ $(obj)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
 ifeq ($(VMLINUX_H),)
 ifeq ($(VMLINUX_BTF),)
        $(error Cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)",\
-               build the kernel or set VMLINUX_BTF or VMLINUX_H variable)
+               build the kernel or set VMLINUX_BTF like "VMLINUX_BTF=/sys/kernel/btf/vmlinux" or VMLINUX_H variable)
 endif
        $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
 else