Building a custom kernel is one of the most important rites of passage for advanced Unices users. This process, while time consuming, will provide many benefits to your system. Unlike the GENERIC kernel, which must support a wide range of hardware, a custom kernel only contains support for your PC's hardware. This has a number of benefits, such as:

  • Faster boot time. Since the kernel will only probe the hardware you have on your system, the time it takes your system to boot can decrease dramatically.
  • Lower memory usage. A custom kernel often uses less memory than the GENERIC kernel by omitting unused features and device drivers. This is important because the kernel code remains resident in physical memory at all times, preventing that memory from being used by applications. For this reason, a custom kernel is especially useful on a system with a small amount of RAM.
  • Additional hardware support. A custom kernel allows you to add in support for devices which are not present in the GENERIC kernel.

Each Linux distribution has its own rules to build and install the kernels, for Fedora 14 you could play the following steps:

First of all, open a terminal window and login as root

# su -


Install the developer tools:

# yum install rpmdevtools yum-utils gcc make ncurses-devel


Then setup your build environment

# rpmdev-setuptree

Prepare the kernel sources (getting them from kernel.org)

# cd rpmbuild/SOURCES/

# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.gz

# tar -xf linux-2.6.20.tar.gz

(naturally you can choose the kernel version (v2.6 and 2.6.20 are only an example)


Compile the kernel

# cd linux-2.6.20

# make menuconfig

# make rpm


Install the new kernel

# cd ../../RPMS/i386

# rpm -ivh --force kernel-2.6.20.rpm

# cd /boot

# mkinitrd initramfs-2.6.20.img 2.6.20


Add the new kernel to grub

the file /boot/grub/grub.conf shall contain the following lines:

 

title Fedora (2.6.20)

        root (hd0,0)

        kernel /boot/vmlinuz-2.6.20 ro root=UUID=your_uuid rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8  KEYTABLE=uk rhgb quiet

        initrd /boot/initramfs-2.6.20.img


Now reboot your system and try the new kernel