Re: [PATCH v4 0/7] kbuild: build the userspace tools in tools/ with the kernel
From: Sasha Levin
Date: Mon Nov 23 2026 - 13:20:13 EST
On Fri, Nov 20, 2026 at 09:53:09PM +0100, Nicolas Schier wrote:
>As mentioned above, the tools/ tree is not part of Kbuild but
>re-implements some of its features in its own way, cp. commit
>6e6ef2da3a28 ("Makefile: add comment to discourage tools/* addition for
>kernel builds").
>
>I am sceptical about integration (up to) the whole tools/ tree into the
>regular kernel build, even though I like your motivation. I try to
>review the patches within the next week.
Thanks, I'd appreciate the review.
The series doesn't change that. Every tool is still built by its own
makefile, and tools_build only runs "make -C tools/<dir>" for the
directories enabled in Kconfig. Nothing in the kernel build uses the
result, unlike objtool or resolve_btfids.
I'm just trying to create a bridge between the two.
>Why _are_ the selftest modules built as out-of-tree modules? Might it
>make things easier to build them in-tree instead, or is there a good
>reason to keep it the way it is?
Some are in tree: lib/test_firmware.c, lib/test_static_keys.c and others
are built with the kernel and only loaded by their selftests. The
livepatch ones were too, until c4bbe83d27c2 ("livepatch: Move tests from
lib/livepatch to selftests/livepatch") moved them out so that they can
be rebuilt and packaged together with the tests.
Building the modules in tree would fix the trimming, but for livepatch
it would undo that move.
--
Thanks,
Sasha