Tuesday, April 14, 2009

tuxonice for debian

Debian provides the linux-patch-tuxonice package which is in the form of a kernel patch. To use it, we must compile the kernel after applying the patch. I outline the "debian way" of doing it, which will build deb packages of the patched kernel: Make a directory for all of this kernel stuff:
mkdir kernel && cd kernel
Download the kernel source, tuxonice patch and building helpers:
sudo apt-get install linux-source-2.6 linux-tuxonice-patch build-essential fakeroot
make sure you have all the necessary dependencies for building
sudo apt-get build-dep linux-2.6
Unpack the kernel source. Use the appropriate version as installed by the above apt-get command (I will use 2.6.29 here)
tar xjvf /usr/src/linux-source-2.6.29.tar.bz2
cd linux-source-2.6.29
Build the whole thing, including patch. Note: you might have to answer some kernel configuration questions. Choose the default values unless you have a good reason not to.
fakeroot make-kpkg --added_patches tuxonice --initrd --revision=+tuxonice.1 buildpackage
You should now have the full kernel .deb files in the parent dir. Before installation, add the resume argument to the kernel command line. First find out what is the swap partition:
grep swap /etc/fstab
Now edit the /boot/grub/menu.lst file to add this to all kernels:
sudoedit /boot/grub/menu.lst
Find the line beginning with "# defoptions" and append the argument
where /dev/hXX is the partition from the grep command above. My line looks like this:
# defoptions=quiet resume=swap:/dev/hda5
save the file. Now install the new kernel packages:
cd ../
sudo dpkg -i linux-*-2.6.29*.deb
install the hibernate package
sudo apt-get install hibernate
after rebooting with the new kernel, use hibernate:
sudo hibernate

No comments:

Post a Comment