Intalling Gentoo Linux on an IBM Thinkpad T43p



Jump within this page:
Model: IBM Thinkpad T43p, 2668-G2G, 
       14" display, IBM order number: UC3G2GE
Weight without CD drive: 2.15kg (4.74 lbs)

1GB RAM, 60GB HDD, 14.1 SXGA+(1400x1050) TFT LCD, 
128MB ATI FireGL V3200

I really love the T-series Thinkpads. They are small, powerful and work well with Linux. Too bad that IBM does not ship Linux pre-installed.  

Preparation

I use only Linux. Lenovo does not provide BIOS update possibilities for USB floppies (only real floppy drives attached to the docking station). There is also the problem that this type of notebook works only with harddisks which have a special IBM firmware loaded. It is therefore a good idea to keep XP to be able to still perform firmware and Bios updates if needed.  

The blue Access IBM button

The T43p has a little blue button which can be pressed at boot time. It offers mainly a backup and recovery system. Using a set of CDs/DVDs you can restore the harddisk (only windows).

Pressing the blue Access IBM button at boot time causes the PC to boot from a second harddisk partition which contains the recovery system (a win98 application?).

I created frist such a recovery system on CD/DVD. This would allow me to restore the harddisk later on in case the Linux installation/partitioning fails some how [Win XP->IBM access->Rescue and Recovery]. The best solution is to use one CD and one DVD. The CD is bootable and works even if you mess up the HD completly.

Warning: Using the restore harddisk function of the Rescue and Recovery CD/DVD re-partitions the disk and removes Linux. Don't use them once Linux is working.  

Patitioning

Create the above mentioned Rescue and Recovery (1 CD + 1 DVD) and then you are ready to start.
    Press F1 for BIOS and then select
    Security->Pre-desktop area
    
    Disable the Pre-desktop area. This will make more diskspace available. 
    You don't really need the Windows to HD backup if you run Linux.
    
Download the latest version of ntfsprogs (in my case ntfsprogs-1.12.1.tar.gz) and save them on an usb key. ntfsprogs 1.12 and higher can shrink the NTFS partition without defragmenting it. The ntfsresize on Knoppix did not have this function.

Uning an older ntfsresize and defargmenting NTFS from XP may not help if, as in my case. XP created two big clusters, one at the beginning and one at the end. It could not be convinced to combine the disk usage into one block at the beginning of the disk.
Disk layout before starting:

Disk /dev/sda: 60.0 GB, 60011642880 bytes
240 heads, 63 sectors/track, 7752 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        7685    58098568+   7  HPFS/NTFS
/dev/sda2   *        7686        7751      498960    c  W95 FAT32 (LBA)
    
Boot from Knoppix, compile ntfsprogs and run
ntfsresize -i /dev/sda1
This tells you how much disk space is used. 11GB in my case. Therefore I decided to go for a 12GB sda1 partition.
./ntfsresize  -s 12G /dev/sda1
Now the ntfs filesystem is only 12GB. Next we must change the partition table using fdisk.

Start fdisk and delete sda1. Recreate it with a size of 12000MB.

Now we need to move the "Access IBM" partition (sda2):
1) print the layout from fdisk (p)
2) delete sda2
3) create a new sda2 immediately after the now resized sda1 with
the same size as the original sda2 ("End minus Start" gives the block size
you need).
4) create a sda3 partition at exactly the same place as the original
sda2 (block 7686 to 7751 in my case)

Disk /dev/sda: 60.0 GB, 60011642880 bytes
240 heads, 63 sectors/track, 7752 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1551    11725528+   7  HPFS/NTFS
/dev/sda2            1552        1617      498960   12  Compaq diagnostics
/dev/sda3            7686        7751      498960   12  Compaq diagnostics

5) leave fdisk (w)
6) run 
     dd if=/dev/sda3 of=/dev/sda2 
   to copy the content over 
Now that the content of the "Access IBM" partition is copied we can start fdisk again and delete sda3 + create linux partitions:
Disk /dev/sda: 60.0 GB, 60011642880 bytes
240 heads, 63 sectors/track, 7752 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1551    11725528+   7  HPFS/NTFS
/dev/sda2            1552        1617      498960   12  Compaq diagnostics
/dev/sda3            1618        1750     1005480   82  Linux swap
/dev/sda4            1751        7751    45367560    5  Extended
/dev/sda5            1751        1790      302368+  83  Linux
/dev/sda6            1791        3987    16609288+  83  Linux
/dev/sda7            3988        7751    28455808+  83  Linux
Format the linux partitions with mkfs.ext3 and mkswap.

