Getting Mandrake 10 (Official) to work on a ThinkPad X31

Neville Sanjana (nevillesanjana AT yahooo DOT com)
Modified: 10.10.2004

There are a few parts to this document. Each corresponds to one standard X31 feature that doesn't work right off-the-bat in Mandrake 10 Official. Thankfully, most features work fine. Here are the ones that don't and how to get them working:
1. Power management with suspend on lid close (APM)
2. Wireless networking with the Cisco 350 mini pci card (airo driver)
3. Hibernate to disk with swsuspend (too many problems now, perhaps in the future...)

APM & Suspend
First, let me cite some very helpful websites that include using newer (2.6.x) kernels with Debian:
Debian GNU/Linux on the Thinkpad X31
IBM X31 laptop under Debian Intel 3.0, kernel 2.6

My old roommate Eric Chan also has a good page about the X31 in general here:
Eric's X31 user experience page

Recently, IBM replaced the X31 with the X40. Both are based on the Pentium M, but the X40 is significantly different (using the Intel integrated graphics chipset instead of the Radeon mobility). So, if you've got a similar model (X40, T40, etc.), this stuff might apply. or it might not. :)

Basically, I had an unusually difficult time getting my fav distro (Linux Mandrake, which I've used since Mandrake 6) to work on my X31. Specifically, on a laptop, any OS is really only usable if you've got power management and on an ultraportable like the X31, it's even more important.

Mandrake 10 (Official) comes with kernel 2.6.3-7 and has (with some work) ACPI installed as a default. After poking around on the web a little, it became clear that ACPI is not exactly ready for primetime (more like an alpha release it seemed to me). For example, most people report that suspend-to-memory (ie. suspend/standby) is not working. This is an important feature.

Recompiling 2.6.3-7 with APM support enabled in the kernel and ACPI turned off makes suspend work only 50% of the time. Other times it crashes the machine.



The key is to upgrade to 2.6.6. Here's what to do:
1. Go to kernel.org and download the full 2.6.6 (or newer) source

2. Use the following kernel config file (vanilla Mandrake 10 official with APM and optimized for Pentium M). Name it ".config" in the new source directory.

3. The 2.6.6 kernel compiles a bit differently than 2.4 kernels. Type
    make && make modules_install
to compile. (Note, no make dep or make bzImage as in previous kernel versions.)

Next, copy appropriate kernel files:
    cp .config /boot/config-2.6.6
    cp System.map /boot/System.map-2.6.6
    cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.6

4. Add to your kernel boot options instructions not to multiplex the PS/2 port. Otherwise, the X31 will lose mouse control when resuming from sleep. In /etc/lilo.conf look for the section for the Linux kernel and to the APPEND line the following kernel options:
     append="devfs=mount splash=silent acpi=off apm=on i8042.nomux"

5. The kernel also uses a RAM disk to mount the initial root file-system. This needs to be updated as follows:
    mkinitrd /boot/initrd-2.6.6.img 2.6.6

6. Get your Pentium M to speed step intelligently using powernowd:
Download PowerNowd
    Compile and install powernowd as usual (make and make install as root). Then add the following line at the end of /etc/rc.d/rc.local to make powernowd activate at startup. The parameters make it use a sawtooth stepping function to ramp down speed. It will jump to full speed anytime load exceeds 80% and will poll the processor for info every 200msec.
    /usr/sbin/powernowd -m 1 -p 200 -s 200000

7. Enable the KLaptop graphical power meter. Not sure why this isn't on by default when Mandrake installs but it isn't! In KDE, click the Star menu (like the Windows Start menu... get it? :) and select Configure Your Desktop. It is not necessary to be root to do this. In the left hand column, click on PowerControl and then, in the menu that appears beneath it, click on Laptop Battery. Then check the box near Show battery monitor, click on the button Start Battery Monitor, and click Apply at the bottom.

8. Pat yourself on the back for a job well done. There's nothing like wasting time with linux installs! Now go outside and enjoy the day. Without your laptop!


Now APM suspend to memory should work just fine. For those interested, in the older kernel version, some strange interaction between USB, XFree86, and the Radeon driver seemed to screwing up suspend.



Cisco Wireless
Let's now get some working wireless. Mandrake comes with a whole bunch of decent wireless utilities. But, right now, our problem lies with the device driver for the Cisco card. By default, Mandrake choses the right driver (airo) for the card. But, if you take a look at your /var/log/syslog, you'll probably see something like this:
    May 28 04:19:28 scn kernel: airo: Found an MPI350 card
    May 28 04:19:28 scn kernel: airo: Firmware version 5.02.19 is not supported.
            Use it
at your own risk!   
    May 28 04:19:28 scn kernel: airo: MAC enabled eth1 0:2:8a:a6:25:40
    May 28 04:19:28 scn kernel: airo:  Finished probing for PCI adapters

At least, it's clear what the problem is. The firmware is not supported. If you look through some newsgroups, you'll see that the standard solution to this problem has been to downgrade the firmware to 5.00.xx firmware. (The newest right now, at least for the Windows side, is something like 5.30.xx.) Of course, it would be preferable not to downgrade. Also, if you dual boot with XP like me, you'll find Windows/Cisco ACU will annoyingly try to auto-upgrade the firmware, botching up things on the linux side.

Recently (5/20/2004), Cisco has released some new linux drivers but they are unfortunately for the 2.4 kernel. Fabrice Bellet, an airo driver developer and T40 owner, has released a patch of the airo driver that's in the 2.6.6 kernel (and in Mandrake 10's stock 2.6.3-7 kernel, too). This patch integrates many (if not all) of the features in the new Cisco driver without requiring a kernel downgrade.

Here's what to do:
1. Download the patch for airo.c to the /usr/src/linux/drivers/net/wireless directory. (You might want to check near the end of the
wireless section of Fabrice's page to see if an even newer patch is available.)

2. Make a backup of airo.c, in the directory mentioned above. Name it something like airo.c.ORIGINAL.

3. In the same directory, run the patch command:
    patch -p0 < airo.c-2.6.6-20040521.diff

4. Now, delete the old compiled versions of the airo files:
    rm -f airo*o

5. Recompile the airo files and install the new modules:
    cd /usr/src/linux
    make && make modules_install
There is no need to copy any kernel related files (bzImage, System.map, etc.) as we've only updated the modules.

6. Edit the suspend configuration file so that wireless is brought back up properly after a supend by adding netplugd to the list of services to be restarted. I did this based on a recommendation by the author of ifplugd. In the file /etc/sysconfig/suspend, here's what I have in the RESTART_SERVICES variable:
    RESTART_SERVICES="xntpd xinetd nfs gpm pcmcia irda alsa ifplugd"

There seems to be some confusion in Mandrake 10 between ifplugd and netplugd. According to some web pages, these programs seem to do the same thing (and netplugd's development has been discontinued due to that). All I can say from my experience is that if netplugd is in RESTART_SERVICES, wireless appears to reconnect happily after suspend.

7. Restart the computer to ensure loading of new modules with proper enet interface configuration. You can check the configuration of wireless (eth1) by typing as root
    ifconfig
and checking to see if eth1 has an IP address assigned to it.

8. Enjoy wireless!

Next, I'll tackle hibernate to disk...