The advantage of linux is that we can choose what our system needs and thereby improve its efficiency. Compiling the kernel has its own advantages though it is a time consuming process.A new Linux user may find it difficult to compile Linux kernel. This tutorial contains the process to compile Linux kernel version 3.0.3 under Ubuntu. However, instructions remains the same for any other distribution except for apt-get command.
Step # 1
Get Latest Linux kernel code and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number.
Step # 2
Configure kernel Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.Also we need the libncurses5-dev for the menuconfig
# sudo apt-get install gcc # sudo apt-get install libncurses5-dev
Step # 2
Extract tar (.tar.bz3) file Type the following command:
# sudo tar -xjvf linux-3.0.3.tar.bz2 -C /usr/src # cd /usr/src Now you can start kernel configuration by typing any one of the command:
$ make menuconfig – Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.
$ make xconfig – X windows (Qt) based configuration tool, works best under KDE desktop
$ make gconfig – X windows (Gtk) based configuration tool, works best under Gnome Dekstop. For example make menuconfig command launches following screen:
$make config – Textmode
You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.
Step # 4
$ sudo make
Start compiling to kernel modules:
$ sudo make modules
Install kernel modules:
$ sudo make modules_install
Step # 5
So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file: System.map-2.6.25 config-2.6.25 vmlinuz-2.6.25
Step # 6:
Type the following command at a shell prompt:
Step # 8 :
Reboot computer and boot into your new kernel Just issue reboot command:
#sudo shutdown -r now