How to Compile a Kernel ?
Monday, September 22nd, 2008Step 1
Download
the kernel from below link
ftp://ftp.kernel.org/pub/linux/kernel/v
class="entry-body">2.6
(i am assuming that everyone like to compile a latest kernel
)
Step 2
Extracting the kernel
if its a archive
with tar.gz extension then do below in your /usr/src
# tar -zxvf
linux-2.6.x.x.tar.gz
If its a .tar.bz2 then do below in your /usr/src
# tar
-jxvf linux-2.6.x.x.tar.bz2
Step 3
You must
have a folder now in your /usr/src dir with the name of linux-2.6.x.x just symlink it with
dir linux
# ln -sf linux-2.6.x.x linux
Now change the dir to linux
#
cd linux
once you are inside the dir issue any of the below commands to configure
your new kernel
# make menuconfig (This will show you a command line screen to
configure the kernel)
or
# make xconfig (This will open up a qt based gui
window to configure the kernel)
Note : — if you want to configure the new kernel
same as of your old one then you just need to issue the below commands
# make
oldconfig && make modules_install && make install
This will install
your new kernel with the old config and also install the boot image and other files in your
/boot
Step 4
I am assuming now that you have
configured your new kernel and ready to compile it , just follow the below steps
#
make && make modules_install && make install
Now just sit and have a
cup of tea/coffee as kernel compilation will take some time
Once the compilation is
finished you need to reboot your machine and start using your new kernel
NOTE
- i am assuming you are using grub here for that you need to select the option on boot for
the new kernel
lilo users - here comes my
lilo.conf
boot=”/dev/hda”
lba32
prompt
timeout=”50″
defa
ult=2.6.x.x
vga=”792″
image=”/boot/kernel-2.6.x”
label=”linux”
root=”/dev/hda4″
read-only
#
initrd=”/boot/kernel-2.6.17″
#root=/dev/ram0
#append=”init=/linuxrc
real_root=/dev/hda4″
image=”/boot/kernel-2.6.20.3″
label=”2.6.20.
3″
root=”/dev/hda4″
read-only


