Let us see how to compile Linux kernel version 2.6.xx under Debian GNU Linux. However, instructions remains the same for any other distribution except for apt-get command. Compiling custom kernel has its own advantages and disadvantages.
1. Get Latest Linux kernel code
Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number.
# cd /tmp
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2
2. Extract tar (.tar.bz2) file
# tar -xjvf linux-2.6.xx.tar.bz2 -C /usr/src
# cd /usr/src
3. 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.
# apt-get install gcc
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.
4. Compile kernel
# make
Start compiling to kernel modules:
# make modules
Install kernel modules (become a root user, use su command):
# su -
# make modules_install
5. Install kernel
So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
# make install
6. Create an initrd image
# cd /boot
# mkinitrd -o initrd.img-2.6.xx
initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one.
7. Modify Grub configuration file - /boot/grub/menu.lst
# vim /boot/grub/menu.lst
or
# update-grub
8. Reboot computer and boot into your new kernel
# reboot
No comments:
Post a Comment