Compile linux kernel under Fedora

Fedora 13: fix for the ncurses library

How to compile a Vanilla kernel on Fedora, the easy/lazy way.

[Log in to get rid of this advertisement]
OK, I thought I would give some instructions on how I compile my kernels. My long-time windows user parts trader recently asked me how to compile a kernel on Fedora. He was confused with all the tutorials requiring you to build an RPM, so I showed him how I do it, the standard/easy/lazy way.
Before I start, here are a couple things I assume. I assume you are a Fedora user and that you are NOT in text mode, but in GNOME. I also assume you realize that this can take up to SIX HOURS on an old Pentium 3 1.3Ghz. Remember that some proprietary drivers as well as some free ones are not included in the kernel, so make sure you don't delete your existing one.

First get the dependencies you need.
su -c "yum -y install gcc ncurses-devel"

Next get the kernel source. I use 2.6.33.3 as an example.
To download it, click here.

Extract it by right-clicking on the file and then choosing extract here. This will take about five minutes.

Now open a terminal, become root, and cd to the directory linux-2.6.33.3. It is important to cd here and not to the kernel directory inside of there, even though make has an extra variable that specifies there.

Now we need to configure the kernel before we build it with make O=kernel menuconfig. It will take a couple minutes to set up, then you will be presented with a cheap psuedo-gui in your terminal. Just select exit and yes to save your config. You usually don't need to change anything here.

Ready to compile and install? Remember this can take up to six hours, and your machine may become VERY slow. It is not recommended that you attempt to use your machine with this in progress. OK then. As root, in the same directory, type:

make O=kernel && make O=kernel modules_install install

This will compile the kernel and install the kernel and it's modules.

Done? Now change the kernel and initrd in your bootloader to match the new kernel. If you ever want to reuse the same source code folder, use make mrproper to clean things up and build it again.

Hope this helps.
Last edited by bendib; 05-01-2010 at 06:30 AM..

No comments:

Post a Comment