Compiling the Linux Kernel – The Manual Debian Way

The goad: compile you neat own kernel with Suspend2 (or any other patch)

prerequisits: get needed packages:

gcc, binutils, fakeroot, kernel-package, tk8.x, libqt3-dev, libncurses5-dev

1.get vanilla kernel sources: kernel.org → ftp://ftp.kernel.org/pub/
e.g.: linux-2.6.21.1.tar.bz2 save to directory /usr/src

2.unpack kernel using

tar -xf linux-2.6.21.1.tar.bz2

3.Get the Suspend2 patch (suspend2.net) e.g.: http://www.suspend2.net/downloads/all/suspend2-2.2.10-for-2.6.21.1.patch.bz2

4.Patch the kernel using

cd /usr/src/linux-2.6.21.1
bzcat ../suspend2-2.2.10-for-2.6.21.1.patch.bz2 | patch -p1

5.configure the Kernel with

make xconfig

6.build the kernel with

make-kpkg kernel_image --revision 20070604.01

7.Install the kernel with

dpkg -i ../linux-image-2.6.21.1_20070604.01_amd64.deb

8.create the file suspend2.sh with the following content in /etc/initramfs-tools/scripts/local-premount/

#!/bin/sh
PREREQ=""
prereqs()

{
    echo "$PREREQ"
}
case $1 in
    prereqs)
    prereqs
    exit 0
    ;;
esac

# Begin real processing below this line

## see http://lists.debian.org/debian-kernel/2006/08/msg00215.html
#if [ ! -f /proc/suspend2/do_resume ] ; then
#    exit 0;
#fi

## see http://www.suspend2.net/HOWTO-2.html#ss2.4
echo 1 > /sys/power/suspend2/do_resume

9.create the ramfs:

cd /boot/
mkinitramfs -o initrd.img-2.6.21.1 2.6.21.1

10.Change the settings of grub:

vi /boot/grub/menu.lst

add the entry:

title   Debian GNU/Linux, kernel 2.6.21.1
root    (hd1,0)
kernel  /vmlinuz-2.6.21.1 root=/dev/sdc2 ro resume2=/dev/sdc5
initrd  /initrd.img-2.6.21.1

References

Comments