niemueller.de::home niemueller.de
Open Software. Open Knowledge.




 

Fedora Core 3 on an IBM Thinkpad T41p

Introduction

This article describes the steps I took to get Fedora Core 3 (FC3) running smoothly on the T41p. FC3 comes with pretty good defaults and most things will run out of the box. For some things some additional info and tweaking may be helpful. Especially the WLAN chipset needs some handwork. Most features are working. You can even get the little nifty things working. Most of the hand crafted features should work similarly on other distro as well. Give it a try.

Basic installation

Install as usual. Install whatever you like. There is nothing special you need. You may want to install the Bluetooth applications and IrDA stuff to make use of it.

USB, UltraNav, PCMCIA

All these items work out of the box with no special configuration needed. The USB controller uses the ehci-hcd driver.

Sound

Kudzu detects the sound hardware just fine and uses the snd-intel8x0 ALSA driver. If you are using another distro, here is what kudzu added to my /etc/modprobe.conf and works just fine:
alias snd-card-0 snd-intel8x0
options snd-card-0 index=0
install snd-intel8x0 /sbin/modprobe --ignore-install snd-intel8x0 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-intel8x0 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; };
/sbin/modprobe -r --ignore-remove snd-intel8x0
All distros should bring appropriate scripts to load the drivers needed. If not give FC a try ;-)

The driver does not support hardware mixing at this time. To get around this short coming you need the dmix ALSA plugin to use software mixing. Desktop systems like Gnome and KDE bring their own mixing daemon. But for some special needs you still need to be able to open the device file a second time (a classical example are games that open the device file and write to it, but this may then already be blocked by esd or the like). To fix this all you need to do is create the file /etc/asound.conf with the following content:
pcm.!default {
        type plug
        slave.pcm "dmixer"
}

pcm.dmixer  {
        type dmix
        ipc_key 1024
        slave {
                pcm "hw:0,0"
                period_time 0
                period_size 1024
                buffer_size 4096
                rate 44100
        }
        bindings {
                0 0
                1 1
        }
}

ctl.dmixer {
        type hw
        card 0
}
This will enable software mixing on the default device which should be used by most applications anyway. I used this to get sound working for UT2004 :-)

Display and Graphics

The graphics work right out of the box. On first bootup choose a standard LCD panel with a resolution of 1400x1050 and millions of colors. You may want to add an argument to your kernel to have a console with the full resolution. In your /etc/grub.conf add the following to the appropriate kernel line: vga=834.

Special ATI drivers

Now that ATI finally has drivers for X.org 6.8 these may be an option. I have successfully compiled them and used them. One drawback is that the driver cannot handle sleep correctly. The display looks scrambled after wakeup. Since the long bootup time of FC3 is a pain and I really like the sleep mode and I do not really need the 3D performance I stick with the default driver.

If you do want to use the driver do the following: There are nice RPMs at the Livna RPM repository at http://rpm.livna.org/. All you need to do is install ati-fglrx and kernel-module-fglrx which matches your kernel version (not that the kernel module package is named for example kernel-module-fglrx-2.6.10-1.760_FC3 and not just kernel-module-fglrx! I don't know why they do this and it seems stupid, but it's the way it is. The modules will not get updated if the kernel is upgraded with this naming scheme. They have a startup script that will look for the correct kernel modules and disable the ATI driver and load the fall back X.org driver if needed though.

If you want to build the driver yourself for some reason (for example if livna should decide to discontinue building of the packages) do the following: Fetch the X.org 6.8 Mobility FireGL driver from http://www.ati.com/support/products/workstation/mobilityfiregl/linux/mobilityfiregllinuxdrivers.html and install the RPM. Building the module will fail. No problem, we deal with that now. Grab a patch for the driver from http://www.niemueller.de/wiki/files/fglrx.patch . Now go to /lib/modules/fglrx/build_mod and apply the patch with patch <fglrx.patch. This will fix a couple of things that changed for the new kernel that comes with FC3. Then execute:
sh make.sh
cd ..
sh make_install.sh
to build and install the kernel modules needed. Try to load them with modprobe fglrx. Now you need to tweak /etc/X11/xorg.conf. Look for the Device section and make it look like the following:
Section "Device"
        Identifier  "Videocard0"
        Driver      "fglrx"
        VendorName  "ATI"
        BoardName   "ATI FireGL Mobility T2"
        Option "no_accel"                   "no"
        Option "no_dri"                     "no"
        Option "mtrr"                       "off"
        Option "DesktopSetup"               "0x00000100"
        Option "NoTV"                       "yes"
        Option "VideoOverlay"               "on"
        Option "OpenGLOverlay"              "off"
        Option "CenterMode"                 "off"
        Option "UseFastTLS"                 "0"
        Option "BlockSignalsOnLock"         "on"
        Option "UseInternalAGPGART"         "yes"
        Option "ForceGenericCPU"            "no"
        BusID "PCI:1:0:0"    # vendor=1002, device=4e54