Shutdown Knoppix and boot into XP. It will perform a file system check. You can also boot into "Access IBM" to verify this function still works.
Disk /dev/sda: 60.0 GB, 60011642880 bytes
240 heads, 63 sectors/track, 7752 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
   /dev/sda1   *           1        1551    11725528+   7  HPFS/NTFS
   /dev/sda2   *        1552        1617      498960    b  W95 FAT32
   /dev/sda3            1618        1750     1005480   82  Linux swap
   /dev/sda5            1751        1790      302368+  83  Linux
   /dev/sda6            1791        3987    16609288+  83  Linux
   /dev/sda7            3988        7751    28455808+  83  Linux
The hardware model of the internal disk is a Hitachi disk:
HTS726060M9AT00
I ordered also a spare disk, HTS541060G9AT00, which I wanted to use in the UltraBay Sim HD adapter and as replacement if the main disk would ever fail. For this purpose I downloaded the firmware upgrade ISO image from www.thinkpad.com but it turns out that the firmware in original Hitachi disks can not be flashed despite beeing listed as supported models in the firmware upgrade kit! The more expensive Hitachi disks from IBM are not identical to the orignial disks from Hitachi despite having the same model name!

Now I can only use it in the UltraBay Sim HD adapter :-(  

Gentoo Linux installation

General

I used gentoo 2005.1. The installation is straiged forward and works well. The gentoo installation finishes when the Linux command line console is usable. Everything else has to be added later. I like that very much because I can tune the system as I like and I know also afterwards what is configured where.

The main advantage of gentoo is that you will later on (in 1 year, 2 years ...) always be able to install software new software whitout upgrading everything again. The price is that it takes much longer at the beginning.

Here is a list of packages which I have installed (this file will be updated from time to time): gentoo-t43p-packages.txt. This file was generated with the command "equery --nocolor list -i" .

You can use it to speed up your installation.

Gentoo package handling

The installation can be accellerated significantly by mounting the package-CD iso file at /usr/portage/packages with the "mount -o loop " commands.
Search for a package
emerge search substring_of_package_name

Check what would be installed:
emerge -k -p package_name

Do the install:
emerge -k package_name

List packages:
equery list
or
epm -qa
or
/usr/lib/gentoolkit/bin/qpkg

Check which files are contained in a package:
equery file package_name

List USE-flags:
equery uses package_name

Which package owns this file:
equery belongs /the/file
 

Hardware

The disk is a normal ATA laptop disk (Hitachi HTS726060M9AT00) but uses some ATA to SATA conversion feature. For this reason you need to use SCSI/SATA to access the disk with full speed and DMA.

The older IBM thinkpads (e.g my T20) used a harder type of plastic for the keyboard. This made the keyboard really durable. On this T43p I am approximately replacing the keyboard every second year. The keys become really slippery and shiny after about one year of intensive use and the space-bar stops working a year later. The part number for the US international keyboard for the 14" inch model is #39T0548.

You can use "smartctl -d ata -a /dev/sda" to check the SMART data of your disk (needs a 2.6.15 kernel).

For the rest of the Hardware see this lspci.txt file  

Kernel

I used 2.6.15 vanilla. With the following patches:
My Kernel .config file:
config-2.6.15.txt (normal vga console, suspend to ram with ati graphics works)

config-2.6.22.16.txt (framebuffer console, suspend to ram works on console but not when ati driver is loaded, need boot parameter vga=0x318 )

My grub configuration: grub_conf.txt  

CD/DVD access

I use the libata atapi feature to get DMA access for CD/DVD. Here is my grub.conf file. The important options are libata.atapi_enabled=1 and ide1=noprobe. The CD/DVD will then be /dev/scd0.

 

Sound

Sound works out of the box with alsa and the following modules (part of the standard 2.6.15 kernel):
snd_intel8x0m
snd_intel8x0  
snd_ac97_codec 
snd_ac97_bus 
snd_pcm      
snd_pcm_oss
snd_timer     
snd_seq
snd_page_alloc 
 

Graphics

I used x11-base/xorg-x11-6.8.2-r6 with the binary fglrx driver from ati. It was quite a headache to get suspend to ram working with the ati fglrx. The needed patches are listed below to save you the headaches.

To use the middle mouse button for pasting and emulate wheel scrolling at the same time you need to patch the xorg-x11-6.8.2 file xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c with this mouse_EmulateWheelTimeout_mouse_c_patch.txt patch.

My /etc/X11/xorg.conf file is: xorg_conf.txt
The t43p has a 14" monitor with a very high resolution of 1400x1050. The display is clear and sharp but you will have to use quite large fonts and this can be a problem with some webpages while surfing the net. Other resolutions are not really possible as this is an LCD monitor.

For the graphics driver I downloaded the ati-driver-installer-8.20.8-i386.run from ati.com and intalled it using the --install option to this shell archive.

3D graphics are fast and worked immediately (can be tested with fgl_glxgears)... but the driver crashed at every start of X11 with:
[fglrx] module loaded - fglrx 8.20.8 [Dec  6 2005] on minor 0
[fglrx] ACPI power management is initialized.
Bad page state at free_hot_cold_page (in process 'X', page c1103e20)
flags:0x80000414 mapping:00000000 mapcount:0 count:0
Backtrace:
 [<c013b9a1>] bad_page+0x81/0xc0
 [<c013c1c0>] free_hot_cold_page+0x70/0x100
 [<c0146064>] zap_pte_range+0x154/0x210
 [<c01461f3>] unmap_page_range+0xd3/0x150
 [<c014635d>] unmap_vmas+0xed/0x1a0
 [<c014a387>] unmap_region+0x87/0x100
 [<c014a6af>] do_munmap+0x10f/0x150
 [<c014a745>] sys_munmap+0x55/0x80
 [<c0103039>] syscall_call+0x7/0xb
Trying to fix it up, but a reboot is needed
[fglrx] free  PCIe = 54804480
[fglrx] max   PCIe = 54804480
[fglrx] free  LFB = 114208768
[fglrx] max   LFB = 114208768
[fglrx] free  Inv = 0
[fglrx] max   Inv = 0
[fglrx] total Inv = 0
[fglrx] total TIM = 0
[fglrx] total FB  = 0
[fglrx] total PCIe = 16384
Suspend to ram would also just freeze the complete machine at resume.

Solution to those problems:
  1. Go to /lib/modules/fglrx/build_mod/ and apply the following patch to the files firegl_public.c and agpgart_be.c: ati-fglrx8.20.8-patch.txt
  2. Rebuild the driver using the make.sh script from /lib/modules/fglrx/build_mod/ and install it
  3. It will complain about verify_area undefined in fglrx_agp.ko which can be fixed with the kernel module from
    http://www.colino.net/wordpress-1.5/archives/2005/10/29/fglrx-unknown-symbol-verify_area/
    but we do not need fglrx_agp.ko. Just fglrx.ko is used for the t43p with a FireGL V3200 card. Just the above patch is important.
  4. Add to your grub.conf file acpi_sleep=s3_bios e.g:
    kernel /kernel-2.6.15 acpi_sleep=s3_bios
  5. Reboot the after installation of the new fglrx and try suspend to ram with "acpitool -s" (resume by pressing the Fn key).


Update 2006-01-18: Ati has released a new version (ati-driver-installer-8.21.7-i386.run) but it has the same problems as above.
Update 2006-05-10: Ati has released a new version (ati-driver-installer-8.24.8-x86.run) which fixes all the above problems. No more patches are needed.  

powersave etc...

if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
    echo "setting cpu governor ondemand ..."
    echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
fi
The fglrx Ati driver has different power states.
Print states:
aticonfig  --list-powerstates

Set to powersave:
aticonfig  --set-powerstate=2 --effective=now
  
It is unfortunately not possible to control this permanently via the xorg.conf file.

The biggest power savers are on-demand CPU scaling and the above ati power save. It is also possible to spin down the disk. Here is a small script which uses the laptop_mode and reduces the commit interval of ext3. There is a whole set of tools around this laptop_mode but I rarely use the disk spin down and therefore I prefer a simple script:
#!/bin/sh
echo "setting 15min commit for ext3..."
# adjust those lines to your mountpoints:
mount -o remount,commit=900 /dev/sda7 /home
mount -o remount,commit=900,noatime /dev/sda7 /home
echo "setting laptop_mode 5sec..."
echo "5" > /proc/sys/vm/laptop_mode
# spin down after timeout:
hdparm -S 8 /dev/sda
  
To undo this I use
#!/bin/sh
echo "0"> /proc/sys/vm/laptop_mode
hdparm -S 0 /dev/sda
# there is no need to change the commit interval back
# but remember to shutdown properly otherwise you will
# loose 15min of work
  
 

acpid

At the moment I just use the "suspend to ram (=Fn F4, lid close) button via /etc/acpi/default.sh.

Here the /etc/acpi/default.sh file: acpi_default_sh.txt  

Suspend to disk

There is a problem that acpid does not generate any events anymore after the system came back from suspend to disk. Otherwise it is however working fine. Just configure the kernel .config option
CONFIG_PM_STD_PARTITION="/dev/sda3"
to point to a large enough swap partition (format it with mkswap).

In order to trigger the suspend to disk run "acpitool -S".  

Modules

Some modules are not automatically loaded because they are not directly needed by the corresponding hardware. Those need to be explicitly loaded at boot time.

My /etc/modules.autoload.d/kernel-2.6 file for loading modules at boot time:
# eth0 should be the wire. Load first
tg3
# modprobe sr_mod SCSI CD...
sr_mod
# modprobe ppdev ...
ppdev
# modprobe ibm_acpi ...
ibm_acpi
# modprobe hdaps ...
hdaps
#
  
The kernel module called ibm-acpi adds very useful things under /proc/acpi/ibm/  

Wlan

The standard kernel modules ipw2200, ieee80211 and firmware_class support the Intel PRO/Wireless of the t43p.

To actually use it you still need to download the firmware from: ipw2200.sf.net/firmware.php
and copy the .fw files to /lib/firmware/

The ipw2200-fw-2.4.tgz which was at the time of this writing the latest software. It is unfortunately very unstable. It is ok for webbrowsing but nfs and high volume applications will not work. I hope that Intel will fix this. The firmware restarts and you will always loose a few packets when this happens too often then the whole thing will die.
ipw2200: Sysfs 'error' log already exists.
ipw2200: Firmware error detected.  Restarting.
ipw2200: Sysfs 'error' log already exists.
ipw2200: Firmware error detected.  Restarting.
ipw2200: Sysfs 'error' log already exists.
ipw2200: Firmware error detected.  Restarting.
ipw2200: Sysfs 'error' log already exists.
ipw2200: Firmware error detected.  Restarting.
ipw2200: Sysfs 'error' log already exists.

Update 2006-01-19: The "Firmware error" problem is tied to WEP encryption. It can be solved by using
options ipw2200 hwcrypto=0
in modprobe.conf

The card does no longer cryptography in this configuration.

The ipw2200 driver disables the IPW_IOCTL_WPA_SUPPLICANT ioctl in the 2.6.15 kernel. Therefore you need to use the -Dwext driver from wpa_supplicant:
wpa_supplicant -w -c/etc/wpa_supplicant.conf -ieth1 -Dwext

I reported the firmware bug also to Intel but it looks like they are not able to find the fault in their firmware. It was first time reported in summer 2005 and since then nothing has changed.

Update 2006-02-22: ipw2200-1.0.13.tgz solves this problem (it has hwcrypto=0 by default) and has a fix for a dhcp not problem working which plagued version 1.0.11 and 1.0.12.  

Modem

Linuxant (http://www.linuxant.com/drivers) has a modem driver (hsf modem) which will work for PCI ID 8086:266D. I downloaded hsfmodem-7.18.00.07full.tar.gz. It will not work without patches. To patch it you need to install it first:
Unpack the tar.gz file
make install
hsfconfig --patch

I had two paches to choose from:
 1) class_device_parent    Yes    Support for the 2.6.15-rc1 kernel.
 2) refrigerator           No     Power management improvement.

