Updated on 17 July 2008
I hope you know the essential packages like gcc, make, bzip2 or gunzip, fakeroot, wget, kernel-package required for compilation. There are two ways to build this
Nigel has tuxonice git for hardy, gutsy and feisty at http://kernel.ubuntu.com/git.
Vanilla kernel from www.kernel.org
1. Select kernel sources
Using the vanilla kernel means you have a rock solid kernel + tuxonice but you might lose the ease of installation proprietary stuff from linux-restricted-modules. You can also upgrade to a newer kernel with snazzy features. Git provides a way to have the existing linux-restricted-modules (i.e) all your restricted drivers work without any problem as before, and tuxonice but you will have to stay with the same kernel-version as ubuntu supplied. If you have brand new hardware it is best to use the bleeding edge code from git. Updating and installing an existing kernel is significantly easier with git. If you have no idea what git is - do not worry, you just need to issue a couple of commands. Both are documented below.
a) Using vanilla kernel
Point your browser at a kernel mirror and download the sources appropriately. Untar/zip it suitably. Preferably select a kernel version that has patches in toi.
tar -zxvf linux-2.6.---tar.gz cd linux-2.6.---
I generally prefer to compile kernel in my home directory to avoid any problems to root dir. Apply Tux on Ice patches.
bunzip2 tuxonice-version----.patch.bz2 cd linux-2.6.--- patch --dry-run -p1 < ../tuxonice-version----.patch
If there are no errors. then
patch -p1 < ../tuxonice-version----.patch
b) Using git repository
If you do not have git, then install it via synaptic or adept. Select gutsy/feisty/hardy depending on what you have.
[biophysics@uni] git clone git://kernel.ubuntu.com/nigelc/ubuntu-intrepid+tuxonice.git Initialized empty Git repository in /home/karthik/software/kernel_ubuntu/git/ubuntu-intrepid+tuxonice/.git/ remote: Counting objects: 917245, done. remote: Compressing objects: 100% (158487/158487), done. remote: Total 917245 (delta 758055), reused 916358 (delta 757258) Receiving objects: 100% (917245/917245), 260.17 MiB | 6390 KiB/s, done.
Now you will have a directory created: ubuntu-intrepid+tuxonice which contain the kernel sources which have been already patched with toi.
Do not once again patch it
cd ubuntu-intrepid+tuxonice
If you want to use git to do easy updates to both kernel and toi then do not delete the above directory for installation. All other steps are common for both methods .
2. Kernel configuration
Start with with your current configuration and modify it if you know what you are doing. It is preferable to enable Replace swsusp by default
cp /boot/config-`uname -r` ./.config make oldconfig make xconfig
Note if you are using gnome you may prefer
make gconfig
and if you prefer ncurses
make menuconfig
Save the config file and quit.
Snippets for tuxonice. You have do this only once. #reference_1
Create a file
/usr/share/initramfs-tools/scripts/local-premount/suspend2_do_resume
- with following contents
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
if [ -d /sys/power/tuxonice ]; then
echo 1 > /sys/power/tuxonice/do_resume
elif [ -d /sys/power/suspend2 ]; then
echo 1 > /sys/power/suspend2/do_resume
fi
Now, importantly give it execute permission.
sudo chmod +x /usr/share/initramfs-tools/scripts/local-premount/suspend2_do_resume
3. Build the custom kernel
Replace the string custom with whatever you like to name your kernel. Depending on the speed of your machine this will take some time. #reference_2
cd linux-2.6.--- fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
4. Install kernel
By default the kernel is located in the parent directory. Look out for the file that ends with .deb and install it.
sudo dpkg --install ../linux-image-version-custom*.deb
Check your
/boot/grub/menu.lst
to make sure that the new kernel is listed. (if you used git, then leave the sources intact so that you can use it to update kernel and toi very easily)
Now use the hibernate script and enjoy fast and reliable hibernate.
If you had enabled Replace swsusp by default then you can use
echo disk > /sys/power/state
or a GUI that ships with your desktop environment.
5. Notes on updating
So you have completed the install and after some days/weeks/months you want to update. How to do it ? Just cd to your sources
[biophysics@uni] cd ubuntu-gutsy+tuxonice [biophysics@uni] git pull
If there were any changes git will update your source. Repeat config (step 2) and install kernel.
6. References
1. https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/75616




