From: Nicolas Schier <nsc@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>, Rong Zhang <i@rong.moe>,
Jonathan Corbet <corbet@lwn.net>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH] kbuild: install-extmod-build: Add missing python libraries
Date: Sat, 31 Jan 2026 16:08:52 +0100 [thread overview]
Message-ID: <aX4bBI_v5oxjHgXi@levanger> (raw)
In-Reply-To: <20260130092816.162a48fe@foz.lan>
On Fri, Jan 30, 2026 at 09:32:03AM +0100, Mauro Carvalho Chehab wrote:
> On Thu, 29 Jan 2026 23:40:11 -0700
> Nathan Chancellor <nathan@kernel.org> wrote:
>
> > On Fri, Jan 30, 2026 at 06:30:56AM +0100, Mauro Carvalho Chehab wrote:
> > > On Thu, 29 Jan 2026 18:11:06 -0700
> > > Nathan Chancellor <nathan@kernel.org> wrote:
> > > > On Fri, Jan 30, 2026 at 01:49:55AM +0800, Rong Zhang wrote:
> > ...
> > > > > $ make -C /lib/modules/6.19.0-rc6/build/ M="$(pwd)" modules V=1 W=1
> > > > > [...]
> > > > > make -f /usr/src/linux-headers-6.19.0-rc6/scripts/Makefile.build obj=. need-builtin=1 need-modorder=1
> > > > > # CC [M] mod.o
> > > > > [...]
> > > > > # cmd_checkdoc mod.o
> > > > > PYTHONDONTWRITEBYTECODE=1 python3 /usr/src/linux-headers-6.19.0-rc6/scripts/kernel-doc.py -none mod.c
> > >
> > > This sounds really weird, as it is trying to run scripts/kernel-doc.py
> > > instead of tools/docs/kernel-doc. Does the out-of-tree Makefile
> > > override KERNELDOC variable? The current version contains:
> > >
> > > KERNELDOC = $(srctree)/tools/docs/kernel-doc
> > >
> > > But somehow it is using the old version before the renames:
> > >
> > > KERNELDOC = $(srctree)/scripts/kernel-doc.py
> >
> > Well I think based on the "6.19.0-rc6" in the path above, this is
> > mainline, not -next, so the rename has has not happend there yet.
>
> Ah, ok. On your e-mail you mentioned the renaming patch, so I
> ended assuming that was the case.
>
> >
> > > Btw, I did a very quick test here, using an old OOT project I have
> > > at github:
> > >
> > > https://github.com/mchehab/xr_serial
> > ...
> > > It sounds to me that Rong may be using a Makefile on his OOT project
> > > that was not updated to pick the right kernel-doc tool.
> >
> > If I use that project with Rong's original command, the
> > linux-upstream-headers package from the pacman-pkg target (which uses
> > install-extmod-build), and the following fix up for a more modern kernel
> > version, I see the following error:
> >
> > $ make -C /usr/lib/modules/6.19.0-rc7-next-20260129/build M=/tmp/xr_serial modules V=1 W=1
> > ...
> > # CC [M] xr_serial.o
> > gcc ...
> > # cmd_checkdoc xr_serial.o
> > PYTHONDONTWRITEBYTECODE=1 python3 /usr/lib/modules/6.19.0-rc7-next-20260129/build/tools/docs/kernel-doc -none xr_serial.c
> > python3: can't open file '/usr/lib/modules/6.19.0-rc7-next-20260129/build/tools/docs/kernel-doc': [Errno 2] No such file or directory
> > make[3]: *** [/usr/lib/modules/6.19.0-rc7-next-20260129/build/scripts/Makefile.build:287: xr_serial.o] Error 2
> >
> > If it is not expected that kernel-doc runs for external modules, then
> > maybe cmd_checkdoc should also be wrapped in a check for KBUILD_EXTMOD?
>
> I don't particularly see any reason why running kernel-doc for external
> modules, as the goal of running it there (outside make htmldocs) is to
> detect early problems at linux-next and other CIs.
>
> On the other hand, I also don't see any problem on encapsulating
> kernel-doc at the tarball created by install-extmod-build with something
> like:
>
> ifeq ($(KBUILD_EXTMOD),)
> ifneq ($(KBUILD_EXTRA_WARN),)
> cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
> $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
> $<
> endif
> endif
>
> at scripts/Makefile.build.
>
>
> So, feel free to add to either one of the approaches:
>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thanks everybody for report and analysis! I put Mauro's suggestion into
a new patch for kbuild-next:
https://lore.kernel.org/linux-kbuild/20260131-run-kernel-doc-only-in-tree-v1-1-93a9c695dfb1@kernel.org/
I plan to send the pull request tonight.
> That's said, it should be noticed that the DRM subsystem also has
> some similar code:
>
> drivers/gpu/drm/Makefile: PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> drivers/gpu/drm/i915/Makefile: cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<
> drivers/gpu/drm/i915/Makefile: $(KERNELDOC) -none -Werror $<; touch $@
> include/drm/Makefile: PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> scripts/Makefile.build: cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
>
> but I suspect that only scripts/Makefile.build probably need
> such check.
yes, I think so too, as the definitions in drm should only take effect
on hdrtest target.
Kind regards,
Nicolas
prev parent reply other threads:[~2026-01-31 15:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 17:49 [PATCH] kbuild: install-extmod-build: Add missing python libraries Rong Zhang
2026-01-30 1:11 ` Nathan Chancellor
2026-01-30 5:30 ` Mauro Carvalho Chehab
2026-01-30 6:40 ` Nathan Chancellor
2026-01-30 8:32 ` Mauro Carvalho Chehab
2026-01-31 15:08 ` Nicolas Schier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aX4bBI_v5oxjHgXi@levanger \
--to=nsc@kernel.org \
--cc=corbet@lwn.net \
--cc=i@rong.moe \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=mchehab@kernel.org \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.