Install both patches.

Edit cnxthw_common.c and add:
#include <linux/pm_legacy.h>

Run again:
make install

Then run
hsfconfig 
to configure the modem

Test it and then order a license to get full speed.

Problems: Power management does not work with this modem. The latop will not suspend to ram if the hsf modules are loaded and the modem was used before.

Here the /etc/init.d/hsf file: hsf_init_d.txt

Update 2006-02-09: linuxant has released hsfmodem-7.43.00.01full.tar.gz. This version works out of the box with the 2.6.15 kernel and does not need any patches. I find it really good that linuxant is so responsive.  

Finger-print login

The integrated USB Finger Print Scanner (Biometric Coprocessor from STMicroelectronics) works quite well but does really require training. The most important thing is to possition the finger everytime the same way.

An extermely good description (with gentoo ebuild files) on how to install it can be found here: http://toe.ch/~tsa/ibm-fingerprint/ (local copy)

All ebuild files and software for the bioapi in one tar file for easy download:
sys-auth_bioapi_2006-01.tar.gz

I have security-level="3" in /etc/tfmessbsp.cfg because 5 is too annoying.

The finger print reader works best if you have a slighly wet finger.  

Laptop Bag

I was for a long time looking for a small bag that protects the t43p. I don't want a bulky bag. Afterall I don't pay for a slimline T-series notebook to carry a bulky bag. I found the solution "Umates CPU Pouch Large": http://www.umates.com/uk/cpupouch-large.asp
This is a pouch made of material similar to a diver suit. It protects against bumps and scratches and does not increase the size of the laptop too much. It's ideal to carry the laptop in your rucksack.  

