Linux on the IBM ThinkPad X41 Laptop

oliver@net-track.ch

This document shows how I have installed Debian unstable on my IBM ThinkPad X41 laptop. The document is written primarily for myself (to save myself the hassle of trial and error the next time, and, as a first exercise to help me accomodate to the new keyboard), so don't take all this information as the one and only truth.

Hardware

The ThinkPad X41 is an ultralight laptop (about 1.3 kg) with an 12.1" 1024x768 TFT display. My model contains an 1.5 GHz Low-Voltage Pentium-M CPU, 512 MB RAM and a 60 GB ATA harddrive. The X41 contains all sorts of network connections (10/100/1000 Ethernet, 802.11a/b/g Wireless, Bluetooth and a V.92 modem). There is no built-in optical drive, it is only available through the docking station.

# lspci
0000:00:00.0 Host bridge: Intel Corp. Mobile Memory Controller Hub (rev 03)
0000:00:02.0 VGA compatible controller: Intel Corp. Mobile Graphics Controller (rev 03)
0000:00:02.1 Display controller: Intel Corp. Mobile Graphics Controller (rev 03)
0000:00:1c.0 PCI bridge: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 1 (rev 03)
0000:00:1d.0 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03)
0000:00:1d.1 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03)
0000:00:1d.2 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)
0000:00:1d.3 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03)
0000:00:1d.7 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)
0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev d3)
0000:00:1e.2 Multimedia audio controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
0000:00:1e.3 Modem: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Modem Controller (rev 03)
0000:00:1f.0 ISA bridge: Intel Corp. 82801FBM (ICH6M) LPC Interface Bridge (rev 03)
0000:00:1f.2 IDE interface: Intel Corp. 82801FBM (ICH6M) SATA Controller (rev 03)
0000:00:1f.3 SMBus: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controller (rev 03)
0000:02:00.0 Ethernet controller: Broadcom Corporation: Unknown device 167d (rev 11)
0000:04:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev 8d)
0000:04:00.1 0805: Ricoh Co Ltd: Unknown device 0822 (rev 13)
0000:04:02.0 Network controller: Intel Corp.: Unknown device 4224 (rev 05)

Create Windows XP Recovery CDs

Although this laptop is not quite cheap, IBM does ont ship any recovery CDs by default. However, you can create such CDs by yourselves. If you don't succeed installing Linux or would like to come back to Windows some time later, this is a good thing to have.

To create the recovery CDs, boot your machine into Windows. The program to create the recovery CDs is called (in German) "CDs oder DVDs zur Wiederherstellung erstellen". This means something like "Create recovery CDs or DVDs", and you can find it in the Start -> Programs -> Access IBM menu of the preinstalled Windows installation.

This process will create six CDs that can be used to reset your laptop to the shipping state (I have tested this). Creating the CDs is quite slow, so don't do this when you are in a hurry.

Re-Partitioning the Harddisk

The default installation installs two partitions: a 50+ GB NTFS partition holding the Windows installation, and a 4 GB partition holding the recovery data.

Although I only rarely use it, I like to keep the original Windows XP installation for BIOS or other Firmware upgrades. I therefore decided to shrink the Windows partition to 8 GB and to keep the partition holding the recovery data.

I booted using a Debian Sarge installation CD and left the installer to go for an interactive shell (using ALT - Cursor Right).

There, I resized the partition using the ntfsresize program to 8 GB. The basic steps will be outlined here, but there is a much more comprehensive example in the ntfsresize FAQ.

# Test run, to check that ntfsresize can actually resize the partition
ntfsresize -n -s 8G /dev/ide/host0/bus0/target0/lun0/part1

# Main run
ntfsresize -s 8G /dev/ide/host0/bus0/target0/lun0/part1

Next, I ran fdisk to temporarily delete the windows partition and immediately re-create it. It is very important that the partition type is exactly the same (NTFS), the starting cylinder stays the same and that the partition is bootable. Because I don't know how I can find out the minimal partition size NTFS uses, I have made a 8.2 GB partition (this is also explained in the FAQ mentioned above). Since there's plenty of space on the disk, this does do any harm.

Next time Windows is booted, it will check the filesystem. This should not give any errors.

Debian Installation

Next, I installed Debian with a Sarge Installation CD. This allowed me to partition the remaining space and install Debian on one of these partitions.

After installing the laptop, I immediately upgraded it to Debian unstable.

Network Interface

The network interface is not automatically recognized by the installer. You have to manually load the tg3 module.

Kernel

