IBM ThinkPad X31

From ArchWiki
Revision as of 22:37, 16 July 2008 by Misfit138 (talk | contribs) (corrected captialization in title, left redirect from old article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The IBM Thinkpad X31 is a wonderful little laptop which contains everything you need for your everyday work, and even some gaming, if you tweak things a little. The X31 is rock solid, light (3.7 lbs), and nowadays very cheap (I bought mine 375$, and the price is still dropping). The only drawback is the lack of internal optical drive. This tutorial contains most of what I did to get everything working, that part was easy by the way, and the tips and tricks to really boost things up. You can see the specs of the X31 on ThinkWiki, a wonderful resource, from which I found most of what I needed for this tutorial.


A basic ArchLinux installation will do just fine for about everything, so I won't talk about sound or other basic stuff. No custom kernel needed. However, you will need the following particular packages:

  • acpi and acpid for various reasons
  • ipw2100-fw and wireless_tools for wireless
  • cpufrequtils for powersaving (see above)
  • xf86-video-ati for direct rendering (see above)
  • laptop-mode-tools for powersaving (see above)

You can install all this by running the following command:

# pacman -Sy acpi acpid wireless_tools ipw2100-fw cpufrequtils xf86-video-ati laptop-mode-tools

Now add acpid, cpufreq, and laptop-mode to your DAEMONS section of your rc.conf.

Add acpi-cpufreq and thinkpad_acpi to your MODULES section of your rc.conf.

Quick note: add an @ before all your DAEMONS in your rc.conf to speed up boot time.

Some useful packages are on AUR. If you're willing to install them, the best way is through yaourt. Get it here. Unpack it and run:

# makepkg
# pacman -U yaourt*.pkg.tar.gz

Once you have yaourt ready, install:

  • rovclock for boosting direct rendering (see above)
  • uswsusp for hibernation (see above)
  • acpi-cpufreq-phc for undervolting the CPU (see above) (Only for kernel >=

By using this command:

# yaourt -S rovclock uswsusp acpi-cpufreq-phc


Simply save this script as /usr/bin/hibernation:

modprobe -r ehci_hcd 
/usr/sbin/s2ram -rf
modprobe ehci_hcd

You now just have to run this command whenever you want to suspend to ram:

# hibernation

To hibernate and resume simply by closing the lid of your laptop, simply run this command:

# echo -e "event=button[ /]lid\naction=/usr/bin/hibernation" > /etc/acpi/events/suspend.conf

It simply tells ACPI to run the command "hibernation" on the "lid closed" event. I strongly suggest using this. After less than a day, you'll think of shutting down a computer as barbaric, and you'll be astonished each time you see a computer taking more than five seconds to boot.

Xorg and direct rendering

Use my /etc/xorg.conf:

Section "ServerLayout"
	Identifier     "Xorg Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Keyboard0" "CoreKeyboard"
	InputDevice    "PS/2 Mouse" "CorePointer"
	Option         "AIGLX" "true"
# Serial Mouse not detected
# USB Mouse not detected

Section "ServerFlags"
	Option "AllowMouseOpenFail"  "true"
        Option "PM" "off"
        Option "DPMS" "off"
        Option "Xinerama" "0"	

Section "Files"
	RgbPath      "/usr/share/X11/rgb"
	ModulePath   "/usr/lib/xorg/modules"
	FontPath     "/usr/share/fonts/misc:unscaled"
	FontPath     "/usr/share/fonts/misc"
	FontPath     "/usr/share/fonts/75dpi:unscaled"
	FontPath     "/usr/share/fonts/75dpi"
	FontPath     "/usr/share/fonts/100dpi:unscaled"
	FontPath     "/usr/share/fonts/100dpi"
	FontPath     "/usr/share/fonts/PEX"
# Additional fonts: Locale, Gimp, TTF...
	FontPath     "/usr/share/fonts/cyrillic"
#	FontPath     "/usr/share/lib/X11/fonts/latin2/75dpi"
#	FontPath     "/usr/share/lib/X11/fonts/latin2/100dpi"
# True type and type1 fonts are also handled via xftlib, see /etc/X11/XftConfig!
	FontPath     "/usr/share/fonts/Type1"
	FontPath     "/usr/share/fonts/ttf/western"
	FontPath     "/usr/share/fonts/ttf/decoratives"
	FontPath     "/usr/share/fonts/truetype"
	FontPath     "/usr/share/fonts/truetype/openoffice"
	FontPath     "/usr/share/fonts/truetype/ttf-bitstream-vera"
	FontPath     "/usr/share/fonts/latex-ttf-fonts"
	FontPath     "/usr/share/fonts/defoma/CID"
	FontPath     "/usr/share/fonts/defoma/TrueType"
	FontPath	"/usr/share/fonts/artwiz-fonts"

Section "Module"
        Load  "ddc"  # ddc probing of monitor
	Load  "dbe"
        Load  "record"
        Load  "extmod"
        Load  "dbe"
        Load  "dri"
        Load  "glx"
        Load  "xtrap"
        Load  "freetype"
        Load  "type1"
        Load  "speedo"
        Load  "radeon"
        Load   "drm"

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "keyboard"
        Option      "CoreKeyboard"
	Option "XkbRules" "xorg"
	Option "XkbModel" "pc105"
	Option "XkbLayout" "us"
	Option "XkbVariant" 
	Option "XkbOptions" "ctrl:nocaps"

Section "InputDevice"
	Identifier  "Serial Mouse"
	Driver      "mouse"
	Option      "Protocol" "Microsoft"
	Option      "Device" "/dev/ttyS0"
	Option      "Emulate3Buttons" "true"
	Option      "Emulate3Timeout" "70"
	Option	    "SendCoreEvents"  "true"

Section "InputDevice"
	Identifier  "PS/2 Mouse"
	Driver      "mouse"
	Option      "Protocol" "auto"
	Option          "ZAxisMapping"          "4 5"
	Option      "Device" "/dev/psaux"
	Option      "Emulate3Buttons" "true"
	Option      "Emulate3Timeout" "70"
	Option	    "SendCoreEvents"  "true"

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
	Option		"SendCoreEvents"	"true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"

# Auto-generated by Archie mkxcfg

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "IBM"
        ModelName    "X31 TFT Screen"
        HorizSync    31.5 - 48.5
        VertRefresh  40.0 - 70.0
#        Option       "DPMS"
        DisplaySize  243.84 182.88

Section "Device"
        Identifier      "Card0"
        Driver          "radeon"
        BusID           "PCI:1:0:0"
        Option          "AGPMode" "4"
       Option          "AGPSize" "16" # default: 8
#        Option          "AGPFastWrite" "false" # MUST BE FALSE!!!
#       Option          "SWcursor" "true" # MUST BE TRUE!!!
        Option          "RingSize" "4"
        Option          "BufferSize" "2"
        Option          "EnablePageFlip" "true"
#        Option          "EnableDepthMoves" "false" # MUST BE FALSE!!!
        Option          "RenderAccel" "true"
        Option          "AccelMethod" "XAA" # or XAA, EXA
        Option          "DDCMode"
        Option          "SubPixelOrder" "NONE"
        Option          "ColorTiling" "true"
        Option          "DynamicClocks" "true"
        Option          "bioshotkeys"   "True"
#        Option          "XAANoOffscreenPixmaps" "true"
       Option      "DRI"     "true"

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	DefaultColorDepth 24
	SubSection "Display"
		Depth     1
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     4
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     8
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     15
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     16
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     24
		Modes "1024x768" "800x600" "640x480"
	SubSection "Display"
		Depth     32
		Modes "1024x768" "800x600" "640x480"

Section "DRI"
	Group        "0"
	Mode 0666

Section "Extensions"
  Option "Composite" "Enable"


You can boost your performance by using my ~/.drirc:

    <device screen="0" driver="radeon">
        <application name="Default">
            <option name="force_s3tc_enable" value="true" />
            <option name="no_rast" value="false" />
            <option name="fthrottle_mode" value="2" />
            <option name="tcl_mode" value="3" />
            <option name="texture_depth" value="0" />
            <option name="def_max_anisotropy" value="1.0" />
            <option name="no_neg_lod_bias" value="false" />
            <option name="texture_units" value="2" />
            <option name="dither_mode" value="0" />
            <option name="hyperz" value="true" />
            <option name="round_mode" value="1" />
            <option name="color_reduction" value="0" />
            <option name="vblank_mode" value="0" />
            <option name="allow_large_textures" value="2" />

This should double your glxgear. If you wish to play with your dri configuration, install driconf (here using yaourt):

# yaourt -S driconf


You can also overclock your graphic card. As far as I know, there is no real drawback, but you can play it safe and only use it while running a game or compiz or any application using your graphic card:

# rovclock -c 220 -m 210

Use this command to get back to default settings:

# rovclock -c 144 -m 144

This, with the my drirc and xorg.conf, gives me a glxgears of 1400, which is pretty impressive for a 16mb video ram radeon. Default value for an ArchLinux is below 300, so it really is worth it. Note that if you what to enable it permanently, you just have to add the first command in your ~/.xinitrc, or use any other way to run it once X is started. If, however, you barely use your graphic card, you can lower both power usage and temperature slightly by underclocking your graphic card at boot. Add this command to ~/.xinitrc :

# rovclock -c 90 -m 100


Here are various method to save power:


This will put your screen brightness to the minimum level when on battery and restore it to maximum when on ac power:

# echo -e '#!/bin/bash\necho 0 > /sys/class/backlight/thinkpad_screen/brightness' > /etc/laptop-mode/batt-start/battscript
# chmod 0755 /etc/laptop-mode/batt-start/battscript
# echo -e '#!/bin/bash\necho 7 > /sys/class/backlight/thinkpad_screen/brightness' > /etc/laptop-mode/lm-ac-start/acscript
# chmod 0755 /etc/laptop-mode/lm-ac-start/acscript
# ln -s /etc/laptop-mode/lm-ac-start/acscript /etc/laptop-mode/onlm-ac-start/acscript

It will create scripts, executed by the laptop-mode daemon when switching the power source, that change the brightness of your screen using the thinkpad_acpi module.


Adding those commands to your /etc/rc.local script will save you some power:

ethtool -s eth0 wol d
rmmod uhci_hcd
echo 5 > /proc/sys/vm/laptop_mode
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
hdparm -B 1 -S 12 /dev/sda
echo 0 > /proc/sys/kernel/nmi_watchdog
/sbin/iwpriv eth1 set_power 5

Ethtool cancels the power-draining and seldom needed wake-on-LAN feature of your ethernet card.

The uhci_hcd module drains a lot of power and is only needed for USB1 devices. If you still use them, remove the rmmod command.

The next four commands simply tweak your hard drive to spin less, and therefore save a good deal of power.

The iwpriv command sets the wireless card on power saving mode.


The X31 CPUs can be undervolted, which means they will offer you the same performance, but with more battery life and a cooler laptop. From personal experience, my CPU temperature,during 100% activity, dropped by 15-20°C just by using this patch. This is extremely easy using the linux-phc patch, but only if you know the proper values to give the CPU. Informations on how to find them is available here or here. I know it can be hard to find your own values, so here is a table were you can indicate what are the good values for each of the X31 CPUs:

  • Pentium-m 1600MHz : 34 26 18 12 8 5
    Please note you computer may freeze once a month because of those values. If you find more stable ones, please indicate them.

One you have your values, just run:

# echo VALUES > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids

For example:

# echo 34 26 18 12 8 5 > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids

You can add this command to your /etc/rc.local to make the undervolting permanent.


Put those line in your /etc/modprobe.conf:

options usbcore autosuspend=1
options ipw2100 associate=0
options snd_ac97_codec power_save=1
options thinkpad-acpi experimental=1 fan_control=1

The three first lines put some of your devices in power-saving mode, respectively the USB ports, the wireless card and the sound card. Note that you need the last line in order to control your fan speed (see above)


To see additional sources of power drain, install powertop:

# pacman -S powertop

And run it while on battery power.



You can use a script from ThinkWiki to considerably lower your CPU temperature. My maximum CPU temperature dropped by about ten degrees, so I really suggest using it. Simply download it from here, rename it to tp-fancontrol, and run:

# chmod 0755 tp-fancontrol
# mv tp-fancontrol /usr/bin

To run the script at each boot, add this line to your /etc/rc.local:

tp-fancontrol -d

Also, I suggest changing the first maximum temperature threshold (the CPU one) to 55. Just edit /usr/bin/tp-fancontrol, the file is self-explanatory.