All of lore.kernel.org
 help / color / mirror / Atom feed
* 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

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.