First download and install the kernel source to your machine. Then move to that directory. In redhat linux the source is usually installed in a directory named linux-2.x.xx.xxx in the /usr/src directory. And a soft link to that directory is created by the name linux-2.4 (Assuming it is the source of the linux 2.4 kernel). So the kernel source is installed in /usr/src/linux-2.4 directory.
Now move to this directory. # cd /usr/src/linux-2.4The next step is creating the configuration file (.config). This can be done in three ways.
# make config - brings up a command-line console mode interface.
# make menuconfig - brings up a ncurses based GUI Interface.
# make xconfig - brings up a X GUI based user friendly interface.
You may use any one of the above three commands.Depending upon the command that was executed, you will get a relevent interface using which you can configure your kernel before it is compiled.For example, you can select the proper processor type in the configuration dialog. Another thing is you can decide whether to build a functionality directly in the kernel or load it as a module when the kernel needs it.This will optimise your kernel for your computer and will help decrease the size of your kernel. The end result is your linux machine starts much faster.
After you have made the changes to the settings, you have to save and exit.Then all the changes you made to the configuration file has been saved at /usr/src/linux-2.4/.config Now the next step is to make the dependencies. For that execute the following commands.
The first of these commands builds the tree of interdependencies in the kernel sources. These dependencies may have been affected by the options you have choosen in the configure step. The 'make clean' purges any now-unwanted files left from previous builds of the kernel. # make dep
# make clean
The next step is the actual compilation of the kernel. Here you can opt to create a compressed image by executing the command
# make bzImageOr if you opt for a non compressed image then you can execute the command
#make zImage
After the compilation is complete, you can find your newly compiled kernel here : /usr/src/linux-2.4/arch/i386/boot/bzImage .
If you have enabled loadable modules support in the kernel during configuring, then you have to now execute the commands # make modulesLoadable modules are installed in the /lib/modules directory.
# make modules_install
Now to start using your newly compiled kernel, you have to copy the kernel into the /boot directory.
# cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot/bzImage-mykernel-sept2004
# vi /etc/lilo.conf
//Inside lilo.conf fileMy root is located at /dev/hda3 which I found out using the command
image=/boot/bzImage-mykernel-sept2004
label=myker
root=/dev/hda3
read-only
# df /
Links:
http://bobcares.com/blog/?p=162
http://linuxhelp.blogspot.com/2004/08/steps-to-compile-kernel.html#axzz0gcGYpoAR
No comments:
Post a Comment