Linux on the IBM Thinkpad X22

pic of X22 Here is how I got Linux (RedHat 7.2) running on an IBM Thinkpad X22. Or, rather, two Thinkpads. The first A is a 2662-92G: 12.1" screen, 20GB ATA-100 disk, 128MB memory, 800MHz mobile PIII. The second B is a 2662-9DG, which is the same apart from having built-in Ethernet (Intel PRO/100) and Wireless (PRISM MiniPCI Combo).

I gleaned much useful information from the Linux on Laptops page, in particular the other Thinkpad X22 pages.

The following describes what I did: I was successful, but I guarantee nothing, and accept no liability for lost data, damaged hardware or any other untoward happening in your life.

Backup

You did backup anything you want to keep, didn't you? This is particularly important since you might want to do a destructive update.

Make a RH boot floppy?

You can set the BIOS to boot directly from the CD so you don't need to do this. I booted over the 'net, using the pcmcia floppy and a D-Link DFE-650TXD PC Card for A and directly from CD for B (no deep reason: I just had a CD drive handy when I came to B). Using the 'net is the most convenient way if you don't have the CD drive (or a CD). Though you do really need a floppy drive to get going later.

Squeezing Windows

The Thinkpad comes with two partitions: a big one with W2K on it, and a small one that contains a rescue and repair image. If you hit F11 at the right point during a boot, this image will be used to restore Windows 2000.

I couldn't find a free tool to resize the partition (FIPS, etc., complained about the strangeness of the way IBM lays things out on disk) so I took the destructive route. I am led to believe commercial partition managers will shrink the W2K partition correctly.

You now have a W2K installation on the 4G partition, and about 14G or so space for Linux. Alternatives to a DOS floppy are to use FDISK from tomsrtbt, or to run the RH install up to the partitioning phase, but no further (i.e., turn the machine off after it has done the partitioning).

Update
Here are instructions on making a recovery CD. Booting directly from this CD will start the recovery.

Do the Install

Reboot using a RH floppy, or direct from the CD or 'net. Use Disk Druid to create your partitions from the free chunk hda3 (ignore the ignorable message about inconsistency). I set LILO/GRUB. Put on boot partition, not the MBR. We shall be using the IBM/W2K boot manager so the rescue mechanism will continue to work. And let RH do its thing. For minimal hassle I selected the laptop install with all packages.

A few choices on the way:

When done, this will reboot to W2K. Get bootpart and unpack the zip file in the C:\WINNT folder (use a console window and C:\ibmtools\updater\pkunzip). Add Linux to the boot menu by
bootpart 2 BOOTLINX.BIN Linux
Here, the "2" is the number of the Linux /boot partition, which you can confirm by bootpart list. The "Linux" is some suitably descriptive name.

Then

System -> Advanced -> Setup and Recovery
Set default as Linux. You might want to reduce the wait time, too, while you are here.

Reboot. Up comes Linux! If you use F11 to reinstall W2K you will need to repeat this step.

Video

The X server (ATI Radeon Mobility, 8MB) is not set quite right. Edit /etc/X11/XF86Config-4 and add
VideoRam 8192
in to the Device section.

X now starts properly. You might want to change /etc/inittab to boot directly into X (set initdefault to 5) if you like that kind of thing.

Audio

You have a i810/AC97 chipset which mostly works. Use /sbin/sndconfig to check.

The sound driver doesn't like APM suspend/resume, and you must edit /etc/sysconfig/apmd to prevent hangs after a resume.

Set RESTORESOUND="yes" and SOUNDMODULES="i810_audio ac97_codec soundcore".

After a resume it doesn't restore the mixer volume setting, though this can be fixed by using aumix -L in /etc/sysconfig/apm-scripts/apmcontinue

In any case, running gmix will reset things.

This also means that if you compile a new kernel, you must configure the sound as a module, not built-in. The sound driver in the kernel that comes with RH7.2 is a bit buggy, and it is a good idea to upgrade the kernel anyway.

Note that the keyboard mute is not a toggle: press volume up or down to un-mute.

Advanced Power Management

Hit Fn-F4 get suspend (save to memory).

The hibernate (save to disk) Fn-F12 works after a bit of jiggling. Instructions on how to do this were stolen from here.

IBM supply a program uttpvhib to create a hibernation file. Download this file to C:\WINNT. Running it (under W2K) creates a bootable floppy disk. Boot from this disk, and follow the instructions (create the hibernation file on the C partition). This takes at least 10 minutes and makes a (hidden in Windows) file save2dsk.bin. Reboot to Linux, and hibernation now works. If you add more memory, you need to re-run to enlarge the hibernation save file.

