All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
@ 2026-07-23 10:58 Nicolas Schier
  2026-07-23 23:16 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2026-07-23 10:58 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Thomas Weißschuh
  Cc: linux-kbuild, linux-kernel, Anish Rashinkar, stable, Philipp Hahn,
	Nicolas Schier

From: Nicolas Schier <n.schier@fritz.com>

Update output Makefile in the corresponding tree only: for out-of-source
in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree
module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.

In-source builds are not affected.

Since commit c9bb03ac2c66 ("kbuild: reduce output spam when building out
of tree"), building out-of-tree kernel modules out-of-source (make M=...
MO=...) causes a rewrite of $(objtree)/Makefile with KBUILD_EXTMOD and
KBUILD_EXTMOD_OUTPUT being set.  That is problematic:

 * $(objtree)/ must not be changed in any way when building out-of-tree
   modules as it breaks other uses of $(objtree).

 * Setting KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT in $(objtree)/Makefile
   kills the tree for incremental builds that start right there
   ('make -C $(objtree)'); builds starting in $(srctree) reset
   $(objtree)/Makefile to its original content.

Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at
all.

This commit restores the previous kbuild behaviour prior to commit
c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
but leaves in-place the use of filechk for output spam reduction.

Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
Reported-by: Anish Rashinkar <rashinkar.anish@gmail.com>
Closes: https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com
Cc: stable@vger.kernel.org
Tested-by: Philipp Hahn <p.hahn@avm.de>
Reviewed-by: Philipp Hahn <p.hahn@avm.de>
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Signed-off-by: Nicolas Schier <nsc@kernel.org>
---
 Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 11539c3fd405..17d34968b7f0 100644
--- a/Makefile
+++ b/Makefile
@@ -695,13 +695,11 @@ filechk_makefile = { \
 	echo "include $(abs_srctree)/Makefile"; \
 	}
 
-$(objtree)/Makefile: FORCE
+PHONY += $(CURDIR)/Makefile
+$(CURDIR)/Makefile: FORCE
 	$(call filechk,makefile)
 
-# Prevent $(srcroot)/Makefile from inhibiting the rule to run.
-PHONY += $(objtree)/Makefile
-
-outputmakefile: $(objtree)/Makefile
+outputmakefile: $(CURDIR)/Makefile
 ifeq ($(KBUILD_EXTMOD),)
 	@if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
-- 
2.47.3


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

* Re: [PATCH RESEND] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
  2026-07-23 10:58 [PATCH RESEND] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos Nicolas Schier
@ 2026-07-23 23:16 ` Nathan Chancellor
  2026-07-24  4:57   ` Nicolas Schier
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-07-23 23:16 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Nathan Chancellor, Thomas Weißschuh, linux-kbuild,
	linux-kernel, Anish Rashinkar, stable, Philipp Hahn,
	Nicolas Schier

> Update output Makefile in the corresponding tree only: for out-of-source
> in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree
> module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.
> 
> In-source builds are not affected.
> 
> Since commit c9bb03ac2c66 ("kbuild: reduce output spam when building out
> of tree"), building out-of-tree kernel modules out-of-source (make M=...
> MO=...) causes a rewrite of $(objtree)/Makefile with KBUILD_EXTMOD and
> KBUILD_EXTMOD_OUTPUT being set.  That is problematic:
> 
>  * $(objtree)/ must not be changed in any way when building out-of-tree
>    modules as it breaks other uses of $(objtree).
> 
>  * Setting KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT in $(objtree)/Makefile
>    kills the tree for incremental builds that start right there
>    ('make -C $(objtree)'); builds starting in $(srctree) reset
>    $(objtree)/Makefile to its original content.
> 
> Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at
> all.
> 
> This commit restores the previous kbuild behaviour prior to commit
> c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> but leaves in-place the use of filechk for output spam reduction.
> 
> Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> Reported-by: Anish Rashinkar <rashinkar.anish@gmail.com>
> Closes: https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com
> Cc: stable@vger.kernel.org
> Tested-by: Philipp Hahn <p.hahn@avm.de>
> Reviewed-by: Philipp Hahn <p.hahn@avm.de>
> Signed-off-by: Nicolas Schier <n.schier@fritz.com>
> Signed-off-by: Nicolas Schier <nsc@kernel.org>

Thanks!

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>

Do you want me to take this via kbuild-fixes?

-- 
Cheers,
Nathan


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

* Re: [PATCH RESEND] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
  2026-07-23 23:16 ` Nathan Chancellor
@ 2026-07-24  4:57   ` Nicolas Schier
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2026-07-24  4:57 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Thomas Weißschuh, linux-kbuild, linux-kernel,
	Anish Rashinkar, stable, Philipp Hahn

On Thu, Jul 23, 2026 at 04:16:22PM -0700, Nathan Chancellor wrote:
> > Update output Makefile in the corresponding tree only: for out-of-source
> > in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree
> > module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.
> > 
> > In-source builds are not affected.
> > 
> > Since commit c9bb03ac2c66 ("kbuild: reduce output spam when building out
> > of tree"), building out-of-tree kernel modules out-of-source (make M=...
> > MO=...) causes a rewrite of $(objtree)/Makefile with KBUILD_EXTMOD and
> > KBUILD_EXTMOD_OUTPUT being set.  That is problematic:
> > 
> >  * $(objtree)/ must not be changed in any way when building out-of-tree
> >    modules as it breaks other uses of $(objtree).
> > 
> >  * Setting KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT in $(objtree)/Makefile
> >    kills the tree for incremental builds that start right there
> >    ('make -C $(objtree)'); builds starting in $(srctree) reset
> >    $(objtree)/Makefile to its original content.
> > 
> > Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at
> > all.
> > 
> > This commit restores the previous kbuild behaviour prior to commit
> > c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> > but leaves in-place the use of filechk for output spam reduction.
> > 
> > Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> > Reported-by: Anish Rashinkar <rashinkar.anish@gmail.com>
> > Closes: https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com
> > Cc: stable@vger.kernel.org
> > Tested-by: Philipp Hahn <p.hahn@avm.de>
> > Reviewed-by: Philipp Hahn <p.hahn@avm.de>
> > Signed-off-by: Nicolas Schier <n.schier@fritz.com>
> > Signed-off-by: Nicolas Schier <nsc@kernel.org>
> 
> Thanks!
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> Tested-by: Nathan Chancellor <nathan@kernel.org>
> 
> Do you want me to take this via kbuild-fixes?

Yes, please take it via kbuild-fixes, as it actually breaks build trees.

Thanks!

-- 
Nicolas

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

end of thread, other threads:[~2026-07-24  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 10:58 [PATCH RESEND] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos Nicolas Schier
2026-07-23 23:16 ` Nathan Chancellor
2026-07-24  4:57   ` Nicolas Schier

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.