BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] samples: bpf: Fix cross-compiling error about bpftool
@ 2022-07-07 14:08 Pu Lehui
  2022-07-07 19:12 ` Song Liu
  2022-07-08 22:42 ` Andrii Nakryiko
  0 siblings, 2 replies; 7+ messages in thread
From: Pu Lehui @ 2022-07-07 14:08 UTC (permalink / raw)
  To: bpf, netdev, linux-kernel
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Pu Lehui

Currently, when cross compiling bpf samples, the host side
cannot use arch-specific bpftool to generate vmlinux.h or
skeleton. We need to compile the bpftool with the host
compiler.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 samples/bpf/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 5002a5b9a7da..fe54a8c8f312 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+-include tools/scripts/Makefile.include
 
 BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src))
 TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools
@@ -283,11 +284,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)
+$(BPFTOOL): $(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)/
+		ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD) \
+		OUTPUT=$(BPFTOOL_OUTPUT)/
 
 $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT):
 	$(call msg,MKDIR,$@)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-09  7:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07 14:08 [PATCH bpf-next] samples: bpf: Fix cross-compiling error about bpftool Pu Lehui
2022-07-07 19:12 ` Song Liu
2022-07-08  2:46   ` Pu Lehui
2022-07-08  3:12     ` Pu Lehui
2022-07-08  4:53       ` Song Liu
2022-07-08 22:42 ` Andrii Nakryiko
2022-07-09  7:31   ` Pu Lehui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox