Difference between revisions of "IBM ThinkPad X31"

From ArchWiki
Jump to: navigation, search
(Audio keys)
(Modprobe: rm duplicate content)
(40 intermediate revisions by 13 users not shown)
Line 1: Line 1:
[[Category:Laptops (English)]]
+
[[Category:IBM]]
[[Category:HOWTOs (English)]]
+
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. The only drawback is the lack of internal optical drive. You can see the specs of the X31 on [http://www.thinkwiki.org/wiki/Category:X31 ThinkWiki], a wonderful resource with additional information.
 
+
==Introduction==
+
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 [http://www.thinkwiki.org/wiki/Category:X31 ThinkWiki], a wonderful resource, from which I found most of what I needed for this tutorial.
+
  
 
==Installation==
 
==Installation==
 +
 
A basic Arch Linux 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:
 
A basic Arch Linux 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
+
* {{Pkg|ipw2100-fw}} and {{Pkg|wireless_tools}} for wireless
* ipw2100-fw and wireless_tools for wireless
+
* {{Pkg|xf86-video-ati}} for direct rendering (see above)
* cpufrequtils for powersaving (see above)
+
* {{Pkg|uswsusp}} for hibernation (see above)
* xf86-input-evdev for Xorg input autodetection
+
* xf86-video-ati for direct rendering (see above)
+
* laptop-mode-tools for powersaving (see above)
+
  
Now add acpid, cpufreq, and laptop-mode to your DAEMONS section of your rc.conf.
+
The following useful packages are in the [[AUR]].
 +
* {{AUR|rovclock}} for boosting direct rendering (see above)
  
Add acpi-cpufreq and thinkpad_acpi to your MODULES section of your rc.conf.
+
==Hibernation==
  
Quick note: add an @ before all your DAEMONS in your rc.conf to speed up boot time.
+
To hibernate using [[pm-utils]] (tested with kernel 2.6.37), you have to adjust some screws of the default setup. Doing this, hibernation works flawlessly. You have to setup [[pm-utils]] first. If it's working out of the box, do not read further.
  
The following useful packages are on [[AUR]].
+
Don't forget to install ''radeontool'' from the AUR, as it's needed to turn off the lcd backlight.
* rovclock for boosting direct rendering (see above)
+
* uswsusp for hibernation (see above)
+
* acpi-cpufreq-phc for undervolting the CPU (see above) (Only for kernel >= 2.6.25.4-1)
+
  
==Hibernation==
+
If your X31 freezes during hibernation or just reboots instead of resume, when you power on again, this might help you:
Simply save this script as /usr/bin/hibernation:
+
 
#!/bin/bash
+
Append the following to your '''kernel''' line in grub's config:
modprobe -r ehci_hcd
+
 
/usr/sbin/s2ram -rf
+
{{hc|/boot/grub/menu.lst|2=<nowiki>
modprobe ehci_hcd
+
nomodeset acpi_sleep=nonvs
 
+
</nowiki>}}
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:
+
*nomodeset will turn off kernel modesetting, which tries to automatically handle the resolution during boot. Take a look at [http://wiki.sugarlabs.org/go/Nomodeset].
# echo -e "event=button[ /]lid\naction=/usr/bin/hibernation" > /etc/acpi/events/suspend.conf
+
*acpi_sleep=nonvs is a workaround, see [[Pm-utils#Reboot_instead_of_resume_from_suspend]] for detailed information.
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==
 
==Xorg and direct rendering==
Use my /etc/xorg.conf:
 
  
Note added by Benoitb: I could not start X with your conf file, I removed some contents of the ServerFlags section to get it to start on my configuration. Others, please report your experiences.
+
This section assumes the ATI Radeon Mobility M6 LY video card. This can be verified using:
 +
$ lspci | grep Mobility
  
Note from IchiFish: I had to to remove the line beginning with 'RgbPath' from this configuration file to get my X server to start. I also found it to perform worse (in terms of glxgears fps) than a plain one from hwd -xa with the PageFlip, ColorTiling and AGPMode options added. Also, if you don't intend on running a compositing window manager, it's advisable to disable the composite extension, as it can really slow things down, I've found in particular when switching to and from full screen terminal windows in XFCE. Finally, note that XV output (at least under mplayer) won't work unless the color depth is set to 24-bit (which will significantly reduce glxgears fps).
+
Here is a minimal {{ic|xorg.conf}}, optimized for performance:
 +
{{hc|/etc/X11/xorg.conf|
 +
Section "ServerFlags"
 +
Option "AutoAddDevices" "False"
 +
EndSection
  
Section "ServerLayout"
+
Section "Device"
Identifier    "Xorg Configured"
+
Identifier "Card0"
Screen      0  "Screen0" 0 0
+
Driver "ati"
InputDevice    "Keyboard0" "CoreKeyboard"
+
BusID "PCI:1:0:0"
InputDevice    "PS/2 Mouse" "CorePointer"
+
Option "AGPMode" "4"
Option        "AIGLX" "true"
+
Option "AGPFastWrite" "on" #Faster than default (off)
# Serial Mouse not detected
+
Option "SWcursor" "off" #Faster than default (on)
# USB Mouse not detected
+
Option "EnablePageFlip" "on" #Faster than default (off)
EndSection
+
Option "AccelMethod" "EXA" # or XAA, EXA, XAA more stable, XAA is deafult
+
Option "DynamicClocks" "on"
Section "ServerFlags"
+
Option "BIOSHotkeys"  "on"
Option "AllowMouseOpenFail"  "true"
+
Option "AGPSize" "32" # default: 8
        Option "PM" "off"
+
Option "EnableDepthMoves" "true"
        Option "DPMS" "off"
+
EndSection
        Option "Xinerama" "0"
+
 
EndSection
+
Section "Extensions"
+
  Option "Composite" "Disable"
Section "Files"
+
EndSection
RgbPath      "/usr/share/X11/rgb"
+
}}
ModulePath  "/usr/lib/xorg/modules"
+
 
FontPath    "/usr/share/fonts/misc:unscaled"
+
{{Note|This configuration disables compositing to improve performance. If you need this feature, set {{Ic|Composite}} to {{Ic|Enable}}. Also, if you want to use [[Xorg Input Hotplugging]], set {{Ic|AutoAddDevices}} to {{Ic|true}}.}}
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"
+
EndSection
+
+
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"
+
EndSection
+
+
Section "InputDevice"
+
Identifier  "Keyboard0"
+
Driver      "keyboard"
+
        Option      "CoreKeyboard"
+
Option "XkbRules" "xorg"
+
Option "XkbModel" "pc105"
+
Option "XkbLayout" "us"
+
Option "XkbVariant"
+
Option "XkbOptions" "ctrl:nocaps"
+
EndSection
+
+
Section "InputDevice"
+
Identifier  "Serial Mouse"
+
Driver      "mouse"
+
Option      "Protocol" "Microsoft"
+
Option      "Device" "/dev/ttyS0"
+
Option      "Emulate3Buttons" "true"
+
Option      "Emulate3Timeout" "70"
+
Option     "SendCoreEvents"  "true"
+
EndSection
+
+
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"
+
EndSection
+
+
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"
+
EndSection
+
+
# 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
+
EndSection
+
+
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"
+
EndSection
+
+
+
+
Section "Screen"
+
Identifier "Screen0"
+
Device    "Card0"
+
Monitor    "Monitor0"
+
DefaultColorDepth 24
+
SubSection "Display"
+
Depth    1
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
SubSection "Display"
+
Depth    4
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
SubSection "Display"
+
Depth    8
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
SubSection "Display"
+
Depth    15
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
SubSection "Display"
+
Depth    16
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
SubSection "Display"
+
Depth    24
+
Modes "1024x768" "800x600" "640x480"
+
EndSubSection
+
EndSection
+
+
Section "DRI"
+
Group        "0"
+
Mode 0666
+
EndSection
+
+
Section "Extensions"
+
  Option "Composite" "Enable"
+
EndSection
+
===Dri===
+
You can boost your performance by using my ~/.drirc:
+
<driconf>
+
    <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" />
+
        </application>
+
    </device>
+
</driconf>
+
This should double your glxgear. If you wish to play with your dri configuration, install driconf found in [[AUR]].
+
  
 
===Rovclock===
 
===Rovclock===
 +
 
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:
 
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
+
  rovclock -c 220 -m 210
 +
 
 
Use this command to get back to default settings:
 
Use this command to get back to default settings:
  # rovclock -c 144 -m 144
+
  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 Arch Linux 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 you want to enable it permanently, add the first command in [[xprofile]].
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
+
If, on the contrary, you barely use your graphic card, you can lower both power usage and temperature slightly by underclocking your graphic card at boot by adding this command to [[xprofile]]:
 +
  rovclock -c 90 -m 100
  
 
===Dual Screen===
 
===Dual Screen===
If you want to use an external screen for a presentation or as an extended desktop, you can use xrandr.
+
 
For an extended desktop, you should first add one line in your /etc/x11/xorg.conf configuration file at the SubSection "Display" area:
+
If you want to use an external screen for a presentation or as an extended desktop, you can use [[xrandr]].
 +
For an extended desktop, you should first add one line in your {{ic|/etc/x11/xorg.conf}} configuration file in the {{Ic|SubSection "Display"}} area:
 +
 
 
Before:
 
Before:
 
  SubSection "Display"
 
  SubSection "Display"
Line 270: Line 88:
 
After:
 
After:
 
  SubSection "Display"
 
  SubSection "Display"
  Depth    24
+
Depth    24
  Modes "1024x768" "800x600" "640x480"
+
Modes "1024x768" "800x600" "640x480"
                Virtual 2304 1024
+
Virtual 2304 1024
 
  EndSubSection
 
  EndSubSection
  
Line 279: Line 97:
 
Note that in 24 bits with this option, the performance is affected for 3D drawing, so you may need to comment it and use only one screen when you need the graphical power.
 
Note that in 24 bits with this option, the performance is affected for 3D drawing, so you may need to comment it and use only one screen when you need the graphical power.
  
Then restart your X server (ctrl-alt-backspace). You can issue this command in a shell:
+
Then restart your X server. You can issue this command in a shell:
 
  xrandr --output VGA-0 --right-of LVDS
 
  xrandr --output VGA-0 --right-of LVDS
  
To find the exact name of the monitors and the maximum resolution that you set up in the configuration file, you can type just '''xrandr''' without arguments.
+
To find the exact name of the monitors and the maximum resolution that you set up in the configuration file, you can type just {{Ic|xrandr}} without arguments.
  
 
==Powersaving==
 
==Powersaving==
Here are various method to save power:
+
 
 
===Laptop-mode===
 
===Laptop-mode===
 +
 
This will put your screen brightness to the minimum level when on battery and restore it to maximum when on ac 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
+
  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
+
  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
+
  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
+
  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
+
  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.
 
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.
===Rc.local===
 
Adding those commands to your /etc/rc.local script will save you some power:
 
#!/bin/bash
 
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. '''Don't use this command if you have an integrated bluetooth device otherwise it won't work'''
 
 
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.
 
  
 
===Undervolting===
 
===Undervolting===
 +
 
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 [http://gentoo-wiki.com/HOWTO_Undervolt_a_Pentium_M_CPU here] or [http://www.thinkwiki.org/wiki/Pentium_M_undervolting_and_underclocking 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:
 
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 [http://gentoo-wiki.com/HOWTO_Undervolt_a_Pentium_M_CPU here] or [http://www.thinkwiki.org/wiki/Pentium_M_undervolting_and_underclocking 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<br>Please note you computer may freeze once a month because of those values. If you find more stable ones, please indicate them.
+
* Pentium-m 1600MHz : 34 26 18 12 8 5
One you have your values, just run:
+
{{Warning|Your computer may freeze once a month because of those values. If you find more stable ones, please indicate them.}}
 +
 
 +
Once you have your values, just run:
 
  # echo VALUES > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
 
  # echo VALUES > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
 +
 
For example:
 
For example:
 
  # echo 34 26 18 12 8 5 > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
 
  # 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.
 
  
===Modprobe.conf===
+
You can add this command to your {{ic|/etc/rc.local}} to make the undervolting permanent.
Put those line in your /etc/modprobe.conf:
+
 
 +
===Modprobe===
 +
 
 +
Create the following file:
 +
{{hc|/etc/modprobe.d/powersave.conf|2=<nowiki>
 
  options usbcore autosuspend=1
 
  options usbcore autosuspend=1
 
  options ipw2100 associate=0
 
  options ipw2100 associate=0
options snd_ac97_codec power_save=1
 
 
  options thinkpad-acpi experimental=1 fan_control=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.
+
</nowiki>}}
Note that you need the last line in order to control your fan speed (see above)
+
 
 +
The three first lines put some of your devices in power-saving mode, respectively the USB ports, and the wireless card. Note that you need the last line in order to control your fan speed (see above).
 +
 
 +
See [[power saving]] for more details.
  
 
===Powertop===
 
===Powertop===
 +
 
To see additional sources of power drain, install powertop:
 
To see additional sources of power drain, install powertop:
 
  # pacman -S powertop
 
  # pacman -S powertop
And run it while on battery power.
 
  
===Hard drive dilemna===
+
And run it while on battery power. See [[Powertop]] for more information.
 +
 
 +
===Hard drive dilemma===
 +
 
 
As set earlier, the hard drive is on a power-saving mode that can make it spin off and on often. It may reduce its lifetime. You can install the '''smartmontools''' package and issue this command:
 
As set earlier, the hard drive is on a power-saving mode that can make it spin off and on often. It may reduce its lifetime. You can install the '''smartmontools''' package and issue this command:
 
  # smartctl -A /dev/sda | grep Load_Cycle_Count
 
  # smartctl -A /dev/sda | grep Load_Cycle_Count
 +
 
If the number is growing too fast, you might want to set off the powersaving mode by issuing:  
 
If the number is growing too fast, you might want to set off the powersaving mode by issuing:  
 
  # hdparm -B 254 /dev/sda
 
  # hdparm -B 254 /dev/sda
  
See the above item rc.local to modify it at boot time.
+
Put it in {{ic|/etc/rc.local}} to modify it at boot time.
 +
 
 +
==ACPI and Hardware-related==
  
==Other==
 
 
===Fan-control===
 
===Fan-control===
You can use a script from [http://www.thinkwiki.org/wiki/ThinkWiki 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 [http://www.thinkwiki.org/index.php?title=Code/tp-fancontrol&action=raw&ctype=application/octet-stream here], rename it to tp-fancontrol, and run:
+
 
 +
You can use a script from [http://www.thinkwiki.org/wiki/ThinkWiki ThinkWiki] to considerably lower your CPU temperature. Simply download it from [http://www.thinkwiki.org/index.php?title=Code/tp-fancontrol&action=raw&ctype=application/octet-stream here], rename it to {{ic|tp-fancontrol}}, and run:
 
  # chmod 0755 tp-fancontrol
 
  # chmod 0755 tp-fancontrol
 
  # mv tp-fancontrol /usr/bin
 
  # mv tp-fancontrol /usr/bin
To run the script at each boot, add this line to your /etc/rc.local:
+
 
 +
To run the script at each boot, add this line to your {{ic|/etc/rc.local}}:
 
  tp-fancontrol -d
 
  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.
+
 
===Wireless and WPA===
+
Also, I suggest changing the first maximum temperature threshold (the CPU one) to 55. Just edit {{ic|/usr/bin/tp-fancontrol}}, the file is self-explanatory.
 +
 
 +
===thinkpad_acpi and tp_smapi kernel modules===
 +
 
 +
To make use of all hardware, use [[Tp_smapi]] and thinkpad_acpi. The former is in the [[AUR]], thinkpad_acpi is merged into the kernel and has just to be loaded.
 +
 
 +
Have a look at Thinkwiki for scripts and tweaks:
 +
 
 +
*[http://www.thinkwiki.org/wiki/Thinkpad-acpi Thinkpad_acpi]
 +
*[http://www.thinkwiki.org/wiki/Thinkpad-acpi Tp_smapi]
 +
 
 +
==Wireless==
 +
 
 
If you have the Cisco neta504 wifi card, it's a bit tricky to use the wpa encryption with it.  
 
If you have the Cisco neta504 wifi card, it's a bit tricky to use the wpa encryption with it.  
Firstofall, remove and blacklist the airo and the airo_cs modules in your /etc/rc.conf
+
First, unload the airo and the airo_cs modules.
 
remove the module airo from the kernel
 
remove the module airo from the kernel
 
  # rmmod airo
 
  # rmmod airo
 
  # rmmod airo_cs
 
  # rmmod airo_cs
 +
 +
Next, [[Kernel modules#Blacklisting|blacklist]] the modules in {{ic|/etc/modprobe.d/}}.
 +
 
then install ndiswrapper
 
then install ndiswrapper
 
  # pacman -S ndiswrapper
 
  # pacman -S ndiswrapper
Line 373: Line 205:
 
  # modprobe ndiswrapper
 
  # modprobe ndiswrapper
  
and voilà !
+
and voilà ! I've tried this with wicd and it works flawlessly !
I've tried this with wicd and it works flawlessly !
+
 
 +
==Audio keys==
 +
 
 +
To have an on-screen Display for volume change or thinklight activation you can use Tpb: [[ThinkPad_OSD]]. The audio volume up/down keys will change audio volume independently from ALSA/OSS mixer. This works quite well, so try it out.
  
=== Audio keys ===
 
 
To enable the audio keys interfacing with ALSA, add:
 
To enable the audio keys interfacing with ALSA, add:
 
  event=ibm/hotkey HKEY 00000080 *
 
  event=ibm/hotkey HKEY 00000080 *
 
  action=/etc/acpi/soundkey.sh %e
 
  action=/etc/acpi/soundkey.sh %e
to /etc/acpi/events/soundkey, and:
 
#!/bin/bash
 
 
echo here > /tmp/fish
 
echo $4 >> /tmp/fish
 
case "$4" in
 
00001015)
 
amixer -c 0 set Master playback unmute
 
amixer -c 0 set Master playback 3%+
 
;;
 
00001016)
 
amixer -c 0 set Master playback unmute
 
amixer -c 0 set Master playback 3%-
 
;;
 
00001017)
 
amixer -c 0 set Master playback mute
 
;;
 
esac
 
to /etc/acpi/soundkey.sh, and chown 755 it.
 
  
You'll also need to add:
+
to {{ic|/etc/acpi/events/soundkey}}, create the following file and make it executable:
 +
{{hc|/etc/acpi/soundkey.sh|<nowiki>
 +
#!/bin/bash
  
 +
echo here > /tmp/fish
 +
echo $4 >> /tmp/fish
 +
case "$4" in
 +
00001015)
 +
amixer -c 0 set Master playback unmute
 +
amixer -c 0 set Master playback 3%+
 +
;;
 +
00001016)
 +
amixer -c 0 set Master playback unmute
 +
amixer -c 0 set Master playback 3%-
 +
;;
 +
00001017)
 +
amixer -c 0 set Master playback mute
 +
;;
 +
esac
 +
</nowiki>}}
 +
 +
You'll also need to add:
 
  echo enable,0xffffffff >/proc/acpi/ibm/hotkey
 
  echo enable,0xffffffff >/proc/acpi/ibm/hotkey
  
to /etc/rc.local or somewhere similiar for the events to be recognised.
+
to {{ic|/etc/rc.local}} or somewhere similar for the events to be recognized.

Revision as of 01:08, 24 October 2012

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. The only drawback is the lack of internal optical drive. You can see the specs of the X31 on ThinkWiki, a wonderful resource with additional information.

Installation

A basic Arch Linux 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:

The following useful packages are in the AUR.

  • rovclockAUR for boosting direct rendering (see above)

Hibernation

To hibernate using pm-utils (tested with kernel 2.6.37), you have to adjust some screws of the default setup. Doing this, hibernation works flawlessly. You have to setup pm-utils first. If it's working out of the box, do not read further.

Don't forget to install radeontool from the AUR, as it's needed to turn off the lcd backlight.

If your X31 freezes during hibernation or just reboots instead of resume, when you power on again, this might help you:

Append the following to your kernel line in grub's config:

/boot/grub/menu.lst
nomodeset acpi_sleep=nonvs 

Xorg and direct rendering

This section assumes the ATI Radeon Mobility M6 LY video card. This can be verified using:

$ lspci | grep Mobility

Here is a minimal xorg.conf, optimized for performance:

/etc/X11/xorg.conf
Section "ServerFlags"
	Option "AutoAddDevices" "False"
EndSection

Section "Device"
	Identifier	"Card0"
	Driver		"ati"
	BusID		"PCI:1:0:0"
	Option		"AGPMode" "4"
	Option		"AGPFastWrite" "on" #Faster than default (off)
	Option		"SWcursor" "off" #Faster than default (on)
	Option		"EnablePageFlip" "on" #Faster than default (off)
	Option		"AccelMethod" "EXA" # or XAA, EXA, XAA more stable, XAA is deafult
	Option		"DynamicClocks" "on"
	Option		"BIOSHotkeys"   "on"
	Option		"AGPSize" "32" # default: 8
	Option		"EnableDepthMoves" "true"
EndSection

Section "Extensions"
  Option "Composite" "Disable"
EndSection
Note: This configuration disables compositing to improve performance. If you need this feature, set Composite to Enable. Also, if you want to use Xorg Input Hotplugging, set AutoAddDevices to true.

Rovclock

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

If you want to enable it permanently, add the first command in xprofile.

If, on the contrary, you barely use your graphic card, you can lower both power usage and temperature slightly by underclocking your graphic card at boot by adding this command to xprofile:

rovclock -c 90 -m 100

Dual Screen

If you want to use an external screen for a presentation or as an extended desktop, you can use xrandr. For an extended desktop, you should first add one line in your /etc/x11/xorg.conf configuration file in the SubSection "Display" area:

Before:

SubSection "Display"
 		Depth     24
 		Modes "1024x768" "800x600" "640x480"
EndSubSection

After:

SubSection "Display"
		Depth     24
		Modes "1024x768" "800x600" "640x480"
		Virtual 2304 1024
EndSubSection

The numbers are the total rectangular resolution that you need to use. In this case, I'm using the internal 1024x768 screen and an external 1280x1024 screen on the right. The total resolution is 1024+1280=2304 pixels large and 1024>768=1024 pixels height.

Note that in 24 bits with this option, the performance is affected for 3D drawing, so you may need to comment it and use only one screen when you need the graphical power.

Then restart your X server. You can issue this command in a shell:

xrandr --output VGA-0 --right-of LVDS

To find the exact name of the monitors and the maximum resolution that you set up in the configuration file, you can type just xrandr without arguments.

Powersaving

Laptop-mode

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.

Undervolting

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
Warning: Your computer may freeze once a month because of those values. If you find more stable ones, please indicate them.

Once 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.

Modprobe

Create the following file:

/etc/modprobe.d/powersave.conf
 options usbcore autosuspend=1
 options ipw2100 associate=0
 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, and the wireless card. Note that you need the last line in order to control your fan speed (see above).

See power saving for more details.

Powertop

To see additional sources of power drain, install powertop:

# pacman -S powertop

And run it while on battery power. See Powertop for more information.

Hard drive dilemma

As set earlier, the hard drive is on a power-saving mode that can make it spin off and on often. It may reduce its lifetime. You can install the smartmontools package and issue this command:

# smartctl -A /dev/sda | grep Load_Cycle_Count

If the number is growing too fast, you might want to set off the powersaving mode by issuing:

# hdparm -B 254 /dev/sda

Put it in /etc/rc.local to modify it at boot time.

ACPI and Hardware-related

Fan-control

You can use a script from ThinkWiki to considerably lower your CPU temperature. 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.

thinkpad_acpi and tp_smapi kernel modules

To make use of all hardware, use Tp_smapi and thinkpad_acpi. The former is in the AUR, thinkpad_acpi is merged into the kernel and has just to be loaded.

Have a look at Thinkwiki for scripts and tweaks:

Wireless

If you have the Cisco neta504 wifi card, it's a bit tricky to use the wpa encryption with it. First, unload the airo and the airo_cs modules. remove the module airo from the kernel

# rmmod airo
# rmmod airo_cs

Next, blacklist the modules in /etc/modprobe.d/.

then install ndiswrapper

# pacman -S ndiswrapper

download the neta504 driver for windows and unpack it (Be sure that you have unpacked the whole driver !) Then run :

# ndiswrapper -i /path/to/your/dir/netA504.inf

Save the ndiswrapper conf file :

# ndiswrapper -m
# ndiswrapper -ma
# ndiswrapper -mi

Now you can add to your kernel the module :

# modprobe ndiswrapper

and voilà ! I've tried this with wicd and it works flawlessly !

Audio keys

To have an on-screen Display for volume change or thinklight activation you can use Tpb: ThinkPad_OSD. The audio volume up/down keys will change audio volume independently from ALSA/OSS mixer. This works quite well, so try it out.

To enable the audio keys interfacing with ALSA, add:

event=ibm/hotkey HKEY 00000080 *
action=/etc/acpi/soundkey.sh %e

to /etc/acpi/events/soundkey, create the following file and make it executable:

/etc/acpi/soundkey.sh
#!/bin/bash

echo here > /tmp/fish
echo $4 >> /tmp/fish
case "$4" in
	00001015)
		amixer -c 0 set Master playback unmute
		amixer -c 0 set Master playback 3%+
		;;
	00001016)
		amixer -c 0 set Master playback unmute
		amixer -c 0 set Master playback 3%-
		;;
	00001017)
		amixer -c 0 set Master playback mute
		;;
esac

You'll also need to add:

echo enable,0xffffffff >/proc/acpi/ibm/hotkey

to /etc/rc.local or somewhere similar for the events to be recognized.