You can get away in most of the cases just by installing the kernel headers, but if you need to modify kernel parameters, then you'll have to install a custom kernel.
To install the kernel headers, first you need to find out what kernel you are using. To find that out do the following:
In my case, when I perform that command I get: 2.6.22-1-41.fc7
Now depending on which system you're running, you'll have to append .x86_64 or .i686 or whichever system you're using to the end of that number.
As we have been using a x86_64 distribution we use the following command to download the kernel headers:
#yum install kernel-headers-2.6.22-1-41.fc7.x86_64
There are many prebuilt packages at the repositories for the version of the kernel of the Fedora distribution.
With this procedure, we can build our own kernel in a way that will look the same as the Fedora distribution so we can use those prebuilt modules.
Download the latest kernel for your system, as August 2007, to get it:
$wget http://download.fedora.redhat.com/pub/fedora/linux/updates/7/SRPMS/kernel-2.6.22.1-41.fc7.src.rpm
Once the file is downloaded:
#rpm -ivh kernel-2.6.22.1-41.fc7.src.rpm
#cd /usr/src/redhat/SPECS
For x86_64:
#rpmbuild -bp --target x86_64 kernel-2.6.spec
For i686:
#rpmbuild -bp --target i686 kernel-2.6.spec
If you get the error: sparse >= 0.3 is needed by kernel-2.6.22.1-41.fc7.i686, just install sparce:
Now go to the directory /usr/src and delete any symbolic link pointing to another kernel:
Now, create a new symbolic link:
#cd /usr/src
For x86_64:
#ln -s redhat/BUILD/kernel-2.6.22/linux-2.6.22.x86_64 linux
#cd kernels
#ln -s ../redhat/BUILD/kernel-2.6.22/linux-2.6.22.x86_64 2.6.22.1-41.fc7-x86_64
For i686:
#ln -s redhat/BUILD/kernel-2.6.22/linux-2.6.22.i686 linux
#cd kernels
#ln -s ../redhat/BUILD/kernel-2.6.22/linux-2.6.22.i686 2.6.22.1-41.fc7-i686
Go to /usr/src/linux, edit the Makefile, look for the line EXTRAVERSION and set it to .1-41.fc7, at the end, the line should look like:
Now, perform the following commands to copy the original configuration of your Fedora installation:
#cp -p .config .config.orig
#make mrproper
#cp -p /boot/config-2.6.22.1-41.fc7 .config
If you want to perform changes in the configuration of the kernel, do a:
Once you're happy with your kernel, compile it, compile the modules and install it:
#make bzImage
#make modules
#make modules_install
#make install