Hey, I can do a pull req. but it took me a bit to get this repo together and try to use it to test some ARM code changes I was doing. Figured it would be good to add the following to README.md, but entirely up to you.
For cross-compiling, there is no need to compile bpftool as part of the build, simply
root=$(pwd)
cd <linux repo>/tools/bpf/bpftool
bpftool_root=$(pwd)
make ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
cd "$root"
mkdir -p ./src/.output/bpftool/
cp -r "$bpftool_root"/* ./src/.output/bpftool/
diff --git a/Makefile b/Makefile
index 78ccdff..b06d659 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ define allow-override
$(eval $(1) = $(2)))
endef
-$(call allow-override,CC,$(CROSS_COMPILE)cc)
+$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,LD,$(CROSS_COMPILE)ld)
.PHONY: all
@@ -78,7 +78,7 @@ $(LIBBPF_OBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPU
# Build bpftool
$(BPFTOOL): | $(BPFTOOL_OUTPUT)
$(call msg,BPFTOOL,$@)
- $(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap
+ # $(Q)$(MAKE) CFLAGS=$(CFLAGS) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap
# Build BPF code
$(OUTPUT)/%.bpf.o: src/%.bpf.c $(LIBBPF_OBJ) $(wildcard %.h) $(VMLINUX) | $(OUTPUT) $(BPFTOOL)
sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install libelf-dev:arm64