mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-02 10:43:57 +08:00
selftests/bpf: Allow substituting custom vmlinux.h for selftests build
Similarly to bpftool Makefile, allow to specify custom location of vmlinux.h to be used during the build. This allows simpler testing setups with checked-in pre-generated vmlinux.h. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200630004759.521530-2-andriin@fb.com
This commit is contained in:
parent
ec23eb7056
commit
ca4db6389d
@ -134,12 +134,12 @@ $(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
|
|||||||
$(call msg,CC,,$@)
|
$(call msg,CC,,$@)
|
||||||
$(CC) -c $(CFLAGS) -o $@ $<
|
$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
VMLINUX_BTF_PATHS := $(if $(O),$(O)/vmlinux) \
|
VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
|
||||||
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
|
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
|
||||||
../../../../vmlinux \
|
../../../../vmlinux \
|
||||||
/sys/kernel/btf/vmlinux \
|
/sys/kernel/btf/vmlinux \
|
||||||
/boot/vmlinux-$(shell uname -r)
|
/boot/vmlinux-$(shell uname -r)
|
||||||
VMLINUX_BTF := $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
|
VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
|
||||||
|
|
||||||
$(OUTPUT)/runqslower: $(BPFOBJ)
|
$(OUTPUT)/runqslower: $(BPFOBJ)
|
||||||
$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
|
$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower \
|
||||||
@ -182,8 +182,13 @@ $(BUILD_DIR)/libbpf $(BUILD_DIR)/bpftool $(INCLUDE_DIR):
|
|||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) | $(BPFTOOL) $(INCLUDE_DIR)
|
$(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) | $(BPFTOOL) $(INCLUDE_DIR)
|
||||||
|
ifeq ($(VMLINUX_H),)
|
||||||
$(call msg,GEN,,$@)
|
$(call msg,GEN,,$@)
|
||||||
$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
|
$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
|
||||||
|
else
|
||||||
|
$(call msg,CP,,$@)
|
||||||
|
cp "$(VMLINUX_H)" $@
|
||||||
|
endif
|
||||||
|
|
||||||
# Get Clang's default includes on this system, as opposed to those seen by
|
# Get Clang's default includes on this system, as opposed to those seen by
|
||||||
# '-target bpf'. This fixes "missing" files on some architectures/distros,
|
# '-target bpf'. This fixes "missing" files on some architectures/distros,
|
||||||
|
Loading…
Reference in New Issue
Block a user