logos

With Andrii Grytsenko


Technical Diary - With Andrii Grytsenko

Linux Kernel from sources for Debian

It’s useful manual if you want to compile kernel from sources in Debian environment.

Get all required software over apt-get:

# apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps

Next, get latest linux kernel from kernel.org :

# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2

you can also done it over apt-get as well:

# apt-get install linux-source

Extract it:

# tar -xjvf linux-2.6.30.tar.bz2

and make symbolic link pointed out your sources and go there:

# ln -s linux-2.6.30.tar.bz2 linux
# cd linux

Configure your new kernel with

make menuconfig

or

make oldconfig

or

# make xconfig

and so on.

After you will finished. Run :

# make-kpkg clean
# fakeroot make-kpkg --revision=kernel_name-version kernel_image

Where is kernel_name-version – kernel name and version(e.g.: custom-1.0).

If compilation done without errors. Go to the /usr/src and install new kernel over

dpkg

tool:

# cd /usr/src
# dpkg -i kernel-image-2.6.30.2_custom-1.0_i386.deb

Create ramdisk from new kernel :

# cd /boot/
# mkinitramfs -o /boot/initrd.img-2.6.30 2.6.30

Last one step is loader configuration. I will describe how to do this for two most popular(grub and lilo) loaders. If you have lilo loader just add new section into the /etc/lilo.conf and edit directive default. Like this:

default=MYKERN
image=/vmlinuz
        label=MYKERN
        read-only
        initrd=/boot/initrd.img-2.6.30

Now, install new loader at boot sector:

# lilo -c /etc/lilo.conf

In case of GRUB loader. Put next section into the /boot/grub/menu.lst file:

title           My Debian GNU/Linux, kernel 2.6.30
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.30 root=/dev/sda1 ro
initrd          /boot/initrd.img-2.6.30

For GRUB loader no installs is require.

After loader section done well you have to restart you machine:

# reboot

Check you current kernel version with uname if during your booting time no problems were occurred:

# uname -r
2.6.30

If it’s matched with you installed kernel version then you done everything right.

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

Translate