Linux, Debian Woody, and the IBM Thinkpad X20

This is a work in progress.

Recently, I received shipment on an IBM Thinkpad X20 I purchased on eBay. These are my experiences in getting the thing set up.

[Cat and Laptop]

Contents

[keyboard photo]

System Specs

The IBM Thinkpad X20 is a nice little laptop. The specific model I'm using is a 2662-32U. The 12" screen is a tad small but definitely usable, and works in 24-bit color at 1024x768 resolution. It runs Linux well.

The basic laptop is very lightweight, and has a minimum of stuff built in. It's got a phone jack for the integrated 56K LinModem, some models (not mine) have an RJ-45 jack for the integrated ethernet card, it's got one Type-II PCMCIA card (in contrast to many laptops, which have two), but it's also got a built in Compact Flash reader. (I didn't realize this latter feature until I had the laptop on hand; given that I use a Compact Flash digital camera, this is a nice bonus.) Note that the basic laptop itself has no serial or parallel port built in. Moreover, it has no floppy drive, which could make installing Linux challenging. However, you can get a "media slice" for it (the laptop I bought came with one), that's got a floppy drive in addition to serial, parallel, and PS2 mouse ports.

The specs of my system:

  • 600MHz PIII (~1200 BogoMIPS)
  • 320MB RAM (128MB standard)
  • 20GB hard drive
  • Intel 440BX IDE chipset, PIIX4 bus
  • UHCI USB controller
  • ATI Rage Mobility P/M AGP 2x video controller (w/ 4096MB video RAM)
  • 1024x768 24-bit TFT display
  • Cirrus Logical Crystal CS4281 audio controller
  • Small, weak, typical laptop built-in speaker
  • i82365 PCMCIA controller
  • Built-in Compact Flash reader
  • 56K Lucent/Agere 0x0449 LinModem
  • Ports and Connectors:
    • One PCMCIA Type-II
    • One Compact Flash
    • Two USB
    • Headphone, microphone, audio out(?)
    • VGA connector
    • Power connector for external power supply (included)

In addition, the Media Slice has

  • Floppy drive
  • 9-pin serial port
  • 25-pin parallel port
  • PS2 mouse port
  • Power connector (use this instead of the laptop's when laptop is docked
  • Two speakers (substantially better than the laptop's, but still small and not very impressive)
  • Port (currently empty) for optional CD or DVD drive

Installing Woody

Without the Media Slice, this might have been challenging. I do have a USB floppy and CD that came with the system, but I haven't tried booting with either. It should be possible to boot and install Debian with a USB floppy, using a slightly hacked set of install disks. Fortunately for me, I had the Media Slice, whose built-in floppy elimiated all of those worries.

I've installed twice (once after I got some hard drive errors and wanted to reformat with bad-block scanning). The first time, I used the four Woody bf2.4 install disks; the second time, I used the "mini-CD". I partitioned my disk into four partitions: a 1GB / partition (overkill, I know), a 1GB swap partition, a 4GB /usr partition, and a 14GB /home partition. (The laptop came with some sort - I'm not even sure which - of Windows installed, but I never even booted it. The first thing I did was stick in Debian boot floppies and repartition the hard drive.)

The beginnings of the install done, I did the bulk of my install over the network. I had a 3COM 3CCFE574BT PCMCIA network card, support for which was installed in the bf2.4 Debian boot kernel even without explicitly having to add the driver (although I did, as usual, have to explicitly enable PCMCIA). The rest of the installation went without a hitch.


Performance

System and Hard Drive Performance

It's a PIII-600, it works like a PIII-600. You can configure the bios to step down the speed of the CPU when on battery (so as to preserve battery life). The CPU stats that show up in /proc/cpuinfo (including the speed and BogoMips of the CPU) depend on whether you are using AC or battery power when you boot up the machine. If you're on AC, you get a 600MHz PIII. If you're on battery power, and you have configured your BIOS approriately, you get a 375MHz PIII. I'm not sure what implications this rating in the kernel have for performance if you switch back and forth between battery and AC power later. I haven't noticed any problems, but neither have I tried doing any tests or benchmarks to figure out how fast my CPU really is at various times. It seems to get done what I need to get done....

The IDE hard drive did not have DMA enbled by default with the bf2.4 kernel. You can enable it with the command:

hdparm -d1 /dev/hda

I put this command into a startup script (/etc/init.d/hdparm.sh) and then linked /etc/rcS.d/S01hdparm.sh to that script so that DMA would be enabled at boot. Once DMA is enabled, the hard drive performance numbers (with hdparm -t -T) are:

Timing buffer-cache reads:   128 MB in  1.03 seconds =124.27 MB/sec
Timing buffered disk reads:  64 MB in  4.20 seconds = 15.24 MB/sec
Video/XFree86

I wasn't paying much attention when running the XFree86 config that happens during the Debian Install. I selected simply ati as the video driver, but then for the monitor specs just blithely accepted the defaults. For resolution, I selected that I wanted 1024x768. In the past on other systems, I've had to futz around with XFree86 to get it to work, so I was surprised after reboot when gdm came up and I was happily running X in 24-bit at 1024x768.

I've also plugged an external monitor into this laptop (really a big VGA projector used in the lecture hall where I was teaching my class), and it worked without a hitch. (Well, except that sometimes the projector made everything look too green, but that's a projector problem, not a problem with the laptop.)

