Re: [PATCH] kbuild: Do not run kernel-doc when building external modules

Nicolas Schier
2026-02-04T10:12:39Z

On Wed, Feb 04, 2026 at 11:10:37AM +0200, Jani Nikula wrote:
> On Wed, 04 Feb 2026, Masahiro Yamada <masahiroy@kernel.org> wrote:
> > Since kernel-doc is a part of Kbuild,
> > all dependent libraries should exist under scripts/.
>
> Huh. I've always wondered why all the Kbuild makefiles are placed in
> scripts/, which appears to be a haphazard collection of, well, scripts
> and tools. But then you also have tools/.

From the kbuild perspective, as Masahiro mentioned, every tooling
related to kernel builds, kbuild or kconfig should be placed in
scripts/. The tools/ subtree isn't using kbuild; rules, definitionas
and other expectations that are valid for kbuild may not be true in
tools/, cp. commit 6e6ef2da3a28f [1].

Unfortunately, there _are_ things in tools/ that are required for kernel
builds (e.g. objtool), but there is no consent on moving these parts out
of the tools/ subtree [2].

> I've followed the kernel-doc refactoring from the sidelines, commenting
> on some things, but it never crossed my mind the build shouldn't depend
> on something outside of scripts/. (That's what I'm inferring here
> anyway.) And apparently that thought didn't occur to a lot of other
> people either, with even more kernel experience than myself.

Yes, I also saw the changes fly by but did not think about the
implications.

> Sounds like the kernel config and build system would deserve a top-level
> directory like build/ or kbuild/, which collects everything needed for
> the build, nothing more, nothing less. Because scripts/ is not *that*.

Well, sounds straight forward at first, but where should we make the cut
between kbuild and non-kbuild? I admit that there are some scripts
below scripts/ that I'd rather label as "contrib", but I don't think
that these are too much.

> I understand all of this may be a historical accident, and possibly too
> painful to fix now, but is any of this documented anywhere either?

No, I am afraid it isn't.

Kind regards,
Nicolas

[1]: https://git.kernel.org/kbuild/c/6e6ef2da3a28f
[2]: https://lore.kernel.org/linux-kbuild/1551764896-8453-3-git-send-email-yamada.masahiro@socionext.com/