# How do I compile fedora 16 kernel modules?

I'm trying to compile source kernel modules for a rocketraid controller against the 3.1.2-1.fc16.x86_64 kernel. I get an error:

/lib/modules/3.1.2-1.fc16.x86_64/build/include/linux/linkage.h:5:25: fatal error: asm/linkage.h: No such file or directory


However /lib/modules/3.1.2-1.fc16.x86_64/build/arch/x86/include/asm/linkage.h (which I presume is what it is looking for) exists. The overall structure looks almost identical to an F15 installation, where the compilation works fine. Is this something I am doing wrong? Or is there an F16 environment setup problem (I can see quite a lot of similar inquiries on the web about missing asm/xxx.h files, but no answers).

edit retag close merge delete

Sort by » oldest newest most voted

It's looking for a different file - asm/linkage.h. Could be this one, try locate.

locate linkage.h

more

Depends, see the g++ call (the last one before your error). Paste it to the original question please. Look for -I options. Add output of the "uname -a" and full paths of your files.

( 2011-11-28 12:02:54 -0600 )edit

It is quite simple to compile a kernel, and as I do this very often, here is a short description:

1. login to an terminal as root user
2. cd /usr/src

rm linux

(Confirm)

1. Load the necessary kernel sources from kernel.org e.g. with this command:
1. Extract the sources with this command:

tar xjf linux-3.6.6.tar.bz2

ln -s linux-3.6.6 linux

1. cd linux

2. Now you are in the new sources directory. After extraction we need to clean it.

3. make distclean (this is like make clean && make mrproper)

4. Now we have really clean kernel sources and we can think about how to go on. One step that is really interseting is: a.) See README file for option.

What maybe nice is make localmodconfig

This checks the current system and loads modules for every running system component.

after this I recommend to make a

for at least changing the name of your new kernel build.

c.) What else can be done In Fedora you have the last and current sources for the kernel in subdirectories under:

/usr/src/kernels/ There you also find a .config file you can take for an own kernel compilation.

You can try to take the most recent 3.x.y kernel for your system runnung a 3.x kernel and use this and the above mentioned .config file.

The most necessary steps would be:

make oldyesconfig make menuconfig ( In this make the following steps: a. load the .config file b. add an own kernel description, this is in the general options menu c. save the .configfile and exit) make make modules_install make install

for the single make entry it is very useful to add something like

-j4 for a doublecore-cpu -j8 for a quadcore

and

output.log for reducing local output.

In /usr/src/linux you find the README file by Linux Torvalds for more hints on how to compile a kernel.

more
more