The drivers and XFree86 that come with Woody don't support XVideo or DRI (3d hardward acceleration) on the ATI Rage Mobility chipset in this laptop. As such, it's worth installing the X server packages from http://people.debian.org/~daenzer/dri-mach64/. The packages I installed were:

  • drm-mach64-module-src_2002.12.29-1_all.deb
  • xlibmesa-dev-dri-mach64_2002.12.29-1_i386.deb
  • xlibmesa3-dri-mach64_2002.12.29-1_i386.deb
  • xserver-xfree86-dri-mach64_2002.12.29-1_i386.deb

Even without compiling a kernel, this gave me XVideo support. When I built a new kernel, I then also had hardware accelerated 3d support.

The Rage Mobility chip does support 3d DRI. However, the 4M video RAM makes it very difficult to actually get DRI to use it. This is not enough memory to do 3d acceleration on a 1024x768 screen even in 16-bit mode. To get DRI active, I had to boot to an 800x600 16-bit screen mode, at which point I could get ~200-250 fps with glxgears. I set up my XF86Config-4 file so that if I run "startx" I get a 24-bit 1024x768 screen (what I usually use), and if I run "startx -- -screen 800x600" I get a 16-bit 800x600 screen which supports hardware 3d acceleration.

APM and Battery

I haven't really put APM through the paces, and may never. I didn't do anything special to install it, but it seems to work. When I close the laptop lid, after a few seconds the laptop goes into susped mode. When I open it again, after a few seconds it comes back.

The laptop battery seems to last approximately 1.5-2 hours. It's an oldish battery, so I might do better with a newer one.

I do have trouble with sound and APM. When the laptop comes back out of suspend mode, sound no longer works; any program that tries to play sound will hang. I can get sound running again by restarting ALSA:

/etc/init.d/alsa restart

However, I have to make sure that everything using the soundcard is killed before doing this (including a little mixer DockApp that I use with FVWM).

Sound

The cs4281 sound card is supported by drivers in the standard kernel. However, I actually use ALSA for my sound drivers. Follow the instructions on my Debian ALSA page to get that working. The name of the card is cs4281.

x

Initially, only root is able to actually play sounds. To play sounds as a normal user, I had to run:

chmod a+rw /dev/dsp
chmod a+rw /dev/mixer

Doubtless there's a better way to do this, but it worked.

PCMCIA and Compact Flash

The PCMCIA controller is an i82365 type, and works without trouble. I've used it with both the i82365 and yenta_socket kernel modules, the latter being the one I've settled on most recently. There is only one PCMCIA slot, although cardctl reports two (the existing slot being Socket 0 in cardctl).

The built in Compact Flash reader is right next to the PCMCIA slot. When you insert a slot into it, the system reacts as if a Compact Flash PCMCIA card had been inserted into Socket 1. (I.e., you really have two PCMCIA ports, but one is permanently filled with a Compact Flash reader.) You can then mount and use Compact Flash cards like normal PCMCIA-IDE devices. On my system, I added the following line to my /etc/fstab file:

/dev/hde1    /flash    msdos   user,noauto  0  0

