|HOME > MISC > LINUX > TOSHIBA 1115 SWSP|
This document builds on the work in the Red Hat 9 installation document. The software suspend kernel module should work on just about any laptop and even desktops. No special BIOS support is necessary, it's all done by the kernel by writing a copy of all memory to the swap partition on disk.
DISCLAIMER: This documentation is still very much a work in progress. Please proceed carefully and only if you're entirely comfortable with what you're doing. Definitely let me know if you've found any errors or know of a better way to accomplish this.
Once you have an otherwise working system running the 2.4.22 kernel with recent ACPI drivers you can attempt to set up Software Suspend on this laptop. Unfortunately that's the only method of suspending/hibernating that is currently known to work on this particular laptop.
To save time. Linux can take a while to start up and shut down. It's even longer to start applications that you might like to have running. With the suspend feature you can leave all your applications running, suspend to disk, then pick up where you left off quickly and easily. One nice thing about suspending to disk is that the laptop can be left off indefinitely with no loss of data.
To see if this was even worth it I did some timings with a stopwatch. My configuration has 512M of RAM so obviously the amount of RAM will impact the suspend/resume times the most. I also have a lot of services started at boot time as well.
|shutdown -h now||32 seconds|
|Normal power on to GNOME login||1 minute 22 seconds|
|Boot into XP||40 seconds|
|Software suspend||20 seconds|
|Power on to resume from suspend||40 seconds|
Disclaimer: Although the code seems to be pretty stable this is still very much an EXPERIMENTAL feature. Please make sure you have a backup of your system before experimenting with this feature.
First you want to start with a current kernel. These instructions are based on the 2.4.22 Linux Kernel. After you download that go to http://swsusp.sourceforge.net/ and download the latest patches which are 2.422 to 1.1-rc9 at the time of this writing. It's probably best to just download the latest in case I don't get around to updating these instructions in time. While you're at the swsusp module page also download the latest suspend.sh script which at the time of this writing is 0.15-rc1. This is the script that will set up your system for the cleanest possible suspend by shutting off services and removing modules that "don't play nicely" with the software suspend module.
Once you have those files move them to /usr/src and extract. Then you want to uncompress and apply the patches.
# cd /usr/src # gtar xjvf linux-2.4.22.tar.bz2 # bunzip2 swsusp-1.1-rc9-whole # cd linux-2.4.22 # patch -p1 < ../swsusp-1.1-rc9-whole
Now you will want to configure your kernel as you like but you will also need to enable support for the software suspend module. If you're using a Toshiba 1115-S103 laptop or something VERY similar you can try my config file as a baseline. If you use it copy it to /usr/src/linux-2.4.22/.config and continue as follows.
# make menuconfig Go to General Setup Scroll down to Software Suspend Click Y to enable Software Suspend, Compile in debugging output and Compress image.Wonderful. Now go ahead and build your kernel as you normally would.
# make dep # make bzImage # make modules (This can take a while, be patient) # make modules_install # make install
Great, your kernel is installed and there is one more important thing you need to fix. You need to tell the kernel at boot time where your swap/suspend partition is. Do an fdisk -l /dev/hda to see the partition name for your configured swap partition then edit /etc/grub.conf as follows replacing /dev/hda5 with the name of your own swap partition. While you're there also add another boot section with the noresume on the kernel line to recover from the possibility of ending up with a corrupted suspended session. Booting with that option will ignore it and just boot normally.
title Red Hat Linux (2.4.22) root (hd0,1) kernel /vmlinuz-2.4.22 ro root=LABEL=/ resume=/dev/hda5 initrd /initrd-2.4.22.img title Red Hat Linux (2.4.22) Ignore Software Suspend root (hd0,1) kernel /vmlinuz-2.4.22 ro root=LABEL=/ resume=/dev/hda5 noresume initrd /initrd-2.4.22.imgGreat, you're almost ready to test it. At this time I don't recommend you make this your default boot kernel until you've tested it. As always you need to remove an extraneous symlink to make sure PCMCIA works after the reboot.
# rm -rf /lib/modules/2.4.22/pcmcia # shutdown -r now
After the reboot you will first want to make sure the module got loaded ok. You should now have a directory /proc/swsusp containing several special files. If you don't then something went wrong or you booted into the wrong kernel. Double-check your work and try again.
As long as you have those files you're ready to configure the hibernate script. Go to where you downloaded the suspend.sh script and run it as root:
# chmod u+x suspend.sh # ./suspend.sh --installThis will create a file called /usr/sbin/hibernate and /etc/suspend.conf . Go ahead and edit the /etc/suspend.conf file and adjust it to suit your needs. The only thing I did was modify the following line as follows to make sure my wireless card gets reset properly:
For testing purposes just run code(); ?>/usr/sbin/hibernate as root and it should initiate a software suspend. The contents of memory will be written to your swap partition and if everything was successful your laptop should shut off in a few seconds.
When rebooting be sure to choose the boot option for the 2.4.22 kernel with software suspend you added above. Only if you have problems should you boot with the Ignore Software Suspend option. After you've tried a couple suspend/resume cycles go ahead and make the resume option your default boot kernel and enjoy!
One of the nice things about ACPI, when it works, is that it hooks into various features of the laptop such as power, battery(ies), buttons and LCD panel lids. You can use the built in ACPI support in the 2.4.22 kernel along with the acpid program to trigger things to happen in response to events.
In this case the most useful events are hitting the power button and closing the lid. As you probably know you have to hold down the power button for 5 seconds to just power off the laptop. However you can configure it so that just pressing the power button briefly will cause your laptop to suspend. In addition you can also configure it so that closing the lid to the laptop will also initiate a suspend.
Here's how. Go to the /etc/acpi/events directory and create a file called power with the following contents:
# Suspend the laptop when the power button is pressed event=button/power.* action=/usr/sbin/hibernate
If you would like the laptop to suspend when you close the lid create a file called lid with the following contents:
# Suspend the laptop when the LCD panel (lid) is closed event=button/lid.* action=/usr/sbin/hibernate
Now all you need to do is reload the acpid server to load the changes and make sure the server is started automatically at boot time:
# service acpid reload # chkconfig acpid on
Software Suspend HOWTO - This is the original HOWTO for the software suspend module. The only reason I wrote my own version was to make it a little easier for most newer Linux users.
Acpid Mini-HOWTO - This is a document that goes into more detail about the acpid server including how to install it just in case your distribution didn't happen to come with it.
Battery Powered Linux Mini-HOWTO - Another useful document that goes into various details of running Linux on a battery powered laptop.
If you have any leads on getting any more features working please drop me a line.
|Comments From People Like You!|
Software Suspend on Toshiba Satellite 1115-S103
|add a comment|