Installing and configuring Knoppix (Linux) on Thinkpad T42
I installed Knoppix 3.6 (Linux 2.6.11) on to the hard disk of my
Thinkpad T42 (2378-FVU) in April 2005. I had Windows XP already
installed on the hard disk, so I first used Partition Magic to create
partitions for Linux, and then installed Linux with lilo as boot
manager. In this page I describe some of the steps I took to configure
my linux system to my liking.
Boot configuration
I placed "compact" in /etc/lilo.conf before the
first image= line. Without this option loading the kernel at boot time
takes more than 30 seconds.
This is my append= line in /etc/lilo.conf for the linux image:
append="resume=/dev/hda5 ramdisk_size=100000 init=/etc/init apm=power-off
nomce quiet lang=us desktop=kde screen=1400x1050 depth=32"
Choosing ACPI over APM
I set up the ACPI module to be loaded at boot time. For this I included
apm=power-off in the append= line in /etc/lilo.conf. I chose ACPI over
APM because only ACPI supports CPU frequency scaling (more on this
later). If I wanted APM instead of ACPI I would have included acpi=off
and apm=on in the append= line.
Unfortunately, however, I could not get suspend-to-RAM (Fn-F4) to work
with ACPI (it worked right off the bat with APM). Basically, the system
suffered a hard crash whenever I initiated suspend-to-RAM. A lot of web
sites offer advice on how to fiddle with the boot parameters to make
suspend-to-RAM work (e.g., using the s3bios boot parameter), but none of
that helped me. In the end I decided to live without suspend-to-RAM,
because I thought CPU frequency scaling was more valuable.
Suspend to disk
I could get suspend-to-disk to work easily with ACPI (in general
suspend-to-disk involves fewer complications than suspend-to-RAM). I
used the swsusp feature that is built-in to the 2.6.11 kernel. I did not
use swsusp2 (which is supposed to be a big improvement over swsusp)
because it requires downloading source code and compiling the kernel (it
is not a part of the base 2.6.11 kernel). I use my swap partition
/dev/hda5 for storing the memory image, by including resume=/dev/hda5 in
lilo.conf. (This essentially means that if the previous time we
suspended the machine rather than shutting it down then the next startup
would use the saved image rather than do a startup from scratch.)
Caution is required while using swsusp; nothing on disk or anywhere else
that is mounted at the time of suspension should be modified before
resumption (otherwise we may lose those modifications after resumption,
or worse still, crash the system). Therefore, we need to
- Unmount floppy drives, USB drives, and Windows partitions before
suspending (because data on those devices can change between suspend
and resume)
- Disable network interfaces before suspending (because the network
status can be different at resume time than it was at suspend time)
- Not try to bypass lilo manually and boot without the
resume=/dev/hda5 parameter
To automate all this I wrote a script hibernate.sh.
Suspending to disk takes about 30 seconds. Resumption takes over a
minute. This is not great, but it is still faster (and more convenient)
than shutdown and startup.
Sound
Sound (using alsa) works fine after I resume from a suspend, but does
not work after starting up from scratch. I have still not figured out
why.
CPU frequency scaling
CPU Frequency scaling is supported by the Centrino architecture, and is
critical to achieving good battery life and keeping the system cool.
All three frequency scaling policies, namely "performance", "userspace",
and "ondemand" worked for me. For the "userspace" policy I installed the
freely downloadable powernowd userspace daemon, with its default
configuration. It worked well. I finally settled on the "ondemand"
policy, with its default configuration (the ondemand policy is built in
to the kernel, and hence does not require anything to be installed). To make
this policy available I added the following lines to /etc/modules-2.6.11:
cpufreq_ondemand |
speedstep-centrino |
To select the ondemand policy at boot time I created a script ondemand, and placed this script in the startup
scripts directory (/etc/rc5.d).
Binding Thinkpad special buttons
I placed the following files in the directory /etc/acpi/events/:
hibernate, lcd, powerbtn, lid. These scripts
are written to be triggered by Fn-F12, Fn-F3, the power button, and lid
closure events, respectively. These scripts do the following actions,
respectively: suspend the computer to disk, toggle the LCD on and off,
shutdown the computer, and do nothing. (The names of these scripts can
be arbitrary.) For some reason the third and fourth scripts above did
not work as desired.
The above scripts use the following scripts which I placed in
/etc/acpi/: hibernate.sh, lcdonoff.sh, powerbtn.sh, and lid.sh.
For the lcdonoff.sh script I downloaded the radeontool package
(using apt-get).
To enable linux to recognize the Thinkpad buttons I placed the script ibmacpioptions in /etc/rc5.d. Also, I placed
in a link in /etc/rc5.d to the system-supplied script /etc/init.d/acpid
(acpid is the daemon that receives the button events and calls the
scripts).