On Thu, Mar 04, 2004 at 09:48:58PM +0100, Dumas Patrice wrote:
Since the kernel is 2.6, I have trouble compiling and installing an external module. I could only compile the driver as root.
Yeah, I've noticed the same problem. I keep meaning to bugzilla it, but haven't gotten around to it yet. In the meantime, here's my notes on how to compile modules as a normal user:
And before I compile it I had to do the following as root:
- edit the Makefile in /usr/src/kernel-2.6.... and remove 'custom' from the EXTRAVERSION. Otherwise it isn't installed at the right place.
- run make oldconfig make prepare
As of the 2.6 kernel, you don't need kernel-source installed to compile kernel modules (which is what it looks like you're doing). The kernel package now contains all necessary files.
If I try to compile as a user, I get [pat@localhost driver]$ make make -C /usr/src/linux SUBDIRS=/home/pat/src/eagleusb/driver modules make[1]: Entering directory `/opt/fc2t/usr/src/linux-2.6.3-1.118' HOSTCC scripts/modpost.o cc1 : Permission non accordée : ouverture du fichier de dépendances scripts/.modpost.o.d make[2]: *** [scripts/modpost.o] Erreur 1 make[1]: *** [scripts] Erreur 2 make[1]: Leaving directory `/opt/fc2t/usr/src/linux-2.6.3-1.118' make: *** [eagle-usb.ko] Erreur 2
Even though you should only need the kernel package, the current Fedora one is missing some files. Specifically, all the actual executables are there, but some of the intermediate files are missing. This triggers make to try and rebuild them. Do this as a workaround (assuming kernel version 2.6.3-1.118) while logged in as root:
sed -ie 's/^always/#always/' \ /lib/modules/2.6.3-1.118/build/scripts/Makefile \ /lib/modules/2.6.3-1.118/build/scripts/genksyms/Makefile
Some timestamps are also messed up:
touch -r `ls -t /lib/modules/2.6.3-1.118/build/scripts/split-include \ /lib/modules/2.6.3-1.118/build/include/linux/autoconf.h \ /lib/modules/2.6.3-1.118/build/include/config/MARKER | head -1` \ /lib/modules/2.6.3-1.118/build/include/config/MARKER touch -r /lib/modules/2.6.3-1.118/build/arch/i386/kernel/asm-offsets.s \ /lib/modules/2.6.3-1.118/build/include/asm-i386/asm_offsets.h
And last but not least, I had to do the following, though I'm not sure if this is necessary for all external modules, or just the one I was building:
ln -s /dev/null /lib/modules/2.6.3-1.118/build/.__modpost.cmd
After the above commands, you should be able to build modules as a normal user.
gary