Next Previous Contents

2. Installing software suspend

2.1 Downloading

Software suspend (aka swsusp) is hosted by http://sourceforge.net. You can access its site directly at http://sourceforge.net/projects/swsusp.

2.2 Overview

Kernel 2.2.X

Software suspend was first developped by Gabor Kuti and he used to maintain a page http://falcon.sch.bme.hu/~seasons/linux/swsusp.html for his patch. A patch is available against 2.2.20 kernel named v7c. Since this patch is no more maintained, this document will not provide much information on this version.

Kernel 2.4.X

Kernel 2.4.X is the most recent stable release of linux kernel. Unfortunately, software suspension isn't part of this kernel and should therefore be added using one of the patches provided on the above pages. The swsusp patch is named with a few conventions that includes:

Kernel 2.5.X

Software suspension is directly included since 2.5.18 in the main development kernel tree. As this kernel isn't stable and evolves fastly, this document will not provide information specific to this version, but some of the present informations may be found useful for using 2.5 software suspension support.

2.3 Requirements

Software suspension on a 2.4 kernel base needs a mono-processor machine with a CPU featuring pse or pse36 feature. Your hardware disks should be IDE (swsusp with SCSI is trying to be supported in 2.5 kernel).

2.4 Compiling the kernel

You need to choose the kernel source tree you want to use as basis. For instance, v15beta-acpi20020918 is the swsusp patch version 15 against the acpi20020918 patched kernel. As acpi20020918 is itself based upon a 2.4.19 vanilla kernel, you'll need to download this kernel source tree. Compiling a kernel is not that hard (see the Kernel-HOWTO) but be sure to save your running kernel as something like /boot/vmlinuz.old and add an entry in your lilo.conf file to be able to boot on this one.

Before applying any patch, you should compile the original kernel and set all configuration options so that your computer works correctly. Save the configuration in /usr/src/myconfig or something like that. The installation instructions for a kernel, including lilo setup, can be found on http://www.kernel.org.

2.5 Patching the kernel

Once you have succeeded in compiling your kernel and reboot apply the software suspend patch against /usr/src/linux.

cd /usr/src/linux
gzip -d < patch-vanilla-2.4.Y-swsuspX.gz | patch -p1
If the kernel versions match, then no error should happen. Otherwise you may have to manually edit some rejected hunks.

Load your previously saved configuration settings and add in General Setup section, Power Management and Software Suspend. You should find the following somewhere in the generated .config file.

CONFIG_SOFTWARE_SUSPEND=y

You can now compile your kernel...

2.6 Installing the new kernel

In order to set the suspendable kernel, you will have to add two new entries in your /etc/lilo.conf file.

You must have a swap partition on your disk. This swap partition should be at least 30% larger than your RAM (this is a rough estimation: it depends on the number of applications you suspend and their memory consumption). If you have 128M RAM, you may use 160M swap. It has to be formatted by mkswap and used as a swap area through /etc/fstab configuration file. You don't need a specific partition for swsusp.

Now you must set the resume kernel option to the swap partition you want to use for suspension. If your partition is, for instance, the third primary one on first ide disk (/dev/hda3) you have to append "resume=/dev/hda3" as kernel parameter in your lilo.conf file. IMPORTANT: make this entry the default entry in lilo.conf file. Otherwise, it is likely that you will reboot a non suspendable kernel on a resume image which may lead to impredictable results, including severely damage your filesystem. It may be useful to have another boot option with kernel parameters "resume=/dev/hda3 noresume" instead. This will allow you to skip resuming and boot normally. Once again, it is also advisable to keep an original version of the kernel in your boot options.

When you're happy with your file don't forget to run lilo and reboot the suspendable kernel. It should boot and run the same way as your original kernel. In fact, if you never suspend it is intended to be as stable as the original one ;-)


Next Previous Contents