Gentoo GNU/Linux on IBM / Lenovo ThinkPad T43 266874G http://www2.informatik.hu-berlin.de/~pilop/HOWTO_Gentoo_T43/

THIS ARTICLE IS STILL UNDER CONSTRUCTION

The final (read: more complete) version is scheduled to first quarter of 2007.

Introduction

Looking around for a notebook that runs linux quite well can be hard. you cannot have everything you want. The most important features (random ordering) for me are:

  • huge screen resolution (I like much space)
  • compact design / little weight
  • power-management (suspend-to-ram / suspend-to-disk / frequency scaling)
  • integrated bluetooth

I spent some time to decide which notebook to buy, because I'm always looking for 100% native linux support. Thanks to Gina who answered my questions, I finally decided to buy the IBM ThinkPad T43 266874G in march 2006 and I'm quite happy with it. Unfortunatly it's not working everything out of the box, but almost. This modell fits my needs best.

This document should help other people looking for linux-support on ThinkPad T43. If you use another modell, you may still use some generic hints. Just take a look, which hardware is the same.

I tried "the new" way of installing gentoo by using the installer, which was a bit buggy. I think it's still better, to install everything the "classic way", which I did then.

As this document was written, kernel 2.6.15 was out, which works great. No more need to patch every feature in, so just

and configure it using my .config

Quick Hardware-Overview Hardware Components Status Notes Intel Pentium M (Dothan) 2.0GHz works Intel 915PM chipset works 14.1” TFT Display (1400×1050) works 80GB PATA HDD works uses libata (see below) DVD-ROM/CD-RW Combo works uses libata (see below) AC’97 Audio Controller works autodeteced by ALSA Broadcom NetXtreme BCM5751M Gigabit Ethernet (10/100/1000) works IBM Bluetooth 1.2 Module (Broadcom) works uses USB (internal) Atheros AR5212 802.11abg Mini-PCI WIFI works see below USB 2.0 Controller 82801FB/FBM/FR/FW/FRW (ICH6 Family) works UltraNav (TrackPoint / Touchpad combo) works see below ATI M22 Radeon Mobility M300 partly works DRI only tested with proprietary ATI-driver, xinerama not tested, external VGA only usable if Monitor attached during boot, S-Video not tested (see below) IBM Active Protection System (HDAPS) partly works see below 56K Modem not tested found by ALSA CardBus slot (Type 2) not tested ExpressCard/54 slot not tested IBM Embedded Security Subsystem 2.0 not tested I've no use for TPM, so it's deactivated in BIOS Integrated Fingerprint Reader not tested uses USB (internal) IrDA not tested Detailed description (of some things)Power Management (ACPI)Standby / Hibernate

Works out of the box (using my kernel-config) by writing mem or disk to /sys/power/state. Actually i'm just using standby which takes about 4 seconds instead of booting ;-) It consumes about 5% of it's running power, so a few days standby on battery is possible. Since kernel-versions greater than 2.6.16, hibernate (software-suspend) was moved to user space and my kernel fails to compile the interface. (config-option seems to be removed)

Proprietary ATI-drivers starting at version 8.32.5 seem to crash after resuming from standby. All tested versions since 8.23.7 were working perfectly, so I reverted to last working version 8.30.3. anybody with similar issue or a solution/fix: please .

Use my ACPI-handler below to enable standby / hibernate by pressing the special labeled FN+F4 / FN+F12 key.

CPU frequency scalingGraphics CardSATA HDD / DVD-ROMibm-acpi featuresAtheros AR5212 802.11abg Mini-PCI WIFI

I'm using the MadWifi-ng-driver, which works pretty well.

It will give you the physical wifi device as wifi0. Actually you cannot use it for wireless operations. Instead you have to create a virtual wifi device (e.g. ath0):

will create ath0 which you can use now as usually in station-mode (act as client). (This will be done automatically by gentoo, if the module is loaded)

VAP basics

You are not limited to only one virtual wifi device (only one can be in station-mode). In fact you even can use a different wlanmode on each virtual device. The only constraint I know of, is that they all have to share the same channel.

To create a virtual device as an AccessPoint use:

This will give you the next free athN device. To create a virual device in monitor-mode, which captures all traffic simply do:

Of course, you can remove virtual devices:

There's much more possible - just have a look at the wlanconfig manpage or the excelent MadWifi-Wiki.

Changing the MAC-address

Why changing the MAC? Some service providers (like Humboldt University Berlin) want to restrict wifi, so only registerd users are allowed to parcipate the net. The cheapest (and weakest) solution is to discard packets from divices not on a white list.

As a student at HUB you have register your wifi-card's MAC. Now imagine you own more that one mobile device (e.g laptop and wifi-capable smartphone) but it's not possible to register more than one MAC per account. Got it? Simply just register one MAC for all devices. The drawback is that you may not operate all devices at the same time (not tested yet), since it may confuse the internal network architecture.

The only trick is that you have to change the MAC of the physical device, while no VAP is defined. Afterwards you create a VAP that inherits this MAC:

WPA2-PSK with wpa_supplicant

Using WPA2 encryption with a PSK is quite simple. Install wpa_supplicant:

Configure it by creating /etc/wpa_supplicant.conf:

wpa_passphrase will help you to create the psk.

