Installing openSUSE 10.2 on a ThinkPad X60

From ThinkWiki
Revision as of 06:27, 13 April 2007 by Xw1Rg3 (Talk | contribs)
Jump to: navigation, search

Lenovo ThinkPad X60 (model 1707-CTO / model 1706-8GG)

Hardware Details

  • Intel Core Duo T2400 (1.83GHz, 2MB L2, 667MHz FSB)
  • 2GB RAM (2 NonParity DDR2 SDRAM SoDIMM PC2-5300)
  • Intel Graphics Media Accelerator 950
  • 12.1 inch XGA (1024x768) (Lenovo LTN121XJ-L07)
  • 80GB, 5400rpm Serial ATA (Hitachi HTS541080G9SA00) / 100GB Serial ATA on 1706GG (Toshiba MK1034GSX)
  • Intel PRO/1000 Gigabit Ethernet
  • Intel PRO/Wireless 3945ABG
  • Bluetooth
  • Firewire
  • SD Card Reader
  • 56K V.92 Modem

Software Details

Installation procedure

Setup

Since I didn't get a dock or usb CDROM with this machine, I started the installation procedure using a USB Stick. I followed these instructions to set up a boot USB key. This contains GRUB and the loader for the installer. The actual installation media was on an NFS share. To set this up, copy the contents of the CDS/DVD into a directory (or mount the DVD iso image loopback) then share the directory containing CD1 via NFS, is the simplest way. Sharing the DVD as a SMB share works from windows, too.

Using the ultra-bay DVD-drive is straightforward as it is detected at startup and can be booted from. Nothing special about this.

Installation

Press F12 during POST to get the boot selector menu up, choose the USB Key. This boots into GRUB. Press F4 here to set the installation source to NFS or SMB as needed, and enter the server details. For example, with SMB, enter the server name, the name of the share, and the directory where the first CD's contents are, eg 'CD1'. Now the installer is loaded from the share and proceeds as a usual SUSE install. No special steps are required during the install, but read the documentation about preserving or moving the ThinkVantage rescue partition before you commit to the installation.

NOTE!
After installing the software, the installer reboots into the installed system to configure it, as usual. Note that because it was booted from a USB key, GRUB has been installed onto the key instead of the hard disk. You can correct this after the configuration is completed, but for now, keep the USB key inserted, boot from that again. The GRUB menu boots the installed system from the hard disk, just like the old days with LILO and a boot floppy. Once the installation and you're logged in, start YaST2, go to System, Bootloader, and change the boot loader location to its proper location (I recommend the boot or root partition with the Generic MBR option). Now the laptop can boot on its own.

What works out of the box

Hardware

  • Ethernet adaptor
  • Intel 3945ABG Wireless ethernet adapter
  • GMA950 graphics with 3D acceleration with integral monitor
  • Sound playback
  • USB
  • Bluetooth (with kbluetoothd, gets about 55kB/s with OBEXFTP)
  • Trackpoint
  • SD card reader

Power management etc

  • Suspend to disk (Fn F12)
  • Suspend to RAM (Fn F4)
  • Turn display dark (Fn F3)
  • CPU speed stepping (required BIOS update to 2.05 though)
  • LCD Brightness depending on current power scheme, via KPowersave and HAL

Extra keys

  • Volume control, keyboard light and screen brightness control
  • Lid switch (LCD off when lid closed, resume from suspend to RAM when opened)
  • Multimedia keys with KMix and Amarok
  • Browser back/forward keys with Konqueror

What had to be configured by hand

  • Mouse wheel emulation, set "Emulate Mouse wheel with button 2" in SaX2 mouse settings
  • Keyboard dead keys for international characters, set "Right Alt is Compose" in SaX2 keyboard settings, then ralt-shift-2, a => ä
  • Sound recording, using KMix or other mixer, set the mic as capture source, turn it up, enable and turn up 'Capture' channel.
  • FN-F2 initially does nothing. This requires extra tweaking.
  • FN-F7 doesn't work either. Even though ibm-acpi module may be loaded, the video-switch facility does not work.
  • The finger print reader, a working driver is existing.
  • By default the fan runs all the time. If power management on the ipw3945 is enabled, it only runs about 1/3 of the time. Use 'iwpriv eth1 set_power 7' to enable power management - this comes at the cost of increasing latency when using wireless. See the ipw3495 README for details. A description how to do this automatically can be found below.

Accessing the nvram - device

The default permissions of the nvram device prevent the screen sliders for brightness / volume etc. from being displayed for non root users. To circumvent this problem, a modification of an entry should be made within /etc/udev.d/hooks/50-udev-default.rules:

replace

KERNEL=="nvram",               GROUP="kmem", MODE="600"

by

KERNEL=="nvram",               GROUP="users", MODE="640"

and every user is able to read from nvram. This ensures that the sliders are displayed when modifying the brightness or the volume.

Automatic power switching for ipw3495

This procedure can be automatized:

Create a script switch_wireless_mode in /usr/lib/powersave/scripts and make it executeable:

#!/bin/bash
###########################################################################
#                                                                         #
#                         Powersave Daemon                                #
#                                                                         #
#          Copyright (C) 2004,2005 SUSE Linux Products GmbH               #
#                                                                         #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the   #
# Free Software Foundation; either version 2 of the License, or (at you   #
# option) any later version.                                              #
#                                                                         #
# This program is distributed in the hope that it will be useful, but     #
# WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       #
# General Public License for more details.                                #
#                                                                         #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                  #
#                                                                         #
###########################################################################
#
# change mode for the wireless network card on X60 lenovo laptop
# currently the interface name needs to be set manually.
#
#