After that, any user can insert a Flash card into the slot and issue the command "mount /flash". Under /flash will be the filesystem of the card. Note: You may need fat=12 option in addtion to "user,noauto" for your card; that will depend on how your Compact Flash card was formatted. I found I needed this to access all of a 16MB Flash card I have. You can figure this out by running fdisk on /dev/hde after inserting the Compact Flash card but before mounting any filesystems.

The physical design of the Compact Flash slot is not perfect; I had to wiggle the card around a bit to get it all the way inserted. To eject it, I found I couldn't put enough pressure on the eject button with just my finger. (Or, rather, I could, but it started to hurt, so I didn't bother, and used the blunt end of a pen instead.) Perhaps a thimble should be a standard accessory with this laptop.

USB

This works. The usb-uhci module is the one used as a controller; with the bf2.4 Debian boot disks, that module will be loaded automatically at each boot after you've completed the installation. There are two USB ports, one on the right side of the laptop, the other on the back. I've tried two devices (at the same time), a floppy drive and a CD-ROM drive, both of which are controlled by the usb-storage module. With this module, they both show up as SCSI devices (the USB CD-ROM as a faux SCSI CD at /dev/scd0, and the USB floppy as a faux SCSI hard drive at /dev/sda). To get them to work, I had to explicitly modprobe that module (the kernel doesn't seem to know enough to auto-load USB modules; I should look into this further). Since this machien has plenty of memory, I may just add usb-storage to the list of modules in /etc/modules so that things will Just Work.

A few additions to the system make things much more convenient:

  • A symbolic link from dev/cdrom to /dev/scd0:
    ln -s /dev/scd0 /dev/cdrom
  • Two lines in /etc/fstab:
    none       /proc/bus/usb   usbdevfs defaults       0  0
    /dev/sda   /usbfloppy      auto     noauto,user    0  0
    
  • A mount point for the floppy: mkdir /usbfloppy.

When this is done, you will find some files under /proc/bus/usb which you can browse to see what devices you have connected. (This will be avialable after your next reboot or after you explicitly mount that "filesystem".) Any user can mount floppies with the command "mount /usbfloppy", and CDs with the command "mount /cdrom". (Assuming that the proper device is plugged into a USB port.)

LinModem

The built in LinModem works with the drivers on http://www.heby.de/ltmodem. To install it, I:

  • Installed the kernel-package package from Woody.
  • Installed the kernel-headers-2.4.18-bf2.4 package from Woody.
  • ln -s /usr/src/kernel-headers-2.4.18-bf2.4 /lib/modules/2.4.18-bf2.4/build
  • Unpackaged the ltmodem archive.
  • Ran "./build-deb" in the top level ltmodem directory
  • Installed the resultant deb with dpkg --install

I have succesfully used this modem with both minicom and ppp. I should note that I'm rather grouchy at having to install a binary-only kernel module (and a half-megabyte one, too- what's up with that?) to get this hardware working. I'm of the opinion that one is much better off if one can get open source drivers for everything on one's Linux system. Alas, that is not currently possible with the LinModems that come built-in with laptops, so you must either sacrfice your idealism and use this half-open-source driver, or you must resort to using a PCMCIA modem.

(Integrated Ethernet Card)

Some models- not mine- of the X20 come with an integrated ethernet card, and an RJ45 port on the back of the laptop. This doesn't matter for my system. However, I've used X20's in the past where the standard eepro100 drivers were all that was necessary to use the internal ethernet card.


Notes and Thoughts

One thing that distrubs me is in /proc/interrupts:

  0:    1658644          XT-PIC  timer
  1:      66285          XT-PIC  keyboard
  2:          0          XT-PIC  cascade
  3:     164626          XT-PIC  orinoco_cs
  8:      98388          XT-PIC  rtc
 11:     467847          XT-PIC  usb-uhci, ltserial, Crystal CS4281, i82365
 12:     177437          XT-PIC  PS/2 Mouse
 14:     643637          XT-PIC  ide0

Notice how many things are sharing IRQ 11. It all seems to work, but is this really necessary? I suspect there's something in the BIOS that's stacking everyting up there, and that I could probably distribute it around a bit better. There do seem to be a number of unused IRQ's. I probably ought to make sure that some stay reserved for use by the parallel and serial ports when I've got the laptop docked, but even still I don't think it's really necessary to have four devices all sharing IRQ 11.


lspci -vv

If anybody is interested, you can look at the results of running lspci -vv on this system.


Last modified: 2004-January-11, by Rob Knop