[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aX4bBI_v5oxjHgXi@levanger>
Date: Sat, 31 Jan 2026 16:08:52 +0100
From: Nicolas Schier <nsc@...nel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>, Rong Zhang <i@...g.moe>,
Jonathan Corbet <corbet@....net>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH] kbuild: install-extmod-build: Add missing python
libraries
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@...nel.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@...nel.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@...nel.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
Powered by blists - more mailing lists