Improved cooling system

The t43p has basically the same hardware layout as the t40 but computing power has grown. IBM should have improved to cooling but probably due to the restructuring with Lenovo this did not happen.

Here is how I have solved the cooling problem: Guido's improved t43 cooling system
 

Fixing the thinkpad fan noise problem

The t43p and later models have all a manufacturing defect related to the fan.

For a description of how to fix the fan noise problem see Thinkpad fan-noise fix.
 

HDAPS

The HardDisk Active Protection Sytem (accelerometer originally invented to park the disc when the laptop falls). The driver for this accelerometer is available in the standard 2.6.15 kernel. The homepage is: http://hdaps.sourceforge.net/

Acceleration values can e.g be read at /sys/bus/platform/drivers/hdaps/hdaps/position and a temperature is available at /sys/bus/platform/drivers/hdaps/hdaps/temp1.

There is a gkrellm2 plugin called gkhdaps-0.0.1.tar.gz available from hdaps.sourceforge.net. To get it to work you need to change the SYSFS_TEMP_FILE define in data.c to point to the temp1 sysfs file. The .so plugin files must be copied to /usr/lib/gkrellm2/plugins/  

Using HDAPS as a notbook theft protection

The idea is that the accelerometer can be used to detect if somebody tries to carry the notebook way. For this to work you leave your notebook in state "on" on the table. If somebody comes and moves the notebook then an alarm will be generated.

