Red Hat Bugzilla – Bug 117645
external kernel modules can't build as normal user
Last modified: 2007-11-30 17:10:37 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Description of problem:
With the 2.6 kernel, external modules should be buildable using just
the files in the kernel package without kernel-source (as in 2.4).
Doing a "make -C /lib/modules/VER/build SUBDIRS=. modules" in the
module source directory should work. However, some errors prevent this
from being possible unless you build the module as root.
Specifically, intermediate files in scripts/ and scripts/genksyms/
(all directories relative to /lib/modules/VER/build), aren't packaged
in kernel. As a result, the above make command tries to rebuild them
even though the final binary IS in kernel. The make fails because a
regular user doesn't have write access to the /lib/modules/VER/build
directory. The following command provides a workaround for the problem
by commenting out the final product in the Makefile (though a better
solution would probably be good):
sed -ie 's/^always/#always/' \
Also, some file timestamps are wrong, causing make once again to try
to rebuild files which are already built. The timestamps for
/lib/modules/VER/build/include/asm-i386/asm_offsets.h should be
updated using the following commands (though just touching all the
files before packaging would probably be best to avoid these problems
in the future):
touch -r `ls -t /lib/modules/VER/build/scripts/split-include \
/lib/modules/VER/build/include/config/MARKER | head -1` \
touch -r /lib/modules/VER/build/arch/i386/kernel/asm-offsets.s \
Lastly, module compilation tries to write to
/lib/modules/VER/build/.__modpost.cmd. As far as I can tell, this file
isn't actually needed for the module to function. The following
command fixed this problem for me:
ln -s /dev/null /lib/modules/VER/build/.__modpost.cmd
After the above set of commands, building modules as a normal user is
once again possible. As an example, I'm trying to build the modules
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download, untar, and configure the linux-wlan-ng module.
2. Run make on the module
Actual Results: The make fails when it gets to the "make -C
SUBDIRS=.../linux-wlan-ng-0.2.1-pre20/src/p80211 modules" command with
a permission denied error trying to write to
Expected Results: The module should build successfully.
I've seen this problem ever since kernel 2.6 was introduced into
RawHide. The above set of commands has always fixed it.
slight mistake in one of the commands above.
sed -i -e
I would let the kernel developers correct me if I am completely
misunderstanding the situation, but I believe this is NOTABUG for
Fedora but rather external Makefiles. There are also further
complications like Bug #121132 that prevent external module building,
which should be fixed soon in rawhide.
If this is still an issue with 327+ or later kernels please take it up
it is solved for me in 2.6.5-1.349