IWPRIV="/usr/sbin/iwpriv"
MODEPARAM="set_power"
POWERSCHEME="6"
BATTERYSCHEME="7"
IF="eth1"

. ${0%/*}/helper_functions

if [ $EVENT_TYPE != ACADAPTER ]; then
    DEBUG "switch_wireless_mode only makes sense for acadapter events ;-)" WARN
else
    if [ "$1" = "acadapter.online" ]; then
        ${IWPRIV} ${IF} ${MODEPARAM} ${POWERSCHEME}
    fi
    if [ "$1" = "acadapter.offline" ]; then
        ${IWPRIV} ${IF} ${MODEPARAM} ${BATTERYSCHEME}
    fi
fi
$SCRIPT_RETURN $EV_ID 0 "switch_wireless_mode finished"
EXIT 0

Finally only two lines have to be modified "on top" of this to make powersaved aware of this script. This ought to happen in /etc/sysconfig/powersave/events:

## Path:                System/Powermanagement/Powersave/Events
## Type:                string
EVENT_ACADAPTER_ONLINE="reread_cpu_capabilities switch_wireless_mode"
EVENT_ACADAPTER_OFFLINE="reread_cpu_capabilities switch_wireless_mode"

"switch_wireless_mode" should be added to the EVENT_ACADAPTER_ONLINE and EVENT_ACADAPTER_OFFLINE as shown above. Given this, the x60 will switch to low power mode when running on battery and back to high power mode when running on mains automatically.

But be warned: if for any reason the device ID of the wireless adapter should differ from eth1 you will have to edit the file switch_wireless_mode accordingly.

Doing a test

iwpriv eth1 get_power

should make it clear whether everything works as expected, the return values should differ between mains plugged and mains unplugged.

Activating FN-F2 and FN-F7

Both keys FN-F2 and FN-F7 create acpi events. This can be seen easily by performing a "tail -f /var/log/acpid" and pressing one of those combinations, however, in the initial state of the installation nothing happens afterwards. The following description shows how to make both keys do what you would expect them to.

FN-F2: blocking the screen as soon as FN-F2 is pressed

Firstly I have to point out that this description is referring to kde - users, I am highly convinced that there exists a similar program on gnome for locking the screen but I simply do not know (and did not test). Therefore your mileage may vary.

Locking the screen may be realized by calling: /opt/kde3/bin/kdesktop_lock --forcelock This works from within a kdesktop, however, if you perform this call from a deamon you do not have access to a X11-screen / a kde session. To circumvent this, the call is executed as the user that is currently owning the screen ":0" through sudo. See the patch for "dockhandler" below.

FN-F7: switching video outputs

Every attempt to make

echo "video_switch" > /proc/acpi/ibm/video

work failed. Luckily there is a tool available from Ken Mano at http://www16.plala.or.jp/mano-a-mano/i810switch.html that can be patched to make video switching work on x60.

The chip i945 on the x60 should be treated like a i855, so the patch that needs to be applied is:

--- i810switch-0.6.5/i810switch.c.original	2005-06-12 06:36:36.000000000  0200
    i810switch-0.6.5/i810switch.c	2007-02-28 15:05:49.000000000  0100
@@ -60,6  60,7 @@
 #define I855STR			"8086:3582"
 //#define I865STR			"8086:2572"
 #define I915STR			"8086:2592"
 #define I945STR			"8086:27a2"
 #define MEMSTR			"Memory at"
 #define NONPRSTR		"32-bit, non-prefetchable"
 
@@ -272,7  273,8 @@
 			return p;
 		}
 
-		i = (p = strstr(*buff_ptr, I855STR)) != NULL;
 		i = (p = strstr(*buff_ptr, I855STR)) != NULL ||
 		    (p = strstr(*buff_ptr, I945STR)) != NULL;
 		if (i)
 		{
 			*chiptype = I855;

After this, the tool should be compiled and installed. I can provide RPM's for openSUSE 10.2 on request.

What is missing now is the interfacing between FN-F7 and i810switch and i810rotate. The latter should be used as it rotates from LCD-Only - LCD CRT - CRT-Only with every new call.

Patching dockhandler

I included this in dockutils (/usr/lib/dockutils from dockutils-01), however, there are several optional ways how to do this. The patch in use is depicted below:

--- dockhandler 2006-11-06 18:22:37.000000000  0100
    dockhandler 2007-03-02 12:44:53.000000000  0100
@@ -70,6  70,12 @@
        elif [ "$SER" -eq 4107 ]; then # Fn F9
            ACTION=dock
        fi
        if [ "$SER" -eq 4098 ]; then # Fn F2
            ACTION=lockscreen
        fi
        if [ "$SER" -eq 4103 ]; then # Fn F7
            ACTION=videotoggle
        fi
     elif [ "$EVENT" = "ibm/dock" ]; then
        case $VAL in
            0)  # X32 has strange dock code
@@ -81,7  87,7 @@
     fi
 fi

-export MODEL=`hal-get-property --udi /org/freedesktop/Hal/devices/computer --key smbios.system.version`
 export MODEL=`hal-get-property --udi /org/freedesktop/Hal/devices/computer --key smbios.system.version | sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"`

 if [ -n "`echo $MODEL | grep -i thinkpad`" ]; then
     HOOKDIR=thinkpad
--- hooks/thinkpad/60x60        2006-11-05 02:35:17.000000000  0100
    hooks/thinkpad/60x60        2007-03-02 12:18:37.000000000  0100
@@ -6,10  6,25 @@
 #
 # This file is released under the GPLv2.
 #
 # Modifications by Dr. Ing. Dieter Jurzitza / enhanced features
 #

 . common_functions

-[ "$MODEL" == "Thinkpad X60" ]