Kernel Compilation
If you have decided to re-compile your kernel it essentially means that either the current kernel configuration does not fulfill your needs or your are upgrading to the latest kernel.I needed to upgrade my 2.4 to 2.6 for working with my Bluetooth dongle.
Well even if you are completely satisfied with your kernel you can recompile it just for the sheer fun of it.
Obtaining the kernel soure code
If your upgrading your kernel get the latest kernel source code from www.kernel.org
The package is
generally in the bzipped format.After downloading the bzip package,copy it to
the /usr/src directory and unzip it
[root@haxbox src]# tar -jxvf linux-2.6.15.4.tar.bz2
Kernel Configuration
Migrate to the /usr/src/linux-2.x.xx.x directory.If you are recompiling your old kernel then this will be the existing source directoty else it will be the newly created directory /usr/src/linux-2.6.15.4
At this stage you have to configure your kernel which actually tells your kernel which parts of it are going to be compiled and which not.
To illustrate say you want to enable bluetooth support for your new kernel.Then you got to enable it at the time of configuring the kernel.You can confgure the kernel by atleast 3 different methods
A. make config => This mehod iteratively asks you which features to include and those to exclude
B. make menuconfig => A text-based menu interface is presented which allows you to do the same but in a much more easily decipherable manner
C. make xconfig=> A X-based graphical interface to configure the kernel
I personally used the make menuconfig.
[root@haxbox src]# make menuconfig
The kernel components can be compiled to be in any of the three states In-built into the kernel ( denoted by *),as a module(denoted by 'M') and not compiled(N).However in some cases the components can be compiled as modules only.
After you have configured the kernel,save the current kernel confguration.
The next step is to create the image (bzImage)
[root@haxbox linux-2.4.21-4.EL]# make bzImage
This creates the compressed image that the new kernel will boot from.The image file that is created is automatically saved in /usr/src/linux-2.4.21-4.EL/arch/i386/boot
The next step is to compile the components that has been compiled as modules.
[root@haxbox linux-2.4.21-4.EL]# make modules
Then install the modules using
[root@haxbox linux-2.4.21-4.EL]# make modules_install
Then finally you need to configure your bootloader to boot from the new kernel.For a automated procedure,execute
[root@haxbox linux-2.4.21-4.EL]# make install
At this point of time you might like to see the contents of /boot/grub/grub.conf .The contents will reflect the changes achieved by the make install command
Reboot your machine and you can boot your machine with the new kernel.
Kernel 2.6 specific
ERROR REGARDING QM_MODULES,init etc.
If you have upgraded your kernel to the 2.6 series you shall notice some errors a few of which are noted below
A )init not found b) Error related to QM_MODULES,etc.
The solution to this is to update your module-init-tools
./configure --prefix=/
make moveold
make
make install
now translate your old /etc/modules.conf into /etc/modprobe.conf with the ./generate-modprobe.conf script that comes with module-init-tools:
./generate-modprobe.conf /etc/modprobe.conf
That should be it.
RPM PROBLEM
Some of you might also face problems using their old redhat package manager with kernel 2.6.For that you need to upgrade to the latest RPM.
This account of kernel 2.6 compilation is by no means complete and for a more complete information and other kernel 2.6 specfiic problems visit URL: http://thomer.com/linux/migrate-to-2.6.html
The author, Amit K Saha, is a 2nd year Computer engineering undergraduate student at Haldia Institute of Technology, Haldia, India. His interests include Network protocols, Network security, Mobile computing, and Operating systems design. He is passionate about programming and Linux fascinates him. He is a music buff (listening) and hopes to learn to play the guitar and drums someday.
Homepage: http://amitsaha.in.googlepages.com