EndSection
These settings worked for me. Play around with it if you need anything different. If you get sleep to work with this driver let me know. Now restart X and enjoy a fast bzflag match.

Wireless LAN

This is the step which involves the most manual steps. The T41p comes with an 802.11 a/b/g WLAN chipset which is based on the Atheros 5212. This runs just fine with the MadWiFi drivers (http://madwifi.sourceforge.net/). The steps needed to get this driver working are simple. It seems that there are no working RPMs right now. And since time is rare these days I decided to go without a RPM. So check out the source from CVS, build and install the driver (as root):
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
cd madwifi
make
make install
This will install a driver for the wireless LAN adapter on your system. Now create a basic configuration in /etc/sysconfig/network-scripts/ifcfg-ath0:
# Atheros Communications, Inc. AR5212 802.11abg NIC
DEVICE=ath0
ONBOOT=no
BOOTPROTO=dhcp
USERCTL=yes
PEERDNS=yes
TYPE=Wireless
ESSID=
CHANNEL=1
MODE=Managed
RATE=Auto
Then add the following line to /etc/modprobe.conf:
alias ath0 ath_pci
Now you are ready to go. Do a modprobe ath_pci. This should give some information in the kernel message buffer (try dmesg). After issuing ifconfig ath0 up it will start looking for a wireless network. You can also use the graphical system-config-network (you find it in the applications menu under System Settings -> Network Settings).

At this time NetworkManager (http://people.redhat.com/dcbw/NetworkManager/) does not work pretty good with the MadWiFi driver. But as it seems this might change in the near future.

Bluetooth

The Bluetooth device works just fine. By pressing Fn+F5 you can enable and disable the adapter. It will appear as a hotplugged USB device. The Bluez USB stack has drivers for this adapter. In /etc/sysconfig/irda you find a couple of files that you need to edit to use bluetooth. The first file you may want to edit is hcid.conf to set your machine name and enable encryption for all connections. In GPRSviaBluetooth you can find a description on how to establish a GPRS connection via a mobile phone using Bluetooth.

IrDA

Infrared communication is working just fine with Fedora Core 3. You have to care about the details though, otherwise it won't. First make sure to enable Infrared in the BIOS setup (yes, that is a detail that can ruin the day). You have the choice to use either SIR or FIR.

SIR

Getting SIR (Serial Infrared, up to 115 kbit/sec) working is pretty simple. First edit /etc/sysconfig/irda and enter the following data:
IRDA=yes
DEVICE=/dev/ttyS1
DISCOVERY=yes
Then call service irda start as root. Infrared should work now for you. See below how to test.

FIR

For FIR (Fast Infrared, up to 4 Mbit/sec) you have to care about the details! I didn't and it cost me two hours to figure out where that dumb problem was. To avoid this failure first edit /etc/modprobe.conf and add a line that reads
options nsc-ircc dongle_id=9
to the file. This will load the appropriate FIR module with the dongle id set to 9, which is the IBM Thinkpad type. The nsc-ircc will load without this parameter and report some other kind of dongle - but you won't get any data send over the air. Another thing is that you need to tell the serial driver that it should not hold ttyS1. This problem is indicated in the dmesg output with a message like
nsc-ircc, Found chip at base=0x02e
nsc-ircc, driver loaded (Dag Brattli)
nsc_ircc_open(), can't get iobase of 0x2f8
You can see with cat /proc/ioports that the serial driver holds this IO address. To avoid this execute as root
setserial /dev/ttyS1 uart none
before starting IrDA. Now edit /etc/sysconfig/irda and put this in:
IRDA=yes
DEVICE=nsc-ircc
DISCOVERY=yes
Now you can start IrDA with service irda start and are up and running.

Testing

You can do some basic testing if infrared is working with irdadump. After you started IrDA in either SIR or FIR mode start it simply with irdadump. Hold some other infrared device in the beam of your laptop. It should appear immediately in the output. This may look like this:
01:38:55.288902 xid:cmd 8afd9e15 > ffffffff S=6 s=0 (14)
01:38:55.377647 xid:rsp 8afd9e15 < 0000d04f S=6 s=0 Nokia 6230 hint=b125 [ PnP
Modem Fax Telephony IrCOMM IrOBEX ] (27)
01:38:55.378901 xid:cmd 8afd9e15 > ffffffff S=6 s=1 (14)
01:38:55.464630 xid:rsp 8afd9e15 < c8743143 S=6 s=1 Tim Niemueller hint=8220 [
PDA/Palmtop IrOBEX ] (32)
01:38:55.468800 xid:cmd 8afd9e15 > ffffffff S=6 s=2 (14)
01:38:55.558788 xid:cmd 8afd9e15 > ffffffff S=6 s=3 (14)
01:38:55.648777 xid:cmd 8afd9e15 > ffffffff S=6 s=4 (14)
01:38:55.738833 xid:cmd 8afd9e15 > ffffffff S=6 s=5 (14)
01:38:55.828826 xid:cmd 8afd9e15 > ffffffff S=6 s=* evilgenius hint=4400 [
Computer LAN Access ] (26)
evilgenius is the name of my notebook (yes, I do like the comic). You can see my cell phone responding to the discovery. The other device is my Palm m515 handheld. All this data is collected by just putting the device into the beam with enabled infrared. You do not need to send any data like vcards or whatsoever. If you do not see the device make sure infrared is enabled on both devices. If the device still does not appear something is wrong. Called setserial? Added the dongle parameter? Are you in a room kind of red (no joke! We once had the problem in a room at the university where we would not get any IR communication through - the room was full of red tables)?

ACPI, keyboard and special keys and buttons

The ACPI support on the notebook is good in general and very good with the special ibm-acpi module.

Suspend to RAM

This very useful feature to avoid the long bootup time works like a charme with some tweaks. Sleeping works out of the box. But if the machine awakens the screen may remain black. This can be avoided by adding acpi_sleep=s3_bios to your kernel arguments. You can put this in /etc/grub.conf. Kernel arguments are given in the kernel line for the kernel you are booting (try uname -a). A kernel line may look like this after changing:
        kernel /boot/vmlinuz-2.6.9-1.724_FC3 ro root=LABEL=/ rhgb quiet vga=834 acpi_sleep=s3_bios
This must be one line! Now you can send your notebook to sleep by typing echo -n 3 >/proc/acpi/sleep. The machine will wake up on events like opening the lid or pressing Fn.

ACPI and ibm-acpi

With ACPI you can do some nifty things. The laptop mode uses the ACPI facilities for its work (see below) and you can use it to make the power button to anything you want and to go to sleep on Fn+F4 (you can also do anything else on that keyboard shortcut!). The ibm-acpi (http://ibm-acpi.sourceforge.net/) offers some special feature like the mentioned remapping of the Fn+F-key combinations to anything you like, noticing bay and dock events or just playing with the Think Light. Just grab the source, compile and install it. With a simple modprobe ibm-acpi you can make use of all the features. Read the README that comes with the ibm-acpi package.

To remap the buttons you need an action file (a script which performs whatever you like) and an event script (which defines what action script to call on whatever event you define). Here are two examples for the power button and for Fn+F4. Both will put the notebook to sleep. The sleep script was taken from the ibm-acpi distribution. It is put to /etc/acpi/actions. The event scripts must be put to /etc/acpi/events. They contain:
# /etc/acpi/events/powerbutton
event=button/power.*
action=/etc/acpi/actions/sleep.sh
# /etc/acpi/events/sleep
event=(button/sleep|ibm/hotkey HKEY 00000080 00001004)
action=/etc/acpi/actions/sleep.sh
The mentioned sleep.sh example may look like:
#!/bin/bash
# (c) 2005 by Tim Niemueller [http://www.niemueller.de]

#### PRE SLEEP
#### The following is executed before going to sleep

# write all data to disk that is waiting
sync

# Unload all USB modules, they won't recognize hardware otherwise after wakeup
USBMODULES=`grep usb-controller /etc/modprobe.conf | awk '{ print $3 }'`
for m in $USBMODULES; do
        /sbin/modprobe -r $m
done

# Save time, stop NTP
/sbin/hwclock --systohc
/sbin/service ntpd stop

# Sleep
echo -n mem > /sys/power/state

#### POST SLEEP
#### Everything from now on is executed after wakeup

# Set clock from hardware
/sbin/hwclock --hctosys

# Load USB modules again
for m in $USBMODULES; do
        /sbin/modprobe $m
done

# Restart CPU throttling
/sbin/service cpuspeed restart

# Restart laptop mode, otherwise would not recognize battery mode if
# cable was removed during sleep
/sbin/service laptop-mode restart

# check network connection, if we can ping ptb timeserver
# (Physikalische Technische Bundesanstalt, German reference time)
# we sync time to it
/bin/ping -c 1 -W 2 ntp1.ptb.de
if [ "$?" = "0" ]; then
        /usr/sbin/ntpdate ntp1.ptb.de
fi
/sbin/service ntpd start
You need to restart acpid for the changes to take effect (/sbin/service acpid restart).

Buttons

The T41p has three special buttons for the volume and the "Access IBM button". The volume button seem to be controlled by the BIOS and work out of the box without any interference by a software. The Access IBM button needs to be remapped by a program. To do this and to have a nice on-screen display of the volume/ThinkLight/brightness state you need the ThinkPad Buttons software (http://www.nongnu.org/tpb/). It is available in Dag's apt repository (http://dag.wieers.com/home-made/apt/) as a RPM package. A sample config may look like this:
THINKPAD    /usr/bin/xmms -t
This will map the blue Access IBM button to xmms play/pause and will use the default color and font for the OSD. Now you just need to start tpb on every login. This can easily be done in Gnome by using Applications Menu -> Preferences -> More Preferences -> Sessions.

Special IBM ThinkPad cursor keys

There are two special grey cursor keys which are excellent for switching desktops left and right :-) Since xmodmap is not supported any more you have to use xkb for mapping these keys to special symbols which Gnome can then use. I will describe this here for the German keyboard layout. You should be able to figure out which files to modify from these examples. Edit the file /usr/X11R6/lib/X11/xkb/pc/de (or whatever is used for your locale, you can see which that is with setxkbmap -print). Add the following lines in the basic section:
    key <I6A>   { [ XF86Back                                          ]
};
    key <I69>   { [ XF86Forward                                       ]
};
Now restart X and you can use assign shortscuts to these keys using the shortcut preferences.

These magic values can be found via the following way: Start xev and press the keys. You will see output like this (besides all the other stuff that is displayed):
KeyPress event, serial 25, synthetic NO, window 0x3c00001,
    root 0x40, subw 0x0, time 25794048, (1101,322), root:(1110,392),
    state 0x0, keycode 234 (keysym 0x1008ff26, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x3c00001,
    root 0x40, subw 0x0, time 25794111, (1101,322), root:(1110,392),
    state 0x0, keycode 234 (keysym 0x1008ff26, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:

KeyPress event, serial 28, synthetic NO, window 0x3c00001,
    root 0x40, subw 0x0, time 25794382, (1101,322), root:(1110,392),
    state 0x0, keycode 233 (keysym 0x1008ff27, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x3c00001,
    root 0x40, subw 0x0, time 25794453, (1101,322), root:(1110,392),
    state 0x0, keycode 233 (keysym 0x1008ff27, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:


Here you see that left has the keycode 234 and right 233. And there is no symbol assigned to the keys. This is what we did with the steps before, adding symbols to these keycode. The keycodes are mapped to special tokens in the file /usr/X11R6/lib/X11/xkb/keycodes/xfree86. There you find 233 mapped to <I69> and 234 to <I6A>. This is what we used before. Just in case these values change you now know how to find out...

Power saving

Laptop mode

The first thing that you should consider is the laptop mode. This is a feature of the Linux kernel that will help to conserve battery power. It though needs some add-on scripts to work well. Get the from http://www.xs4all.nl/~bsamwel/laptop_mode/tools/index.html. I build an RPM for the tools that I will provide on http://www.niemueller.de/projects/extrpms/ soon. After you installed this call chkconfig laptop_mode on and edit /etc/laptop-mode/laptop-mode.conf to fit your needs. The most parameters should have good defaults. What you need to do is set the parameter HD="/dev/hda". Now start laptop mode with service laptop_mode start and you are done.

Graphic adapter

If you use the default driver and not the ATI driver there is one option that you can set that may help to conserve some power. It will clock down the graphics adapter if it can. Add the line
        Option      "DynamicClocks" "on"
to the Device section of your /etc/X11/xorg.conf file.

Conclusion

The T41p is a really great machine which plays nicely together with Linux.
    Home     Contents     Search     View other revisions     Recent changes    




Top 5 Pages
Wiki
WebLog
Onager
SquidGuard Webmin Module
UniMatrix




Palm Software
UniMatrix UniMensa UniSorter
UniChat OHS Mobile Onager


My Bookshelf




Valid XHTML 1.1!

RSS Copyright © 2000-2016 by Tim Niemueller