[PATCH] kbuild: Run kernel-doc only for in-tree builds

Nicolas Schier posted 1 patch 6 days, 14 hours ago
scripts/Makefile.build | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
[PATCH] kbuild: Run kernel-doc only for in-tree builds
Posted by Nicolas Schier 6 days, 14 hours ago
Stop running kernel-doc when building out-of-tree kernel modules.

Rong Zhang reported that building external modules with W set fails
since v6.19-rc1 as the kernel-doc Python modules are no more available
when building against a kernel module build tree exported by
scripts/package/install-extmod-build.

As there is no good reason for checking documentation when building
out-of-tree kernel modules, stop it.

Fixes: 778b8ebe5192 ("docs: Move the python libraries to tools/lib/python")
Reported-by: Rong Zhang <i@rong.moe>
Closes: https://lore.kernel.org/linux-kbuild/20260129175321.415295-1-i@rong.moe
Suggested-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Nicolas Schier <nsc@kernel.org>
---
I left out a 'Cc: stable@kernel.org' as the problem exists just since
v6.19-rc1; please intervene ASAP if you think it should be added.
---

---
Thanks for the report (Rong) and the patch suggestion (Mauro)!
I left out a 'Cc: stable@kernel.org' as the problem exists just since
6.19-rc1; please intervene ASAP if you think it should be added.
---
 scripts/Makefile.build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5037f4715d7491761b75d086441367c6c08c099e..05674bae3c637b4476a11b5e6af630d8daa3b613 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -166,10 +166,12 @@ else ifeq ($(KBUILD_CHECKSRC),2)
         cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
 endif
 
-ifneq ($(KBUILD_EXTRA_WARN),)
-  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
-        $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
-        $<
+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: 6d60354ea2f90352b22039ed8371c4f4321df90e
change-id: 20260131-run-kernel-doc-only-in-tree-18be87e88208

Best regards,
-- 
Nicolas
Re: [PATCH] kbuild: Run kernel-doc only for in-tree builds
Posted by Nicolas Schier 6 days, 14 hours ago
On Sat, Jan 31, 2026 at 04:02:32PM +0100, Nicolas Schier wrote:
> Stop running kernel-doc when building out-of-tree kernel modules.
> 
> Rong Zhang reported that building external modules with W set fails
> since v6.19-rc1 as the kernel-doc Python modules are no more available
> when building against a kernel module build tree exported by
> scripts/package/install-extmod-build.
> 
> As there is no good reason for checking documentation when building
> out-of-tree kernel modules, stop it.
> 
> Fixes: 778b8ebe5192 ("docs: Move the python libraries to tools/lib/python")
> Reported-by: Rong Zhang <i@rong.moe>
> Closes: https://lore.kernel.org/linux-kbuild/20260129175321.415295-1-i@rong.moe
> Suggested-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Tested-by: Nicolas Schier <nsc@kernel.org>
> Signed-off-by: Nicolas Schier <nsc@kernel.org>
> ---
> I left out a 'Cc: stable@kernel.org' as the problem exists just since
> v6.19-rc1; please intervene ASAP if you think it should be added.
> ---
> 
> ---
> Thanks for the report (Rong) and the patch suggestion (Mauro)!
> I left out a 'Cc: stable@kernel.org' as the problem exists just since
> 6.19-rc1; please intervene ASAP if you think it should be added.
> ---
>  scripts/Makefile.build | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 5037f4715d7491761b75d086441367c6c08c099e..05674bae3c637b4476a11b5e6af630d8daa3b613 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -166,10 +166,12 @@ else ifeq ($(KBUILD_CHECKSRC),2)
>          cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
>  endif
>  
> -ifneq ($(KBUILD_EXTRA_WARN),)
> -  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
> -        $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
> -        $<
> +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: 6d60354ea2f90352b22039ed8371c4f4321df90e
> change-id: 20260131-run-kernel-doc-only-in-tree-18be87e88208
> 
> Best regards,
> -- 
> Nicolas
> 

Oh, sorry. I overlooked Nathan's patch.  Sorry for the noise.