public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: Do not run kernel-doc when building external modules
@ 2026-01-30 21:37 Nathan Chancellor
  2026-01-30 23:18 ` Randy Dunlap
  2026-01-31 15:15 ` Nicolas Schier
  0 siblings, 2 replies; 11+ messages in thread
From: Nathan Chancellor @ 2026-01-30 21:37 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Jonathan Corbet
  Cc: linux-kbuild, linux-doc, linux-kernel, stable, Rong Zhang,
	Mauro Carvalho Chehab

After commit 778b8ebe5192 ("docs: Move the python libraries to
tools/lib/python"), building an external module with any value of W=
against the output of install-extmod-build fails with:

  $ make -C /usr/lib/modules/6.19.0-rc7-00108-g4d310797262f/build M=$PWD W=1
  make: Entering directory '/usr/lib/modules/6.19.0-rc7-00108-g4d310797262f/build'
  make[1]: Entering directory '...'
    CC [M] ...
  Traceback (most recent call last):
    File "/usr/lib/modules/6.19.0-rc7-00108-g4d310797262f/build/scripts/kernel-doc.py", line 339, in <module>
      main()
      ~~~~^^
    File "/usr/lib/modules/6.19.0-rc7-00108-g4d310797262f/build/scripts/kernel-doc.py", line 295, in main
      from kdoc.kdoc_files import KernelFiles             # pylint: disable=C0415
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ModuleNotFoundError: No module named 'kdoc'

scripts/lib was included in the build directory from find_in_scripts but
after the move to tools/lib/python, it is no longer included, breaking
kernel-doc.py.

Commit eba6ffd126cd ("docs: kdoc: move kernel-doc to tools/docs") breaks
this even further by moving kernel-doc outside of scripts as well, so it
cannot be found when called by cmd_checkdoc.

  $ make -C /usr/lib/modules/6.19.0-rc7-next-20260130/build M=$PWD W=1
  make: Entering directory '/usr/lib/modules/6.19.0-rc7-next-20260130/build'
  make[1]: Entering directory '...'
    CC [M]  ...
  python3: can't open file '/usr/lib/modules/6.19.0-rc7-next-20260130/build/tools/docs/kernel-doc': [Errno 2] No such file or directory

While kernel-doc could be useful for external modules, it is more useful
for in-tree documentation that will be build and included in htmldocs.
Rather than including it in install-extmod-build, just skip running
kernel-doc for the external module build.

Cc: stable@vger.kernel.org
Fixes: 778b8ebe5192 ("docs: Move the python libraries to tools/lib/python")
Reported-by: Rong Zhang <i@rong.moe>
Closes: https://lore.kernel.org/20260129175321.415295-1-i@rong.moe/
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This is an alternative to Rong's proposed fix for the first error:

  https://lore.kernel.org/20260129175321.415295-1-i@rong.moe/

I noticed the second one by inspection of -next and further testing.
---
 scripts/Makefile.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5037f4715d74..f01d7957edf7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -166,11 +166,13 @@ else ifeq ($(KBUILD_CHECKSRC),2)
         cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
 endif
 
+ifeq ($(KBUILD_EXTMOD),)
 ifneq ($(KBUILD_EXTRA_WARN),)
   cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
         $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
         $<
 endif
+endif
 
 # Compile C sources (.c)
 # ---------------------------------------------------------------------------

---
base-commit: 63804fed149a6750ffd28610c5c1c98cce6bd377
change-id: 20260130-kbuild-skip-kernel-doc-extmod-276584e7b2b0

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-02-04 11:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 21:37 [PATCH] kbuild: Do not run kernel-doc when building external modules Nathan Chancellor
2026-01-30 23:18 ` Randy Dunlap
2026-01-31 15:15 ` Nicolas Schier
2026-02-04  7:02   ` Masahiro Yamada
2026-02-04  7:39     ` Nathan Chancellor
2026-02-04 10:22       ` Mauro Carvalho Chehab
2026-02-04  9:10     ` Jani Nikula
2026-02-04 10:11       ` Nicolas Schier
2026-02-04 10:32         ` Mauro Carvalho Chehab
2026-02-04 10:39         ` Jani Nikula
2026-02-04 11:12           ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox