20 December 2004

My Linux on Thinkpad T41p Guide

Posted under: at 13:30

I recently bought myself a second hand IBM Thinkpad T41p 2373GEU. Only recently I managed to install a Linux distribution in it. The distribution is, of course, Gentoo Linux. The greatest thing about this notebook is that the model and its variants are used by many greatest Opensource hackers. So it is easy to find support when things are not working.

The following is what I’ve done to make this notebook works under Linux. It is Gentoo specific, but some information could also be applicable to other distributions. It is T41p specific, but the same information could be useful to owners of other IBM Thinkpad notebooks: T40, T40p, T41, T42, T42p, R40, R40e, R41, R41e, R50, R50p, R51, X40, for search engines purposes :).

Note: Some parts of this guide is outdated. Please refer to update to this document for more information.

Dual Booting Setup

I changed the predesktop area protection under BIOS to ‘secure’, just in case. Using fdisk on Gentoo Boot CD I nuked the existing Windows partition, and then created the partition layout I wanted to use. This is what I use:

  • /dev/hda1: 18GB, W95 FAT32 (LBA) (type c)
  • /dev/hda2: 2GB, Linux swap (type 82)
  • /dev/hda3: 500MB, Linux (type 83)
  • /dev/hda4: the rest, Extended partition
  • /dev/hda5: all of extended, Linux (type 83)

(I originally splitted the extended partition into two Linux partition for installing another flavor of Linux distribution, but decided that the disk space would be a bit too little for me if I did that)

After partitioning I rebooted and installed Windows XP from the predesktop area. It complained about partition, I let it fix it. After it fixed it, I rebooted to Gentoo Boot CD again just to make sure it didn’t do anything funny to my partition. It didn’t, so I went back to installing XP. Politely, it installed to the partition I marked as Windows partition, and didn’t touch other partitions.

When installing Gentoo, I edited /etc/rc.conf and set CLOCK=”local”, because Windows XP stores date in local time, not in UTC. And of course, much later on I also changed the default editor from nano to vim, but that goes without saying :).

Never forget to use swap partition twice as large as the system RAM if you plan to use software suspend.

BIOS Settings

I had to shut off power management in BIOS, it hung the system when I left the system compiling things. When booting, hit the ‘Access IBM’ key and go to setup. Went to ‘Power’, and ‘Config’. I changed ‘Power Mode for AC’ and ‘Power Mode for Battery’ to ‘Customized’. And under ‘Customize’ settings, I changed ‘Processor Speed’ to ‘Fixed Max’, ‘Suspend Timer’ to ‘Disabled’, ‘LCD off timer’ to ‘Disabled’ and ‘HDD off timer’ to ‘Disabled’. This fixed all the problem caused by power management in BIOS. I was using 2004.2 install CD, the newer version could fix this problem but I haven’t verified that yet.

Changed all PCI IRQ settings in BIOS from 11 to ‘Auto Select’. This reportedly fixes some instability issues with wireless networking.

Compiler Optimization

Note: it is planned that Gentoo 2005.0 will use GCC 3.4, Kernel 2.6, NPTL and udev by default, so it would be unnecesary to do some of the stunts below.

I managed to bootstrap Gentoo from stage1 using GCC 3.4 which contains specific optimization for Pentium-M processor. Before bootstrapping, I changed the default profile to gcc34 profile:

cd /etc
rm /etc/make.profile
ln -s ../usr/portage/profiles/default-linux/x86/2004.2/gcc34 

And then unmasked GCC 3.4 and supporting ebuilds in /etc/portage/package.keywords:

sys-devel/gcc ~x86
sys-libs/glibc ~x86
sys-libs/libstdc++-v3 ~x86
sys-kernel/linux26-headers ~x86

I also enabled NPTL by using ‘nptl’ and ‘nptlonly’ USE flags in /etc/make.conf.

I needed to bootstrap twice because stage1 shipped with GCC 3.3. In first bootstrap I used CFLAGS="-O3 -march=pentium3 -fomit-frame-pointer -pipe". Bootstrap installed GCC 3.4 and all the supporting packages above. After GCC 3.4 was installed, I rebootstrap again, this time with CFLAGS="-O3 -march=pentium-m -fomit-frame-pointer -pipe -fno-delayed-branch -fcaller-saves -freorder-blocks -freorder-functions -falign-jumps -finline-functions -frename-registers -fweb -fno-trapping-math -falign-functions=64". I got those information from Acer Travelmate 803LCi guide on Gentoo Wiki. I plan to do some acovea runs when I finished configuring.

Graphical Console

I’m using ‘vesa-tng’ graphical console with mode ‘1024×768-24@60′. The required kernel parameter is: video=vesafb:1024x768-24@60, without it I got a measly 640×480 console. For some reason it won’t display anything if I use higher resolution.

Update: I no longer use graphical console as it doesn’t work with S3 suspend (sleep).

Trackpoint and Touchpad

Both were detected by psmouse module.

There is a patch for Linux kernel in order to enable advanced features of Trackpoint such as tap to click. I didn’t install this myself, as I like Touchpad better.

Emerged ‘synaptics’, the driver for Touchpad and Trackpoint on X.

tp-scroll can be used to control Trackpoint scrolling (holding middle button). I don’t use this as I’m content with Touchpad’s edge scrolling. Besides, there are some cases where middle button dragging could be useful, for example for moving KDE panel’s applets and buttons.

CPU Throttling

After trying several CPU scaling daemon, now I’m settled with powernowd (emerge powernowd ; rc-update add powernowd default). The required kernel module is speedstep-centrino, but I compiled it in kernel instead.


I configured X by using X -configure to generate /root/xorg.conf-new. The generated xorg.conf-new used the ‘ati’ driver, I changed it to ‘radeon’, I don’t know if this makes any difference.

glxgears crashed X :(. I don’t expect spectacular glxgears performance with this stock driver, but I also didn’t expect running it would crash the system. I don’t plan to do extensive 3D gaming (under Linux anyway), and the ATI binary modules still require old version of X, so the standard Xorg radeon driver would be fine for me, except for this crashing problem. For now I simply comment out Load "glx" line to disable 3D entirely, just to be sure I won’t lock up the system by accidentally running 3D programs.

Emerged radeontool, an utility to control the LCD backlight, among others.

Added Option "DynamicClocks" "on" in video card section on /etc/X11/xorg.conf. This is to enable PowerPlay feature of the graphic chip.


emerge acpid ibm-acpi and rc-update add acpid default. Added ac, battery, button, fan, processor, thermal and ibm_acpi to /etc/modules.autoload.d/kernel-2.6 (not sure if I need all of them). For ibm-acpi, I added experimental=1 to enable experimental features (cmos, LED and beep).

After modprobing ibm_acpi, Fn-F5 turns Bluetooth on and off. But see the section Thinkpad buttons for more information about this.

Note: ibm-acpi will be included in Kernel 2.6.10.


Unmasked net-wireless/kdebluetooth net-wireless/bluez-hcidump net-wireless/bluez-libs net-wireless/bluez-utils and then installed them all: emerge kdebluetooth bluez-hcidump bluez-libs bluez-utils. I changed the default pin helper on /etc/bluetooth/hcid.conf to /usr/lib/kdebluetooth/kbluepin to get graphical pin dialog in KDE. Issued rc-update add bluetooth default.


In BIOS, IrDA is set to port 0x2F8, IRQ 3 and DMA3. I took note and left them as is.

IrDA works with ‘nsc-ircc’ modules. However ‘pcimodules’ suggests ‘8250-pci’, which could trick autodetection to load ‘8250-pci’ instead. If ‘8250-pci’ is loaded it wouldn’t be possible to load ‘nsc-ircc’. In my case ‘nsc-ircc’ needs to be loaded with parameter dongle_id=9 io=2f8 irq=3 dma=3.

Emerged ‘irda-utils’, ‘setserial’ and ‘kbeam’. Added setserial /dev/ttyS1 uart none irq 0 in /etc/conf.d/irda. Did an rc-update add irda default. Changed IRDADEV in /etc/conf.d/irda to ‘irda0′.

Then I bumped into another problem, there is no /dev/ttyS1 to ‘setserial’ (when using udev, device nodes are not created before module is loaded, and without devfs, there is no module autoloading). By booting into Knoppix I found out it can be fixed by loading ‘8250’.

IrDA can’t survive a sleep cycle! :( To fix this, I modified /etc/init.d/irda so that it contains every commands required to restart irda, including loading and unloading modules. Then I put RestartServices irda in /etc/hibernate/hibernate.conf.

Sending and receiving using KBeam works great without any problem. KBeam will offer to lower IrDA speed to 115200 for compatibility on every startup, but I’ve found my P900 can communicate well without problem. But since I couldn’t make it stop complaining about it, I added echo 115200 > /proc/sys/net/irda/max_baud_rate in /etc/conf.d/local.start.

There are several IrDA tips at Thinkwiki.


Added snd-intel8x0m in /etc/modules.autoload.d/kernel-2.6. Emerged slmodem. Edited /etc/conf.d/slmodem, changed COUNTRY to my country (INDONESIA). For full list of country, run slmodemd --countrylist. Did rc-update add slmodem default.

It appears that I can’t make it work in Alsa mode. But I’ve made some success using ‘slamr’ module. So, instead of using ‘snd-intel8x0m’, now I’m using ‘slamr’. Minicom is now able to use /dev/modem and send AT commands to it successfully.

Parallel Port

Just an old fashioned parallel port. I wonder what’s the hideous looking port doing in a modern notebook like this. Using module ‘parport-pc’ with options io=0x3bc irq=7 dma=1 (information is in BIOS) should put the driver out of polling mode which could lessen battery life. Beside ‘parport-pc’, it is also necessary to load ‘lp’ to make /dev/lp0 appear.


Works fine with ‘ide-cd’ module. However, under kernel 2.6.9, CD burning needs to be performed under root.


Works with ‘snd-intel8x0′ module. I just put the appropriate configuration in /etc/modules.d/alsa and rc-update add alsasound default. The only problem is it doesn’t support playing multiple audio stream. To fix that I use Alsa’s dmix plugin. I created .asoundrc in my home directory with the following content:

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
   rate 44100

    bindings {
        0 0
        1 1

pcm.asymed {
        type asym
        playback.pcm "dmixer"
        capture.pcm "hw:0,0"

pcm.dsp0 {
    type plug
    slave.pcm "asymed"

pcm.!default {
        type plug
        slave.pcm "asymed"

pcm.default {
   type plug
   slave.pcm "asymed"

ctl.mixer0 {
    type hw
    card 0

(taken from Dmix HOWTO at Gentoo Wiki)

Gigabit Ethernet

Works with ‘e1000′ module. This ethernet port will automatically detects the kind of cable I’m using, so I can use any ethernet cable, straight or crossover.

Wireless Ethernet

I’m using the Madwifi driver. (emerge madwifi-driver madwifi-tools wpa_supplicant wavemon after unmasking them in /etc/portage/package.keywords). The required kernel modules are: ath_pci ath_hal ath_rate_onoe wlan wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_xauth.

I haven’t played much with this so I can’t confirm if they are really working.

Suspend to RAM (sleep)

According to this page, I had to do several things in order to make S3 suspend works.

  • Added acpisleep=s3bios in grub.conf
  • Don’t use fancy vga= setting in boot parameter (I removed graphical console from the kernel entirely)
  • Remove ehcihcd module. However in my case using ehcihcd module while suspending works fine. It’s still working fine even if I suspended it while ehcihcd is being used by a USB 2.0 device (my HDD enclosure). So, I’m leaving ehcihcd loaded as it seems it doesn’t cause any problem.
  • Remove fglrx and intel_agp modules (didn’t use either of them)

Suspending to RAM works by doing an echo 3 > /proc/acpi/sleep.

Problem I found when using S3 suspend: artsd sometimes but not always pops up a dialog box after resuming: Sound server fatal error: AudioSubSystem::handleIO: write failed. len = -1, can_write = 1024, errno = 32 (Broken pipe). This might be a sound hardware/driver specific problem (see aRTs FAQ). To supress this message, I replaced /usr/kde/3.3/bin/artsmessage with a simple script:

exec logger $*

This way, all arts message will end up in syslog instead.

Now I’m using hibernate-script used by suspend to disk below. Config file is /etc/hibernate/sleep.conf. To sleep I use hibernate-sleep. All provided by hibernate-script ebuild, I only needed to modify some settings in /etc/hibernate/sleep.conf.

Suspend to Disk (hibernate)

I patched the kernel using the swsusp2 patches. After patched, make menuconfig will have additional choices under Power Management menu. I enabled all of them and recompiled. Apparently swsusp2 patches breaks several drivers (I tend to build as much drivers as I could as modules, just in case I’d need them). None of them are important though. I need to disable the offending drivers to continue with compilation. Need to recompile Madwifi driver (emerge madwifi-driver) after recompiling the kernel.

Emerged the userspace hibernate script (emerge hibernate-script) after unmasking it in /etc/portage/package.keywords. Added kernel parameter resume2=swap:/dev/hda2. Modified /etc/hibernate/hibernate.conf so that it would use swsusp2.

Hibernate works by issuing the command ‘hibernate’. It appears to be working so far, not as fast as Windows does, though.

Laptop Mode

Newer versions of Linux kernel supports laptop mode. It has been merged into mainline kernels, so no kernel patching required. All I have to do is to install its userspace tools. However it appears that it is not in portage yet. Being a lazy person myself, I searched for an ebuild. I found one here. I downloaded the 1.03 version, renamed it into 1.04 (the newest version as the time of this writing), emerged it and rc-update add it.

To detect state changes (on AC or battery) between sleep cycle, I put RestartServices laptop-mode in /etc/hibernate/hibernate.conf.

Thinkpad Specific Buttons

This requires access to /dev/nvram. By default it is unreadable to normal users. To make it readable I created file /etc/udev/permissions.d/10-priyadi.permissions which contains nvram:root:root:0666. It also needs ibm-acpi module loaded in (see ACPI section above).

TPB is a daemon that will monitor Thinkpad specific keys. I don’t use it because KDE duplicates its function. It can be configured from within KDE Control Center -> System Administration -> IBM Thinkpad Laptop. KDE will monitor the following key combination:

  • Fn-Space (zoom)
  • Fn-PgUp (Thinklight)
  • Fn-Home (brightness up)
  • Fn-End (brightness down)
  • volume up
  • volume down
  • mute
  • Access IBM

It will display messages such as ‘Thinklight is On’ when Thinkpad specific keys are pressed, very nifty! Much better than TPB’s OSD or even Windows. The volume up, volume down, mute, Fn-Home (brightness up), Fn-End (brightness down) and Fn-PgUp (Thinklight) buttons do what they are supposed to do (complete with popup messages!). The rest (Fn-Space, and Access IBM key) can be configured in the Control Center to execute a specific command line. It also listed other keys my Thinkpad T41p doesn’t have: Home, Search and Mail button.

ibm-acpi module (see the ACPI section above) supports the following other keys:

  • Fn-F3 (blanks/unblanks LCD)
  • Fn-F4 (sleep)
  • Fn-F5 (toggle wireless)
  • Fn-F7 (switch display)
  • Fn-F8 (not labelled)
  • Fn-F9 (not labelled)
  • Fn-F12 (hibernate)

To enable all of them, I put the following command in /etc/conf.d/local.start (reference)

echo enable > /proc/acpi/ibm/hotkey
echo 0xffff > /proc/acpi/ibm/hotkey

After issuing the command, pressing one of those keys will trigger an ACPI event and Fn-F5 will no longer toggle Bluetooth. To make the keys work, I created two files /etc/acpi/ibmkey.sh and /etc/acpi/events/ibmkey. I also found out that sleep (Fn-F4) and hibernate (Fn-F12) buttons don’t generate ACPI events when pressed repeatedly, maybe this is a safeguard to prevent users from sleeping/hibernating the system right after waking up.

I managed to get these keys work, complete with beep feedbacks :)

  • Fn-F3: blanks and unblanks LCD (using radeontool)
  • Fn-F4: sleep (using /usr/sbin/hibernate-sleep)
  • Fn-F5: disable both Bluetooth and 802.11abg
  • Fn-F7: don’t use this (I don’t have external display)
  • Fn-F8: I’m planning to use this to toggle 802.11abg on and off (its location is conveniently near 802.11abg’s LED)
  • Fn-F9: toggles Bluetooth on and off (its location is conveniently near Bluetooth’s LED)
  • Fn-F12: hibernate (using /usr/sbin/hibernate)

There are also another two IBM specific keys near cursor keys. In Windows they are used to navigate back and forward in web browser. However I’ve found the default action to be annoying as they are too easily get pressed accidentally. In Linux, I’ve found a great use for them, which is for switching desktop back and forward. To accomplish that, I created ~/.Xmodmap file containing;

keycode 234 = XF86Back
keycode 233 = XF86Forward

The next step is to make that file read by xmodmap. Sometimes it is not even necessary since X’s initialization script will take care of that. However, my desktop environment (KDE) doesn’t do that. I had to create a simple script ~/.kde/Autostart/xmodmap.sh containing:

exec xmodmap ~/.Xmodmap

Finally, it’s a simple task to assign them in KDE Control Center -> Regional & Accessibility -> Keyboard Shortcuts.

In addition, it is very important for me to disable Ctrl-Alt-Backspace in X. Ctrl-Backspace is a fairly common key combination in word processing. But in Thinkpad keyboard, Alt is adjacent to Ctrl, and thus it is very easy for both keys to get pressed simultaneously by accident when I meant to press Ctrl. I lost some writings because of this. To disable Ctrl-Alt-Backspace, I edited /etc/X11/xorg.conf in section “Serverflags” like this:

Section "Serverflags"
Option "DontZap"      "yes"

Hardware Not Working

  • Accelerometer. Under Windows this will park the hard drive head when it detects movement.

Praises and Rants

  • Yes! No Windows keys! My previous notebook has a very short space bar that only a bit longer than its shift key.
  • The Esc key is too far away, a hideous way to annoy every vi user. I repeatedly hit F1 whenever I try to hit Esc. I’m tempted to remap F1 or backtick key as Esc :)
  • The Back and Forward button near the cursor keys is annoying. It is too easy to press them by accident. Thank god they don’t work in Linux :), and I don’t plan on enabling them. Finally found an excellent use for these previously unused keys: for switching desktop back and forward, see the section Thinkpad specific keys for more details on this.


tpctl is another Thinkpad related program, but I was unable to successfully compile it.

There is a Linux driver for TCPA chip used in this notebook, but I have no use for it.

Even if this model is relatively cool, calling this thing a ‘laptop’ is misleading, as it is not meant to be used on your lap :). The references about ‘laptop mode’ is unfortunate but necessary.

Output of Several Utilities

Configuration Files


  • gentoo-dev-sources-2.6.9-r10
  • glibc- (+nptl +nptlonly +nls)
  • gcc-3.4.3-r1
  • xorg-x11-6.8.0-r3
  • kde-3.3.1

Useful Links

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones

20 Responses

Trackback: Use this URI to trackback this entry. Use your web browser's function to copy it to your blog posting.

Comment RSS: You can track conversation in this page by using this page's Comments RSS (XML)

Gravatar: You can have a picture next to each of your comments by getting a Gravatar.

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Warning: Comments carrying links to questionable sites will be removed!