The below scripts are based on http://thinkwiki.org/wiki/Script_for_theft_alarm_using_HDAPS. I have however modified them to use a simpler alarm procedure. By writing 15 to /proc/acpi/ibm/beep you can generate a constant alarm sound. In other words programming becomes easier as you can terminate the tp-theft script as soon as you detect a "theft". To stop this alarm a "0" has to be written to /proc/acpi/ibm/beep.  

Browser Backward and Forward keys

The thinkpad has some additional keys next to the arrow keys. Those keys can e.g be used as browser Backward and Forward keys.

Add this to your .Xmodmap file:
! t43p .Xmodmap file addon for your home directory
! the thinkpad extra keys, next to the arrow keys:
!keycode 233 = XF86Back
!keycode 234 = XF86Forward
keycode 233 = F20
keycode 234 = F19
! after changing run the command xmodmap ~/.Xmodmap

Now install http://extensionroom.mozdev.org/more-info/keyconfig

Quit firefox and add to ~/.mozilla/firefox/SomeThing/prefs.js the lines:
user_pref("keyconfig.main.goBackKb", "VK_F20");
user_pref("keyconfig.main.goForwardKb", "VK_F19");
 

Conclusion

The T43p is a very nice slimline laptop. IBM laptops have 3 mouse buttons something that is important and rarely found on any other laptop. Everything that I have tried works with no problems under Linux. In the past I had with other laptops the problem that sound or other services would not work after suspend to ram. Here everything works.

The fingerprint reader sounds like something really cool but it becomes rather annyoing to use over time because it often needs 2-3 retries until you are recognized. It's much faster to type a password.

IBM/Lenovo has however a real problem with their thermal design. The laptop fan is too loud and the cooling of north-bridge and south-bridge is not efficient. This is really disappointing.  

Links




TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones Linux On Laptops xtops.de Linux laptops   This page was written by guidosocher at gmail dot com
Wed May 17 20:03:07 CEST 2006