package/linux-tools: selftests: Use KHDR_INCLUDES to locate the headers
PATCH 1/1 package/linux-tools: selftests: Use KHDR_INCLUDES to locate the headers
Since v6.7 [1], the KHDR_DIR variable isn't used anymore by the kernel selftest Makefiles to locate the kernel headers. Instead, KHDR_INCLUDES is used to specify their location.
Let's pass it with the "-isystem" flag, as is done in the default values used in the selftest makefiles.
[1]: 43e8832fed08 ("Revert "selftests: error out if kernel header files are not yet built"")
--- package/linux-tools/linux-tool-selftests.mk.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/linux-tools/linux-tool-selftests.mk.in +1 -1
@@ -24,7 +24,7 @@ SELFTESTS_DEPENDENCIES = \ SELFTESTS_MAKE_FLAGS = \ $(LINUX_MAKE_FLAGS) \ ARCH=$(SELFTESTS_ARCH) \ - KHDR_DIR=$(LINUX_DIR)/usr/include + KHDR_INCLUDES="-isystem $(LINUX_DIR)/usr/include" LINUX_TOOLS_BIN_ARCH_EXCLUDE += \ /usr/lib/kselftests/tc-testing/
Signature · 6 lines
2.55.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Maxime,
Quoted 3 lines · Maxime Chevallier via buildroot
Since v6.7 [1], the
KHDR_DIRvariable isn't used anymore by the kernel selftest Makefiles to locate the kernel headers. Instead,KHDR_INCLUDESis used to specify their location.
But then doesn't that mean that the build would be broken for people who build Linux < 6.7 ? Keep in mind that the Linux kernel version in Buildroot is configurable, so not everyone is building the latest and greatest.
If that's the case, then maybe we need to keep both?
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Quoted 11 lines · Thomas Petazzoni
Hello Maxime,
Quoted 3 lines · Maxime Chevallier via buildroot
Since v6.7 [1], the
KHDR_DIRvariable isn't used anymore by the kernel selftest Makefiles to locate the kernel headers. Instead,KHDR_INCLUDESis used to specify their location.But then doesn't that mean that the build would be broken for people who build Linux < 6.7 ? Keep in mind that the Linux kernel version in Buildroot is configurable, so not everyone is building the latest and greatest.
Looking at the kernel history, the KHDR_DIR only existed between v6.4 and v6.7 :
Added in v6.4 :
9fc96c7c19df ("selftests: error out if kernel header files are not yet built")
Reverted in v6.7 :
43e8832fed08 ("Revert "selftests: error out if kernel header files are not yet built"")
And it looks like even between that v6.4 and v6.7 window, KHDR_DIR is just used to populate KHDR_INCLUDES :
tools/testing/selftests/lib.mk
[...]
KHDR_INCLUDES := -isystem $(KHDR_DIR)
So I think this should work even on kernels older than v6.7, I haven't tried though ;(
I can add these details in the commit log in a resend if you want,
Maxime
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello,
Quoted 14 lines · Maxime Chevallier
Looking at the kernel history, the
KHDR_DIRonly existed between v6.4 and v6.7 :Added in v6.4 :
9fc96c7c19df("selftests: error out if kernel header files are not yet built")Reverted in v6.7 :
43e8832fed08("Revert "selftests: error out if kernel header files are not yet built"")And it looks like even between that v6.4 and v6.7 window,
KHDR_DIRis just used to populateKHDR_INCLUDES:
Quoted 5 lines
tools/testing/selftests/lib.mk[...]
KHDR_INCLUDES := -isystem $(KHDR_DIR)
Ah good, so your change would potentially work across all kernel versions?
Quoted 2 lines
So I think this should work even on kernels older than v6.7, I haven't tried though ;(
Can we give it a quick try, just to make sure?
Quoted 1 line
I can add these details in the commit log in a resend if you want,
That would be awesome, thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 4 lines · Thomas Petazzoni via buildroot
Quoted 2 lines
So I think this should work even on kernels older than v6.7, I haven't tried though ;(
Can we give it a quick try, just to make sure?
Gentle ping :-)
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi,
Quoted 8 lines · Thomas Petazzoni
Quoted 4 lines · Thomas Petazzoni via buildroot
Quoted 2 lines
So I think this should work even on kernels older than v6.7, I haven't tried though ;(
Can we give it a quick try, just to make sure?
Gentle ping :-)
Sorry for the delay :/
So I tried and unfortunately I was wrong, the KHDR_DIR variable has another use site, and without it the kselftests build fails on 6.6 :(
So we do need to keep both KHDR_IR and KHDR_INCLUDES, I've tested that and it works for at least 6.1, 6.6, 6.12 and upstream.
I'll spin another round somewhere on my way to OSS/LPC.
Thanks,
Maxime
Quoted 2 lines
Thomas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot