Skip to contentSkip to conversation

bpftoo: Support user defined vmlinux path

PATCH In review Jianlin Lv 2 participants 2 messages Apr 25, 2022

Subsystems (4)
lore
Share & tools
lore

Jianlin Lv

author
#0 lore raw

PATCH 1/1 bpftoo: Support user defined vmlinux path

From: Jianlin Lv <[email protected]>

Add EXTERNAL_PATH variable that define unconventional vmlinux path

---
When building Ubuntu-5.15.0 kernel, '../../../vmlinux' cannot locate compiled vmlinux image. Incorrect vmlinux generated vmlinux.h missing some structure definitions that broken compiling pipe.

---
 tools/bpf/bpftool/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/bpf/bpftool/Makefile +1 -0
index c6d2c77d0252..fefa3b763eb7 100644
@@ -160,6 +160,7 @@ $(OBJS): $(LIBBPF) $(LIBBPF_INTERNAL_HDRS)
 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)				\
 		     $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)	\
 		     ../../../vmlinux					\
+		     $(if $(EXTERNAL_PATH),$(EXTERNAL_PATH)/vmlinux)	\
 		     /sys/kernel/btf/vmlinux				\
 		     /boot/vmlinux-$(shell uname -r)
 VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 9 lines · Jianlin Lv

From: Jianlin Lv <[email protected]>

Add EXTERNAL_PATH variable that define unconventional vmlinux path

---
When building Ubuntu-5.15.0 kernel, '../../../vmlinux' cannot locate compiled vmlinux image. Incorrect vmlinux generated vmlinux.h missing some structure definitions that broken compiling pipe.

You should already be able to define custom VMLINUX_BTF_PATHS, no?

See commit :

commit ec23eb705620234421fd48fc2382490fcfbafc37

Author: Andrii Nakryiko <[email protected]>
Date:   Mon Jun 29 17:47:58 2020 -0700

tools/bpftool: Allow substituting custom vmlinux.h for the build

Quoted 17 lines
---
  tools/bpf/bpftool/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/bpf/bpftool/Makefile +1 -0
index c6d2c77d0252..fefa3b763eb7 100644
@@ -160,6 +160,7 @@ $(OBJS): $(LIBBPF) $(LIBBPF_INTERNAL_HDRS)
  VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)				\
  		     $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)	\
  		     ../../../vmlinux					\
+		     $(if $(EXTERNAL_PATH),$(EXTERNAL_PATH)/vmlinux)	\
  		     /sys/kernel/btf/vmlinux				\
  		     /boot/vmlinux-$(shell uname -r)
  VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))