From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: bernd.kuhls@t-online.de, chrismcc@gmail.com,
yann.morin.1998@free.fr, buildroot@buildroot.org,
fontaine.fabrice@gmail.com, markus.mayer@broadcom.com
Subject: Re: [Buildroot] [PATCH] package/linux-tools: fix PCI endpoint tests build with recent kernels
Date: Thu, 22 Oct 2026 19:40:46 +0200 [thread overview]
Message-ID: <atpJvzAWPfCcAFln@windsurf> (raw)
In-Reply-To: <20261022172753.1256542-1-florian.fainelli@broadcom.com>
Hello Florian,
Nice, nice, I stumbled across this issue yesterday, and I was
precisely looking at cooking a patch, but you beat me at it! Some
review/questions below.
On Thu, Oct 22, 2026 at 10:27:52AM -0700, Florian Fainelli wrote:
> 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.
>
> Add a threads dependency and update the help text to document the
> binary names and installation paths. Keep the minimum kernel version
> check for the legacy tools and report missing sources explicitly.
>
> Fixes: 63e457639abb ("package/linux-tools: add support for pcitest tool")
Technically it doesn't fix this commit. At the time of 63e457639abb,
Linux 6.14 was not a thing, so 63e457639abb was correct. It's really
Linux 6.14 that broke stuff, so I don't think we can really point to a
particular Buildroot commit that is fixed by this change.
> diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
> index b9adc25ad51d..19d54cbbe707 100644
> --- a/package/linux-tools/Config.in
> +++ b/package/linux-tools/Config.in
> @@ -59,13 +59,18 @@ config BR2_PACKAGE_LINUX_TOOLS_MM
>
> config BR2_PACKAGE_LINUX_TOOLS_PCI
> bool "pci"
> + depends on BR2_TOOLCHAIN_HAS_THREADS
> 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.
>
> +comment "pci needs a toolchain w/ threads"
> + depends on !BR2_TOOLCHAIN_HAS_THREADS
Hm is this thread dependency new? With the Linux 6.14 change, or
unrelated?
> comment "perf needs a toolchain w/ dynamic library, threads"
> depends on BR2_TOOLCHAIN_HAS_SYNC_4
> depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/linux-tools/linux-tool-pci.mk.in b/package/linux-tools/linux-tool-pci.mk.in
> index 17246f5d7ed2..f9acf8f041d8 100644
> --- a/package/linux-tools/linux-tool-pci.mk.in
> +++ b/package/linux-tools/linux-tool-pci.mk.in
> @@ -6,22 +6,36 @@
>
> 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))
Aaaah nice. I hadn't thought of doing it like this.
> +PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
> + OUTPUT=$(PCI_SRCDIR)/ \
> + LDFLAGS="$(TARGET_LDFLAGS)" \
> + LDLIBS="-lrt -lpthread -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 sources do not contain the PCI endpoint tests." ; \
> + echo "Expected tools/pci or tools/testing/selftests/pci_endpoint." ; \
> + exit 1 ; \
> + fi
> + $(Q)if test "$(PCI_SRCDIR)" = "$(LINUX_DIR)/tools/pci" && \
> + ! grep install $(PCI_SRCDIR)/Makefile >/dev/null 2>&1 ; then \
I'm wondering if we really need to grep for "install" in the
Makefile. Can't we just do:
$(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." ; \
fi
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-10-22 17:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 17:27 [Buildroot] [PATCH] package/linux-tools: fix PCI endpoint tests build with recent kernels Florian Fainelli via buildroot
2026-10-22 17:33 ` Florian Fainelli via buildroot
2026-10-22 17:40 ` Thomas Petazzoni via buildroot [this message]
2026-10-22 18:02 ` Florian Fainelli via buildroot
2026-10-22 18:30 ` Thomas Petazzoni via buildroot
2026-10-22 18:35 ` Florian Fainelli via buildroot
2026-10-22 19:02 ` Thomas Petazzoni via buildroot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=atpJvzAWPfCcAFln@windsurf \
--to=buildroot@buildroot.org \
--cc=bernd.kuhls@t-online.de \
--cc=chrismcc@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=fontaine.fabrice@gmail.com \
--cc=markus.mayer@broadcom.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.