On another identical machine adding memory then installing the hibernation file caused the machine to pause for 2 minutes early in the the boot sequence. Removing the hibernation file got rid of the pause. This remains an unresoved problem.

If you find that suspend/hibernate takes a long time (hanging maybe 3 minutes or so before activating) this could be due to a feature in the apmscript. Try this: in /etc/sysconfig/apm-scripts/apmscript replace the lsof by lsof -n to prevent it trying to do IP name lookups.

Modem

Not tried, uncertain if it will work.

A Has a Lucent modem, and might be supported.

B Has an AMR modem, probably not supported.

Ethernet

A To make the PCMCIA network card resume properly after a suspend, edit /etc/sysconfig/apmd and set NET_RESTART="no"

B The internal Ethernet (Intel Pro/100) is detected and works correctly.

Wireless

B This is a Prism2 chip on a miniPCI card, not a PCMCIA card, and is not currently supported by the standard PCMCIA wireless drivers (currently 3.1.34). However, a test driver is available from David Gibson. I am successfully using orinoco-0.13d. Get the tar file, unpack, make and install.

Update
Kernels 2.4.19 and later have a working orinoco_pci driver included as standard (CONFIG_PCI_HERMES).

Put

alias eth1 orinoco_pci
in /etc/modules.conf

This is configured in /etc/sysconfig/network-scripts just like any other network card. I have something like this in ifcg-eth1:

DEVICE=eth1
BOOTPROTO=static
BROADCAST=172.16.255.255
IPADDR=172.16.0.2
NETMASK=255.255.0.0
NETWORK=172.16.0.0
ONBOOT=yes
#
ESSID="Home Network"
MODE="Ad-Hoc"
RATE=11M
CHANNEL=1
KEY="xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xx restricted"
As an alternative, you might want to try a separate package from the Linux-Wlan Project. Get and install. The prism2_pci module is what we need. This package is not so convenient to use as the standard PCMCIA stuff, but it seems to work.

The drivers don't survive a suspend/restore, so you must use /etc/sysconfig/apmd to remove and restore prism2_pci.

Update
The very latest version of the orinoco_pci driver should support suspend/restore.

InfraRed Port

Not tried, but allegedly works.

USB

Put
alias block-major-2 usb-storage
in /etc/modules.conf. This enables the USB floppy drive, though it appears as /dev/sda (or possibly sdb, etc., if other USB devices are plugged in) rather than the more familiar /dev/fd0. Update /etc/mtools.conf to reflect this if you use mtools:
drive a: file="/dev/sda" exclusive mformat_only
drive a: file="/dev/sdb" exclusive mformat_only
This will find the floppy whether it is currently sda or sdb.

NB. This means you need to include both USB and SCSI emulation support if you make a new kernel.

USB CD. Works. As if by magic, a symbolic link for /dev/cdrom appears when you plug in the CD drive.

BIOS

Fn-F1 on boot.

The default BIOS settings try to save power by turning everything off when your back is turned. I prefer to keep things running:

Config -> Power.

Curiously, the machine supplies an APM resume whenever you open the lid. I'm not sure I always want this.

Unsolved Problems

Notes

It's a good idea to compile a new kernel: 2.4.18 fixes some problems in the sound driver, and you can enable CONFIG_APM_ALLOW_INTS which should make APM suspends a bit happier.

The picture at the top of the page was taken using a Canon S10, loaded using the compact flash slot (see the section on PCMCIA ATA/IDE card drives in the PCMCIA-HOWTO), and edited with the gimp.

Unusually, the X22 doesn't have the double height PCMCIA slot you see on most machines, but a single height PCMCIA slot and a single height compact flash slot. Presumably the argument is that with built-in Ether, Wireless and Modem you won't need a PCMCIA card so often. On the other hand it does mean you can't use the thicker PCMCIA and compact flash cards.

I wanted to keep the W2K and rescue partitions, while you could delete the rescue partition and boot directly from LILO or GRUB. But then you need to get a rescue CD from IBM if you trash W2K. Of course, better would be to dispense with Windows completely.

Adding Linux kernels: just run lilo as normal, don't touch the W2K boot manager. Probably GRUB works just as well as LILO, but I've not tried.

X works well in 24 bit mode: perhaps should try 32 bits.

The Euro (€) key is easily supported.

Russell Bradford, March/April 2002.

Update
s April 2003.