Tell gentoo that you want to use the MadWifi-driver on ath0 (if that's your virtual device in station-mode) by creating /etc/conf.d/net.ath0:

After symlinking /etc/init.d/net.lo to /etc/init.d/net.ath0 you can associate with your AP by:

IBM Active Protection System (HDAPS)UltraNav (TrackPoint / Touchpad combo)Advantages / DisadvantagesRessourcesHardware Config Scripts ACPI-handlerdescription

I've written some scripts to handle ACPI-events. Some of them are generic and could be used on other hardware, too but mostly they depend on ibm-acpi, which is part of the kernel since 2.6.10 (CONFIG_ACPI_IBM).

Here is a quick overview: (FN+Fxx-events can be triggered by pressing FN and Function-Key xx together)

Event Script Description FN+F3 /etc/acpi/toogle_backlight.sh Toogle Backlight (on/off) which saves power. IDEA: lock screen, too FN+F4 /etc/acpi/standby.sh Let's sleep: Suspend-to-RAM (and deactivate WiFi, to prevent problems) FN+F5 /etc/acpi/toogle_bluetooth.sh Toogle Bluetooth module (on/off) FN+F6 /etc/acpi/toogle_wifi.sh Toogle WiFi module (on/off) FN+F12 /etc/acpi/hibernate.sh Take a deep sleep: (software) Suspend-to-Disk (and deactivate WiFi, to prevent problems) BATTERY /etc/acpi/battery.sh Display warning, if battery is low / hiberate, if battery is almost empty

You may alter behaviour easily, or implement new features like standby on closing the lid (which I dislike). IDEA: control frequency-govenor through FN+Fxx keys (powersave, conservative, performance)

download

Simply download ibm-acpi-eventhandler.tar.bz2 and install the files into /etc/acpi (assuming, ACPI-support is enabled and working).

Some of the scripts take advantage of other installed software packages, or my own helper-scripts. Mainly dependencies are very basic, like sh, grep, sed, cat, echo, test, logger which should be found on any linux-system. while acpi still makes sense, you will need xosd to get graphical feedback. To switch off the backlight I'm using radeontool.

Theft-Alarmdescription

As it's a cruel world and mobile devices are easy to steal you may want to secure your laptop. Since Kensington locks are not secure, perhaps you cannot avoid theft. But at least you can try by letting your laptop "scream for help".

My idea is to use a couple of sensors your laptop comes with. If any of them reports a changed state, we assume someone moves your laptop away. Our only chance is to persuade the thief that it makes no sense running away with a laptop that makes awfull noise.

The script is kept modular, to plug-in new sensors easily. There are three states:

  1. INACTIVE (passive state, do nothing - default)
  2. ACTIVE (armed)
  3. ALARM (awfull noise)

In INACTIVE state (default after startup) the laptop can be used mobile as usual. The screen is not locked (by xscreensaver). There may be a token (e.g. a bluetooth phone), which switches to ACTIVE state, if not in range. This way the screen automatically gets locked and the laptop armed.

In ACTIVE mode, which you may enter manually by locking your screen, all available and configured sensors will switch to ALARM state, if any change is detected. This may include the following:

  • HDAPS (laptop is in motion, when taken away)
  • power supply (plug disconnected on theft)
  • battery removed
  • ethernet link (cable disconnected on theft)
  • USB-token (tie down a pendrive to something not portable)
  • lid (you have to open the lid to hack / power down)
  • wifi peers (when your laptop is leaving the area, your AP will stay) [not implemented yet]
  • ...

The only way to disarm and change back to INACTIVE state is to unlock the screen, by knowing your password.

In ALARM state the speaker volume is raised up to the max and will beep. Additionally your soundcard may do the same. The state changes back to ACTIVE, if all sensors report their reference values. Some more ideas are:

  • unmount crypto-disks (to lock your private data)
  • try to send emergency signals (detect network, send mail (GPS?), broadcast bluetooth help messages)
  • schedule self-destruction
  • ...

The sensors are not limited to hardware supported by the T43. But in fact I got the idea, playing around with HDAPS.

I've to mention that this approach will not stop anyone from stealing your laptop. It will only try to get attention of other people around to become aware of a crime. It only will work when your laptop is powered on (and the script is loaded) and has enough battery. If someone is fast enough to power down your laptop in advance, or killing AC and battery, probably nobody will notice anything. So at least you should restrict access to boot the laptop with a password only. This way a thief won't have much fun with it. (or the knowledge of breaking it)

download

theft-alarm-1.0.tar.bz2 (2006-05-09)

This script is currently stable, while more plugins are in development. It was tested on my T43 and some other 'not-ThinkPads' so far, so any is welcome.

To learn more about this script and its plugins, read the description above, see README, or take a look at the plugins.

NOTE: after starting the script it's default state is INACTIVE, so no theft-checks are done, until it's put in ACTIVE state (e.g. by a locked xscreensaver). For debugging purposes the plugin DEBUG_LOCK.sh switches to ACTIVE state when the file /tmp/ta.lock exists.

some helper-scripts

Currently my stuff from /usr/local/. Grab the needed scripts, if some of the above scripts need them.

They are short and commented...

LinksLinux installation guides for ThinkPad T43'sgeneral informationThinkWiki: http://www.thinkwiki.org/wiki/Category:T43IBM ThinkPad T43 ressources