* MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
@ 2026-07-16 17:34 Anish Rashinkar
2026-07-22 14:58 ` Nicolas Schier
0 siblings, 1 reply; 6+ messages in thread
From: Anish Rashinkar @ 2026-07-16 17:34 UTC (permalink / raw)
To: linux-kbuild
I have a few projects in which I am writing kernel modules. I use the
MO flag to put the build artifacts in a separate directory. A simple
make command with MO would look like -
make -C /lib/modules/$(uname -r)/build M=$PWD MO=$PWD/build/ modules
This used to work for me, and still works for me if I boot into the
6.19.10-300 kernel that Fedora preserved. I was on 7.0.X for a while
on Arch Linux and it worked there too. I am not sure but I might have
tried compiling my projects (if so, compiled successfully) on Fedora
Atomic that I was trying out, which should have been on 7.0 or 7.1. As
of the latest kernels on both Arch Linux and Fedora (7.1.3-201 on
Fedora), I encounter an error when using the MO flag.
make -C /lib/modules/7.1.3-201.fc44.x86_64/build M=/home/anish/temp
MO=/home/anish/temp/build modules
make[1]: Entering directory '/usr/src/kernels/7.1.3-201.fc44.x86_64'
make[2]: Entering directory '/home/anish/temp/build'
/bin/sh: line 1: /usr/src/kernels/7.1.3-201.fc44.x86_64/.tmp_Makefile:
Permission denied
make[3]: *** [/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile:705:
/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile] Error 1
make[2]: *** [/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile:248:
__sub-make] Error 2
make[2]: Leaving directory '/home/anish/temp/build'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/7.1.3-201.fc44.x86_64'
make: *** [Makefile:6: all] Error 2
If I grant root privileges to make, it will replace the Makefile at
/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile with its own Makefile
wrapper.
If I don't use the MO flag, then the build succeeds and all the build
artifacts are stored in my source directory.
I am new to Linux programming and especially bug reporting like this.
I had raised this issue on Fedora Discussions with no one to properly
respond that helps the problem. This issue should have appeared
relatively recently. Please let me know if this is a bug or something
changed with how it should be used, because the official guides state
the same way I mentioned in writing a Makefile and using the MO flag.
And with what I can comprehend and with what all LLMs are saying, this
is a bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
2026-07-16 17:34 MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source Anish Rashinkar
@ 2026-07-22 14:58 ` Nicolas Schier
2026-07-29 22:32 ` logafinl
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Schier @ 2026-07-22 14:58 UTC (permalink / raw)
To: Anish Rashinkar; +Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild
[-- Attachment #1: Type: text/plain, Size: 2555 bytes --]
[Cc: nathan]
On Thu, Jul 16, 2026 at 11:04:23PM +0530, Anish Rashinkar wrote:
> I have a few projects in which I am writing kernel modules. I use the
> MO flag to put the build artifacts in a separate directory. A simple
> make command with MO would look like -
> make -C /lib/modules/$(uname -r)/build M=$PWD MO=$PWD/build/ modules
>
> This used to work for me, and still works for me if I boot into the
> 6.19.10-300 kernel that Fedora preserved. I was on 7.0.X for a while
> on Arch Linux and it worked there too. I am not sure but I might have
> tried compiling my projects (if so, compiled successfully) on Fedora
> Atomic that I was trying out, which should have been on 7.0 or 7.1. As
> of the latest kernels on both Arch Linux and Fedora (7.1.3-201 on
> Fedora), I encounter an error when using the MO flag.
>
> make -C /lib/modules/7.1.3-201.fc44.x86_64/build M=/home/anish/temp
> MO=/home/anish/temp/build modules
> make[1]: Entering directory '/usr/src/kernels/7.1.3-201.fc44.x86_64'
> make[2]: Entering directory '/home/anish/temp/build'
> /bin/sh: line 1: /usr/src/kernels/7.1.3-201.fc44.x86_64/.tmp_Makefile:
> Permission denied
> make[3]: *** [/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile:705:
> /usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile] Error 1
> make[2]: *** [/usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile:248:
> __sub-make] Error 2
> make[2]: Leaving directory '/home/anish/temp/build'
> make[1]: *** [Makefile:248: __sub-make] Error 2
> make[1]: Leaving directory '/usr/src/kernels/7.1.3-201.fc44.x86_64'
> make: *** [Makefile:6: all] Error 2
>
> If I grant root privileges to make, it will replace the Makefile at
> /usr/src/kernels/7.1.3-201.fc44.x86_64/Makefile with its own Makefile
> wrapper.
>
> If I don't use the MO flag, then the build succeeds and all the build
> artifacts are stored in my source directory.
>
> I am new to Linux programming and especially bug reporting like this.
> I had raised this issue on Fedora Discussions with no one to properly
> respond that helps the problem. This issue should have appeared
> relatively recently. Please let me know if this is a bug or something
> changed with how it should be used, because the official guides state
> the same way I mentioned in writing a Makefile and using the MO flag.
> And with what I can comprehend and with what all LLMs are saying, this
> is a bug.
Thanks for the report! This is definitely a bug and I can reproduce
this. I'll have a look at it tomorrow.
Kind regards,
Nicolas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
2026-07-22 14:58 ` Nicolas Schier
@ 2026-07-29 22:32 ` logafinl
2026-07-29 23:12 ` Nathan Chancellor
0 siblings, 1 reply; 6+ messages in thread
From: logafinl @ 2026-07-29 22:32 UTC (permalink / raw)
To: n.schier; +Cc: linux-kbuild, nathan, nsc, rashinkar.anish, thomas.weissschuh
Hello,
I was running into this issue myself and used bisect to pinpoint
c9bb03ac2c66bc5aa81b51ea0792477524c2763a as the commit that introduced the bug.
I don't have enough experience in Kbuild to understand what in that commit
causing the problem, unfortunately.
Thanks,
Logan Finley
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
2026-07-29 22:32 ` logafinl
@ 2026-07-29 23:12 ` Nathan Chancellor
2026-07-29 23:36 ` Logan Finley
0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2026-07-29 23:12 UTC (permalink / raw)
To: logafinl; +Cc: n.schier, linux-kbuild, nsc, rashinkar.anish, thomas.weissschuh
On Wed, Jul 29, 2026 at 03:32:22PM -0700, logafinl wrote:
> Hello,
>
> I was running into this issue myself and used bisect to pinpoint
> c9bb03ac2c66bc5aa81b51ea0792477524c2763a as the commit that introduced the bug.
> I don't have enough experience in Kbuild to understand what in that commit
> causing the problem, unfortunately.
Does
https://git.kernel.org/kbuild/c/39d6e68f50f4a444a6ba23b9ea2eaee806601c6d
resolve this issue for you?
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
2026-07-29 23:12 ` Nathan Chancellor
@ 2026-07-29 23:36 ` Logan Finley
2026-07-30 0:52 ` Nathan Chancellor
0 siblings, 1 reply; 6+ messages in thread
From: Logan Finley @ 2026-07-29 23:36 UTC (permalink / raw)
To: nathan; +Cc: linux-kbuild, n.schier, nsc, rashinkar.anish, thomas.weissschuh
On Wed, Jul 29, 2026 at 04:12:42PM -0700, Nathan Chancellor wrote:
> Does
>
> https://git.kernel.org/kbuild/c/39d6e68f50f4a444a6ba23b9ea2eaee806601c6d
>
> resolve this issue for you?
Yes, it does. I apologize; I didn't see that there was already a fix.
Thanks,
Logan Finley
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source.
2026-07-29 23:36 ` Logan Finley
@ 2026-07-30 0:52 ` Nathan Chancellor
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2026-07-30 0:52 UTC (permalink / raw)
To: Logan Finley
Cc: linux-kbuild, n.schier, nsc, rashinkar.anish, thomas.weissschuh
On Wed, Jul 29, 2026 at 04:36:41PM -0700, Logan Finley wrote:
> On Wed, Jul 29, 2026 at 04:12:42PM -0700, Nathan Chancellor wrote:
> > Does
> >
> > https://git.kernel.org/kbuild/c/39d6e68f50f4a444a6ba23b9ea2eaee806601c6d
> >
> > resolve this issue for you?
>
> Yes, it does. I apologize; I didn't see that there was already a fix.
No worries, it is a little hidden away. Thanks a lot for confirming that
it works.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-30 0:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16 17:34 MO flag not working properly for building out-of-tree modules, tries to replace the Makefile in the kernel's source Anish Rashinkar
2026-07-22 14:58 ` Nicolas Schier
2026-07-29 22:32 ` logafinl
2026-07-29 23:12 ` Nathan Chancellor
2026-07-29 23:36 ` Logan Finley
2026-07-30 0:52 ` Nathan Chancellor
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.