Recompiling Linux Kernel
How to recompile Linux Kernel?
There are three types of levels of Configurations -
Pre-configurations -
a) Pre-Configuration
> visit the official kernel.org sites and download the latest kernel
> Copy to /home/USERNAME
> Uncompress Kernel
> bunzip2 linux-2.6.12.tar.bz2 if have the bzipped format
> bunzip2 linux-2.6.12.tar.bz2 if have the bzipped format
> tar –xvf linux-2.6.12.tar
> Change to Linux Directory: cd linux-2.6.12
> Through mrproper remove any old configuration / object files
> If older configuration file needs to be used, copy to .config.
> If a referance configuration file required then use config file in the right subdirectory of ~/linux-2.6.12/arch.
> If no such actions take place, reference config file is read from the right arch directory.
> Make the following Commands -
1)make oldconfig - add new options as yes/no/module
2)make menuconfig - Uses terminal which is indifferent from bios screen
3)make Xconfig - Uses GUI
4)make config - edit .config then run this command
b) Post Configuration
> Check Dependancies (./Documents/changes.txt file)
> Following the Running of make config method and saving .config file, make Kernel (make), takes long time depending upon the system.
> Switch to root (su), copy image to /boot directory ( for e.g. - cp /home/USERNAME/linux-2.6.12/arch/i386/boot/bzImage /boot/vmlinuz-2.6.12 - If any other architecture than i386, replace i386 with the right architecture)
> Installation of modules (make modules_install)
> Copy system map to /boot directory (cp /home/USERNAME/linux-2.6.12/System.map/boot/System.map-2.6.12)
> Change to /boot/grub directory (cd /boot/grub)
> Edit grun.conf and following changes should be made 0
title KingKrool’s Linux kernel 2.6.12 (title)
root (hdx, y) (drives on which grub is installed)
kernel /boot/vmlinuz-2.6.12 ro root=/dev/hdpn (Kernel Location)
> If compiled support for filesystem of the root partition as a module then add the following line at the end -
initrd (/boot)/initrd-2.6.12.img
(/boot is used when boot and root partitions are same)
(file intrd-2.6.12.img has to be made by the following command /sbin/mkinitrd /boot/intird-2.6.12.img)
> Save the file and exit>reboot and the Kernel is ready to use.
c) Configuration
> Use "modprobe" tool to add/remove Kernel Modules
> In menuconfig, press M to compile as a module, as in the xconfig click multiple times
|