On Mon, Nov 09, 2020 at 12:17:49PM -0800, Andrii Nakryiko wrote: > On Mon, Nov 9, 2020 at 3:11 AM Jean-Philippe Brucker > <jean-philippe@xxxxxxxxxx> wrote: > > > > The bpftool build first creates an intermediate binary, executed on the > > host, to generate skeletons required by the final build. When > > cross-building bpftool for an architecture different from the host, the > > intermediate binary should be built using the host compiler (gcc) and > > the final bpftool using the cross compiler (e.g. aarch64-linux-gnu-gcc). > > > > Generate the intermediate objects into the bootstrap/ directory using > > the host toolchain. > > > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> > > --- > > tools/bpf/bpftool/Makefile | 32 +++++++++++++++++++++++++------- > > 1 file changed, 25 insertions(+), 7 deletions(-) > > > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > > index 1358c093b812..0705c48e0ce0 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > @@ -19,24 +19,36 @@ BPF_DIR = $(srctree)/tools/lib/bpf/ > > ifneq ($(OUTPUT),) > > LIBBPF_OUTPUT = $(OUTPUT)/libbpf/ > > LIBBPF_PATH = $(LIBBPF_OUTPUT) > > + BOOTSTRAP_OUTPUT = $(OUTPUT)/bootstrap/ > > else > > LIBBPF_OUTPUT is not set here, can you please fix that as well? Ok. I'll set it to "", so the clean receipe doesn't remove the source tree > > > LIBBPF_PATH = $(BPF_DIR) > > + BOOTSTRAP_OUTPUT = $(CURDIR)/bootstrap/ > > endif > > > > [...] > > > -clean: $(LIBBPF)-clean feature-detect-clean > > +clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean > > $(call QUIET_CLEAN, bpftool) > > $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d > > - $(Q)$(RM) -- $(BPFTOOL_BOOTSTRAP) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h > > + $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h > > $(Q)$(RM) -r -- $(OUTPUT)libbpf/ > > + $(Q)$(RM) -r -- $(BOOTSTRAP_OUTPUT) > > Can you combine it with the previous line, maybe also specify more > explicitly $(LIBBPF_OUTPUT) instead of $(OUTPUT)libbpf/? Sure Thanks, Jean > > > $(call QUIET_CLEAN, core-gen) > > $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool > > $(Q)$(RM) -r -- $(OUTPUT)feature/ > > -- > > 2.29.1 > >