Re: [PATCH v4 0/7] kbuild: build the userspace tools in tools/ with the kernel
From: Nicolas Schier
Date: Fri Nov 20 2026 - 15:53:24 EST
On Thu, Nov 12, 2026 at 12:23:47PM -0800, Andrew Morton wrote:
> On Thu, 12 Nov 2026 14:54:20 -0500 Sasha Levin <sashal@xxxxxxxxxx> wrote:
>
> > The userspace programs under tools/ are disconnected from the rest of the
> > kernel's build system. Each has its own makefiles and build framework, and
> > "make" never builds them: apart from the few host tools the build itself needs,
> > such as objtool and resolve_btfids, nothing under tools/ is compiled as part of
> > a kernel build.
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.
> [...]
[...]
>
> From a high level, I think all this happens because selftests are
> considered "out of tree" for kbuild purposes.
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?
--
Nicolas