When build kvm selftests in tools/testing/selftests directory with
make O=/home/lxy/kselftests TARGETS=kvm
it fails building some kvm test binaries due to lack of header files, e.g.,
x86_64/vmx_set_nested_state_test.c: In function ‘set_default_vmx_state’: x86_64/vmx_set_nested_state_test.c:85:7: error: ‘struct kvm_nested_state’ has no member named ‘hdr’ state->hdr.vmx.vmxon_pa = 0x1000; ...
With "O" is specified, it also takes effect on "make headers_install", which causes no header files generated in "kernel-src/usr".
Fix INSTALL_HDR_PATH with correct path for this case.
Opportunistically fix the case when KBUILD_OUTPUT specified as well, even though it can work currently.
Signed-off-by: Xiaoyao Li xiaoyao.li@intel.com --- tools/testing/selftests/kvm/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 6a95878b2ab7..bf8f56488914 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -50,7 +50,11 @@ ifeq (0,$(MAKELEVEL)) INSTALL_HDR_PATH := $(top_srcdir)/usr endif else + ifneq ($(O)$(KBUILD_OUTPUT),) + INSTALL_HDR_PATH := $(BUILD)/usr + else INSTALL_HDR_PATH := $(top_srcdir)/usr + endif endif LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include