lkml.org 
[lkml]   [2022]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH bpf-next v2 1/3] samples: bpf: Fix cross-compiling error by using bootstrap bpftool
    Date
    Currently, when cross compiling bpf samples, the host side cannot
    use arch-specific bpftool to generate vmlinux.h or skeleton. Since
    samples/bpf use bpftool for vmlinux.h, skeleton, and static linking
    only, we can use lightweight bootstrap version of bpftool to handle
    these, and it's always host-native.

    Signed-off-by: Pu Lehui <pulehui@huawei.com>
    Suggested-by: Andrii Nakryiko <andrii@kernel.org>
    ---
    samples/bpf/Makefile | 10 ++++------
    1 file changed, 4 insertions(+), 6 deletions(-)

    diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
    index 5002a5b9a7da..727da3c5879b 100644
    --- a/samples/bpf/Makefile
    +++ b/samples/bpf/Makefile
    @@ -282,12 +282,10 @@ $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU

    BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool
    BPFTOOL_OUTPUT := $(abspath $(BPF_SAMPLES_PATH))/bpftool
    -BPFTOOL := $(BPFTOOL_OUTPUT)/bpftool
    -$(BPFTOOL): $(LIBBPF) $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT)
    - $(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../ \
    - OUTPUT=$(BPFTOOL_OUTPUT)/ \
    - LIBBPF_OUTPUT=$(LIBBPF_OUTPUT)/ \
    - LIBBPF_DESTDIR=$(LIBBPF_DESTDIR)/
    +BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
    +$(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT)
    + $(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../ \
    + OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap

    $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT):
    $(call msg,MKDIR,$@)
    --
    2.25.1
    \
     
     \ /
      Last update: 2022-07-14 04:16    [W:2.830 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site