diff mbox series

[bpf-next] bpftoo: Support user defined vmlinux path

Message ID 20220425075724.48540-1-jianlv@ebay.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf-next] bpftoo: Support user defined vmlinux path | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Kernel LATEST on z15 + selftests
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest + selftests
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: yhs@fb.com songliubraving@fb.com john.fastabend@gmail.com kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jianlin Lv April 25, 2022, 7:57 a.m. UTC
From: Jianlin Lv <iecedge@gmail.com>

Add EXTERNAL_PATH variable that define unconventional vmlinux path

Signed-off-by: Jianlin Lv <iecedge@gmail.com>
---
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(+)

Comments

Daniel Borkmann April 25, 2022, 2:54 p.m. UTC | #1
On 4/25/22 9:57 AM, Jianlin Lv wrote:
> From: Jianlin Lv <iecedge@gmail.com>
> 
> Add EXTERNAL_PATH variable that define unconventional vmlinux path
> 
> Signed-off-by: Jianlin Lv <iecedge@gmail.com>
> ---
> 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 <andriin@fb.com>
Date:   Mon Jun 29 17:47:58 2020 -0700

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

> ---
>   tools/bpf/bpftool/Makefile | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index c6d2c77d0252..fefa3b763eb7 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -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))))
>
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index c6d2c77d0252..fefa3b763eb7 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -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))))