package/linux-tools: fix PCI endpoint tests build with recent kernels
PATCH v2 1/1 package/linux-tools: fix PCI endpoint tests build with recent kernels
Since Linux 6.14, the PCI endpoint tests have moved from tools/pci to tools/testing/selftests/pci_endpoint. The existing build commands still use the old location, causing the build to fail with newer kernels.
Detect the selftests directory and fall back to tools/pci for older kernels. Set OUTPUT and INSTALL_PATH to build and install the selftests under /usr/lib/kselftests/pci_endpoint, and pass the required libraries explicitly.
Update the help text to document the binary names and installation paths. Check that the selected source directory contains a Makefile and report the minimum supported kernel version if it is missing.
--- package/linux-tools/Config.in | 5 +++-- package/linux-tools/linux-tool-pci.mk.in | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-)
package/linux-tools/Config.in +3 -2
@@ -61,8 +61,9 @@ config BR2_PACKAGE_LINUX_TOOLS_PCI bool "pci" select BR2_PACKAGE_LINUX_TOOLS help - pcitest is a tool for testing capabilities related to a - PCI Endpoint (only works with specific Endpoints). + Build the PCI endpoint tests (only work with specific Endpoints). + Kernels before 6.14 provide pcitest in /usr/bin. Newer kernels + provide pci_endpoint_test in /usr/lib/kselftests/pci_endpoint. These tools are available only from kernel version 4.20.
package/linux-tools/linux-tool-pci.mk.in +12 -4
@@ -6,22 +6,30 @@ LINUX_TOOLS += pci -PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)" +# Linux 6.14 moved the PCI endpoint tests into Kselftests. +PCI_SRCDIR = $(strip $(if $(wildcard $(LINUX_DIR)/tools/testing/selftests/pci_endpoint/Makefile),\ + $(LINUX_DIR)/tools/testing/selftests/pci_endpoint,$(LINUX_DIR)/tools/pci)) + +PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \ + OUTPUT=$(PCI_SRCDIR)/ \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + LDLIBS="-lrt -lm" define PCI_BUILD_CMDS - $(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \ + $(Q)if test ! -f $(PCI_SRCDIR)/Makefile ; then \ echo "Your kernel version is too old and does not have install section in the pci tools." ; \ echo "At least kernel 4.20 must be used." ; \ exit 1 ; \ fi - $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \ + $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \ $(PCI_MAKE_OPTS) endef define PCI_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \ + $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \ $(PCI_MAKE_OPTS) \ DESTDIR=$(TARGET_DIR) \ + INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests/pci_endpoint \ install endef
Signature · 6 lines
2.53.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 9 lines · Florian Fainelli via buildroot
Since Linux 6.14, the PCI endpoint tests have moved from
tools/pcitotools/testing/selftests/pci_endpoint. The existing build commands still use the old location, causing the build to fail with newer kernels.Detect the selftests directory and fall back to
tools/pcifor older kernels. Set OUTPUT andINSTALL_PATHto build and install the selftests under/usr/lib/kselftests/pci_endpoint, and pass the required libraries explicitly.
Quoted 5 lines
Update the help text to document the binary names and installation paths. Check that the selected source directory contains a
Makefileand report the minimum supported kernel version if it is missing.Signed-off-by Florian Fainelli <[email protected]>
Applied to master after adjusting two minor things:
- Wrapped the Config.in help, some lines were a bit too long and were causing a "make check-package" warning.
- Adding a Fixes: tag, not pointing to the commit introducing the issue because as discussed there isn't any, but instead pointing to an autobuilder failure that your patch is fixing.
Thanks a lot!
Thomas Petazzoni
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
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 9 lines
Since Linux 6.14, the PCI endpoint tests have moved from
tools/pcitotools/testing/selftests/pci_endpoint. The existing build commands still use the old location, causing the build to fail with newer kernels.Detect the selftests directory and fall back to
tools/pcifor older kernels. Set OUTPUT andINSTALL_PATHto build and install the selftests under/usr/lib/kselftests/pci_endpoint, and pass the required libraries explicitly.
Quoted 5 lines
Update the help text to document the binary names and installation paths. Check that the selected source directory contains a
Makefileand report the minimum supported kernel version if it is missing.Signed-off-by Florian Fainelli <[email protected]>
Applied to 2026.08.x. Thanks
Quoted 50 lines
--- package/linux-tools/Config.in | 5 +++-- package/linux-tools/linux-tool-pci.mk.in | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-)package/linux-tools/Config.in +3
-2@@ -61,8 +61,9 @@ config BR2_PACKAGE_LINUX_TOOLS_PCI bool "pci" select BR2_PACKAGE_LINUX_TOOLS help - pcitest is a tool for testing capabilities related to a - PCI Endpoint (only works with specific Endpoints). + Build the PCI endpoint tests (only work with specific Endpoints). + Kernels before 6.14 provide pcitest in /usr/bin. Newer kernels + provide pci_endpoint_test in /usr/lib/kselftests/pci_endpoint. These tools are available only from kernel version 4.20.package/linux-tools/linux-tool-pci.mk.in +10
-3@@ -6,22 +6,30 @@ LINUX_TOOLS += pci -PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)" +# Linux 6.14 moved the PCI endpoint tests into Kselftests. +PCI_SRCDIR = $(strip $(if $(wildcard $(LINUX_DIR)/tools/testing/selftests/pci_endpoint/Makefile),\ + $(LINUX_DIR)/tools/testing/selftests/pci_endpoint,$(LINUX_DIR)/tools/pci)) + +PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \ + OUTPUT=$(PCI_SRCDIR)/ \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + LDLIBS="-lrt -lm" define PCI_BUILD_CMDS - $(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \ + $(Q)if test ! -f $(PCI_SRCDIR)/Makefile ; then \ echo "Your kernel version is too old and does not have install section in the pci tools." ; \ echo "At least kernel 4.20 must be used." ; \ exit 1 ; \ fi - $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \ + $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \ $(PCI_MAKE_OPTS)
package/linux-tools/linux-tool-pci.mk.in line 35
Quoted 10 lines
package/linux-tools/linux-tool-pci.mk.in +2
-1endef define PCI_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \ + $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \ $(PCI_MAKE_OPTS) \ DESTDIR=$(TARGET_DIR) \ + INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests/pci_endpoint \ install endef
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot