Compiling Kernel – II


Compiling Kernel – II

Get yourself a copy of the new kernel .you can
download it at

Here you will find out many packages

Get the latest kernel code for 2.6 kernel from

More keep on coming every fortnight.

If you do not want to download the new kernel
you can use the one you got with your installation.

Many distributions provide source packages
also along with their Distributions

You can compile it also, that also will
increase your performance.

Extract the kernel source file to /usr/src

(To extract

Copy the tar archive to /usr/src/ and then

tar xvzf linux-2.6…tar.gz


tar xvjf linux-2.6…tar.bz2

End extract)

cd /usr/src
**”Change Directory To /usr/src”**

ls -alc
**”check for symlink (ex. /usr/src/linux->/usr/src/linux-2.6.5)”**

rm linux
**”remove symlink”**

ln -s /usr/src/linux-x.x.x /usr/src/linux
**”make a new link to the new kernel”**

cd linux
**”type this to change to the directory”**

make mrproper
**”this removes the current .config and other files”**

Your Choice
make config
**”basic config from terminal”**
make menuconfig
**”for ncurses GUI in the terminal”**
make xconfig
**”for X-based GUI with modular explanations”**

Don’t forget to add module support and kernel support for future hardware.
Do not compile your hard drive and file system type as a module.
The configure program enables you to specify an enormous number of features. It
is advisable to skim through all the sections to get a feel for the different
things you can do. Most options are about specifying whether you want a feature
[*] compiled into the kernel image, [M] compiled as a module, or [ ] not
compiled at all. You can also turn off module support altogether from Loadable
module support –>. The kernel configuration is one LINUX program that
offers lots of help–select on any feature. The raw help file is
/usr/src/linux/Documentation/ and is worth reading.
When you’re done the config click exit and save current configuration. Your
file is now known as .config.

(vi, pico, emacs) Makefile
**”Want A Unique Kernel Name? Edit /usr/src/linux/Makefile and change
like I have this in my Makefile






#NAME=Woozy Numbat


So my kernel will be called as 2.6.11gm132

make clean
**”to clean your sources for they compile correctly”**

make bzImage
**”to make the kernel image (compile and creates compressed image of
(note the capital ‘I’ here)

make modules
**”compile your selected modules”**

make modules_install
**”to install newly compile modules (installs to /lib/modules/linux.x.x.x)”**

Now Its Time To Install Your New Kernel~!
copy the newly created kernel and to /boot
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-x.x.x
cp /usr/src/linux/ /boot/

I keep the name of vmlinuz as
Make the new links:
ln -s /boot/vmlinuz-x.x.x /boot/vmlinuz
ln -s /boot/ /boot/

Next remove existing initrd.img file:
rm -rf /boot/initrd.x.x.x.img

..And create the new one:
/sbin/mkinitrd /boot/initrd-x.x.x.img x.x.x
(Note: )
The last set of x.x.x is the equivalent to your new kernel version and it looks
to /lib/modules for that version.

Use The Steps That Pertain To You
If You Use Grub Then Edit grub.conf
If You Use lilo Then Edit lilo.conf

And Finally Edit Your /etc/grub.conf file

title New Kernel

kernel /vmlinuz-x.x.x ro root=LABEL=/
initrd /initrd-x.x.x.img
(Note: )
look at the previous parameters in the grub.conf file and note what
“root=” and use what is existing.

Exit and Save grub.conf
type “/sbin/grub-install”


And Finally Edit Your /etc/lilo.conf file
image = /boot/vmlinuz-x.x.x
label = New Kernel
root = /dev/hdx

(Note: )
look at the previous parameters in the lilo.conf file and note what “root
=” and use what is existing.

Exit and Save lilo.conf
type “sbin/lilo”


as requested there was wanting the instructions on how to apply patches to your
****END EDIT*****/

this step comes after untarring your kernel source.
When you download the patch place it in the folder that you untarred you new
Then typed:
patch -E -p1 < sound_patch
purely an example and you would type whatever the file name is in replace of

As of having alternative boot options, well this is no problem… The stuff
above that I tell you to add to your lilo or grub file above could just append
the file, and just add “.old” to the title of your original kernel
name for you will know the difference. And whether its grub or lilo adds
“read-only”, to the end of the original entries in the lilo.conf, or
grub.conf file.



Leave a Reply

Your email address will not be published. Required fields are marked *