Patching TuxOnIce into the kernel

TuxOnIce is next,

I always used hibernation when using Windows, so I wanted it on Gentoo too. I decided to use TuxOnIce because the main suspend-to-disk functionality already present in the kernel tree has a lot less room for customisation.

Installing it seems pretty easy. Just take the vanilla kernel sources and apply the patch provided by TuxOnIce. It is well maintained, so there are patches for all the release of the kernel. Patching the 2.6.27.12 kernel was as easy as downloading the patch and patching the kernel sources accourding to the manual and set the newly available settings using “make menuconfig”. After this build the new kernel and installed it.

After this you need to install the script package they also provide and create space to put the RAM image in. This includes the hibernation script, but also a script for cleaning up after resuming. It invalidates the RAM image after resuming, so it is not accidentally reused when booting another time.

I wanted to hibernate to a dedicated file using the filewriter, but after numerous attempt this failed. The hibernation script kept complaining that the image, where it needed to write to, was not consistent. I wanted to hibernate to a file, because in this way I am not dependent on how much swap space is used or present. I don’t actually use swap for now. The 2GB RAM is currently more then enough.

So I finally choose to hibernate to a swapfile that was not actualy used as swap space. This is essentially a dedicated file for hibernation. I use the following the following “script” to hibernate:
swapon /TuxOnIce.swap; hibernate; swapoff /TuxOnIce.swap
This makes sure enough swap space will always be present when hibernation is started. It is almost like just a dedicated file, but if other swap space is present that will be used first. And the third statement is actually executed when hibernation is finished and the resume already done, precisely when we don’t need the extra swap space anymore.

I am still pondering if I want to add an UI to the hibernation and resume process. The UI is also provided via a seperate download. It seems to make de hibernating and resuming slower, but does enable to cancel hibernation or resuming and show a progress bar. For now I just use TuxOnIce without an UI.

Tags: , , , , , ,

Leave a Reply