I created a custom kernel using the vanilla 2.6.12.3 sources from kernel.org. Download the config here.

Harddisk Tuning

Harddisk access is slow (about 2 MB/s according to hdparm). I have tried all sorts of tuning attempts until I stumbled over this patch. With the patch, DMA mode can finally be enabled and the harddisk now rocks at around 20 MB/s! Hopefully this issue will be resolved in later kernels.

I now have the following in my /etc/hdparm.conf:

/dev/hda {
        mult_sect_io = 16
        write_cache = on
        interrupt_unmask = on
        io32_support = 3
        dma = on
}

Wireless

802.11a/b/g wireless works using the Intel PRO/Wireless 2200BG Driver for Linux available at ipw2200.sf.net.

USB

USB is properly recognized. I haven't tested a lot of various devices, but from what I see this works without any problem.

X11

Using the i915 module and the xserver-xorg package, X11 runs like a charm. I have the following Device section in /etc/X11/xorg.conf:

Section "Device"
        Identifier      "Card-LCD"
        Driver          "i810"
        Option          "MonitorLayout" "NONE,LFP"
EndSection

Trackpoint

The trackpoint of the X41 supports the "point-to-click" feature. In order to activate it, a kernel patch is needed. I have installed this patch, however, I quickly got very disappointed with the point-to-click feature (this has nothing to do with the patch!).

Since I don't need the other features (the defaults work well for me), I will probably not use this patch any longer.

Sound

Sound output worked out-of-the box for me. Nothing to comment on that.

Power Management

For power management to work, the kernel modules ibm-acpi and acpi-cpufreq need to be loaded. This can be done using the following entries in /etc/modules:

ibm-acpi
acpi-cpufreq

Using the cpufreqd package, the CPU can now be throttled depending on the current utilization and other, configurable parameters.

I have also enabled suspend-to-RAM and suspend-to-disk. On my setup, susped-to-RAM is enabled by closing the lid. It is implemented using the following script, adapted from this site. The script goes into /etc/acpid/actions/lm_lid.sh:

#!/bin/bash

savedir=/var/cache/acpi

pover_state=/sys/power/state
lid_state=/proc/acpi/button/lid/LID/state
video_state=/proc/acpi/ibm/video

test -d $savedir || mkdir $savedir

current_vt=`fgconsole`

vt=$savedir/vt

test -e $lid_state || exit 0
test -e $power_state || exit 0
test -e $video_state|| exit 0

if grep -q closed $lid_state; then
  echo $current_vt > $vt
  chvt 8
  echo -n "auto_disable" > $video_state
  echo -n "mem" > /sys/power/state
else
  if [ $current_vt = 8 ]; then
    echo -n "auto_enable" > $video_state
  fi
  if test -e $vt; then
    chvt `cat $vt`
    rm -f $vt
  fi
fi

Suspend-to-disk is somewhat more complicated. I have setup software suspend2. Unfortunately, I am unable to get the Fn-F12 to trigger. I have therefore set software suspend to Fn-F4.

Suspend-to-disk works generally, but it fails to resume if the laptop is suspended while in the docking station and resumed while mobile and vice versa. Maybe this could be solved by tweaking the various hibernate scripts, but this is not very high on my agenda.

ACPI and High Pitch Noise

From time to time, the laptop emits a low-volume very high pitch noise. According to the ThinkWiki site, this is related to the powersaving states C3 and C4, which are activated by the ACPI module "processor" when the system is idle. Using the max_cstate parameter, you can avoid the C3 and C4 states and thus resolve the high pitch noise problem. If the processor module is compiled into the kernel, add the following to your boot command line:

processor.max_cstate=2
  

If processor is compiled as a module, do the following:

echo "options processor max_cstate=2" >> /etc/modutils/acpi
update-modules
  

Since this disables two powersaving states in the CPU, I guess that this change also somehow affects the battery life. However, I don't know the full implications of this. If you have more information, I would be glad to hear about it.

About the "Access IBM" Button

The blue Access IBM button can be made to function using tpb. It allows you to invoke anything you like whenever the user presses the button.

But the tpb program does not only this. It also watches the volume up/down/mute and brightness keys and shows a gauge bar in an on-screen display. Definitely a very handy piece of software!

Bluetooth

Bluetooth setup is very simple, too. Upon pressing Fn-F5, the Bluetooth USB device is connected and hotplug loads the corresponding driver. Now the tools from the bluez-utils package can be used to configure connections to other devices.

Other Useful Software

Other Links

Todo

History