I needed a laptop. My old brand-less el-cheapo 3D less 300Mhz Uniwell E320S was falling apart. Its LCD cable was breaking up, the case cracking, etc. For some time I had my eyes set on an IBM Thinkpad and only thought it would be a dream to own a IBM Thinkpad T40p.
Having never used eBay UK or any other online auctioning site I knew to get the laptop I wanted with the kind of money I was on, eBay was my only option. It was time to loose my virginity to eBay.
To cut a long story short, my first time was good, not messy nor pre-mature and very memorable. eBay was gentle to me and understanding, the outcome of this quick behind the bike sheds action I got myself what is £3500 worth of laptop here in the UK for a mere £1400.
<quagmire>Dear Diary.......Jackpot.....</quagmire>
I went to pick up the laptop with the Debian XFS enabled boot CD, a Nokia Monitor Tester called NTEST (also available here) which runs fine under WINE, MemTest86 and my friend with his laptop to test the infrared port. Turns out that MemTest86 does not work (or rather it did not at the time) with the Pentium-M chips by default as the cache sizes are unknown but all the rest of the tests passed.
Recently my root partition got corrupted after a nasty kernel oops with a ‘special’ I wrote. I had to start everything from scratch and as a result I was able to do a much cleaner install and get everything right first time. Also X.Org now works, I managed to work out how to get the x.org packages from Ubuntu Linux, which is based on Debian, whilst keeping everything non-X related Debian specific. As well as this everything (except the built in security chip) works; wifi, bluetooth, ACPI (I actually wrote my own DSDT for more thermal sensors and fan information), IBM hotkeys, hibernation, suspend, 3D DRI acceleration. The lot!
Configuring the BIOS is very straight forward, most of it you can decide however I would recommend you use the following settings:
To install Debian on the laptop I used the Debian XFS Enabled ISO (for all your information, for what its worth, the copies of the XFS boot image there I had before the Debian servers were comprimised having matching MD5 sums to the ones avaliable on that website; regardless of the warnings), mainly as I am a devoted follower of XFS. After using this ISO, although old it works, you simply continue after the reboot with the regular disks as when you would normally install Debian; whether its off the CD set or from the Internet. Using this special ISO is simply a case of using as you would the regular vanilla ones with the exception that when you initialize (aka format) your partitions you use XFS instead of ext2.
You have to make a difficult decision and decide whether you want the extra 4GB of un-usable disk space at the end of the harddisk known as the ‘pre-desktop’ area. This is IBM's version of the ‘restore to default factory settings’ that lots of laptops have. In my book having a 4GB blotch to reinstall WinXP which was disposed of with good reason is a waste. I understand though there are strange folk who think WinXP is a Good Idea™; I personally think its a Bad Idea™.
If you wish to keep this ‘partition’, I say partition as its actually an unmarked void at the end of your harddisk, then you would of left the BIOS protecting this area as per my instructions above. If you plan to scrub the ‘void’ then you can at this point scrub everything and use the whole harddisk blindly (make sure you configure the BIOS not to protect this region firstly); if you wish to keep it then do not touch it and partition everything before this ‘void’.
The partitioning setup I used was as follows:
| Name | Flags | Type | Size (what I asked for) | Mount Point |
|---|---|---|---|---|
| hda1 (Primary) | Boot | Linux | 61.94 MB (64 MB) | / |
| hda5 (Logical) | Linux Swap | 766.41 MB (768 MB) | n/a | |
| hda6 (Logical) | Linux | 4095.23 MB (4096 MB) | /usr | |
| hda7 (Logical) | Linux | 1021.88 MB (1024 MB) | /var | |
| hda8 (Logical) | Linux | 32010.86 MB (whatever remained) | /home | |
| hda3 (Primary) | Plan9 | 2051.49 MB (2048 MB) | /mnt/plan9fat |
N.B. for those curious about Plan 9 I will at some stage be releasing instructions on how to install Plan 9 on a Thinkpad T40p will radeon support and everything; its not easy, believe me.
This setup has served me well since, and I have used similar layouts on my other Linux installations as have my friends. Some people may wonder what I do not have a /boot partition, this is because there really is no point when your root partition is tiny like mine; in my setups the root partition falls below the 1024 cylinder limit.
As I have a small root parition (64MB) I manually initialise it to get the logfile (journal) as small as possible, this is done by going to a console and typing:
# mkfs.xfs -l size=904b /dev/hda1
I tried with a smaller blocksize however it seems the Linux port of XFS does not support different blocksizes, also the 904b is as the smallest logfile is 904 blocks.
Really you need a good /etc/fstab file, and so being the nice person I am you can have mine as a starting point.
To make sure you maintain a Debian system in a mixed environment I had a solid read of the Apt-Pinning for Beginners and came up with the following:
/etc/apt/
|-- apt.conf
|-- apt.conf.d
| `-- 70debconf
|-- preferences
`-- sources.list
As I live in the UK I am using the UK Debian mirror however you should consult the Debian mirrors list to find out which one is most suited to you to edit your /etc/apt/sources.list. You of course can add more apt-get repositories, you will probably want to look around the Unofficial APT Repositories.
Please edit your /etc/apt/sources.list file as appropriate to point to your local mirror. This is for two reasons, one your downloads will more than likely be faster and secondly it also helps distribute the load around the world and lighten the usage on international bandwidth pipes.
My flatmate was always a purveyor of GRUB, I was more of a LILO kinda guy. Probably as LILO is Debian's choice however after much arm twisting and the fact I was having a few problems with LILO I opted for GRUB. So ‘aptitude remove lilo; aptitude install grub’ it was. I placed my /boot/grub/menu.lst where it should be and then typed (as root):
mkdir /boot/grub
cp /usr/lib/grub/i386-pc/stage1 /usr/lib/grub/i386-pc/stage2 /usr/lib/grub/i386-pc/xfs_stage1_5 /boot/grub/
grub-install --recheck /dev/hda # ctrl-c after a minute has passed
grub
root (hd0,0)
setup (hd0)
quit
After this you should be GRUB'ed up. After this I have to say that I really can not live without GRUB. Its just far more convenient and bullet proof than LILO; hopefully in the next version of Debian they move to using GRUB by default.
To get CD burning working all you need in kernel 2.6.x is to have IDE-CD (CONFIG_BLK_DEV_IDECD) enabled and edit /etc/cdrecord/cdrecord to say CDR_DEVICE=/dev/cdroms/cdrom0.
Unfortunately this is a necessary evil as the BIOS has some of the ACPI parts fixed (I am going to e-mail IBM at some stage with the rest of the fixes) and the Embedded Controller stops making Linux throw a wobbly. Luckily as evils go,you need only to run WINE to extract the disk image from their downloads. Once you have these images you burn them to a CD and boot off the CD on the laptop. Of course if you have opted to run Windoze on the laptop (shame on you) you can just run the utilities straight off.
Go to IBM's T40 downloads page and download the non-diskette versions of the ‘BIOS Level’ update and also the ‘BIOS Embedded Controller Program’; you can skip on the ‘SRCMOS RDM Utility’ unless you really do want to remotely play with your BIOS :)
When you run these programs (use
‘$ wine <program>.exe’) only go as far
as agreeing to the Terms and Conditions, and then immediently press Ctrl-Z to
suspend the installation process. At which point it would have extracted a
bunch of files. These files you will find in your Windoze TEMP directory
(usually /tmp/<something> or whereever you have opted to put
C:\TEMP or C:\Documents and Settings\<user>\Local Settings\Temp) in a sub-directory. Inside this directory you will find a 1.4Mb-ish
<something>.IMG file, this is the disk boot image which we will be burning
to a CD, copy this file somewhere safe and then exit the update utility; the
directory will now be deleted. Now repeat the same for the other update
utility.
I opted for a custom BIOS bootsplah screen as IBM went too far once they started to put some horrible “Intel Centrino” logo also on bootup. The one which simply stated ‘IBM’ and ‘Thinkpad’ was rather nice and accepted. Anyway I have made logo.bmp file available which shows my home address and contact details incase I ever lose the laptop or it is stolen. If you do want to make your own I would highly recommend you have a look at the good instructions on the ThinkWiki website, however it does not mention the constraints:
Once you have these files they will now need to be burnt to a CD, as the Thinkpad T40p has no floppy drive (IBM sometimes really do silly things), and make that file on the CD the bootable image. The following instructions describe how to use cdrecord with mkisofs. However once you have built the bootable CD's, you simply boot off them and they do the rest; of course I recommend you use a CD-RW if possible otherwise you are wasting 600MB CD's to store 1MB for a once off!
Lets say you currently have the two files (in my case 1RUJ11US.IMG was the BIOS image whilst 1RHJ05US.IMG was the Embedded Controller one) in a directory somewhere called ‘upgrades’.
alex@inskipp:~$ cd upgrades
alex@inskipp:~/upgrades$ ls -l
total 2880
-rw-r--r-- 1 alex staff 1474560 Oct 27 14:37 1RHJ05US.IMG
-rw-r--r-- 1 alex staff 1474560 Oct 23 11:19 1RUJ11US.IMG
alex@inskipp:~/upgrades$ mkisofs -b 1RUJ11US.IMG -o bios.iso 1RUJ11US.IMG
Size of boot image is 2880 sectors -> Emulating a 1440 kB floppy
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
896 extents written (1 Mb)
alex@inskipp:~/upgrades$ mkisofs -b 1RHJ05US.IMG -o embedded.iso 1RHJ05US.IMG
Size of boot image is 2880 sectors -> Emulating a 1440 kB floppy
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
896 extents written (1 Mb)
alex@inskipp:~/upgrades$
We have now created two CD ISO images, one called ‘bios.iso’ and the other ‘embedded.iso’ which now need to be burnt to a CD-R(W).
The CD-R(W) images are now ready, boot with the Embedded Controller firstly and then after than has been upgraded, upgrade with the BIOS CD-R(W).
I have been concentrating solidly on the 2.6 kernels for a number of reasons:
My .config file, which you can place straight (renaming the file to ‘.config’ first) into a un-tarred kernel source tree (however please use your local mirror). Then type ‘make menuconfig’ and once you have saved the configuration (you can exit and save straight away) then type ‘make -j2’. After some time you will cook yourself the new kernel (in /usr/src/linux-2.6.x/arch/i386/boot/bzImage) and the modules can be installed by typing ‘make -j2 modules_install’ as root.
Since around kernel 2.6.0-test6 all the various patches I previously had to apply to make sure ACPI did not oop's the kernel, make various battery and temperature readouts work and also get both the trackpoint and touchpad working with all the buttons; are now all present. The only patches I now apply are (in order):
I would also recommend you use my /etc/modules file.
Other quirks with kernel compiles are:
Since kernel test9-ish there has been no need to patch the kernel to support all the features of the Touchpad and so all you need to do is tell ‘gpmconfig’ when run as root to read from ‘/dev/input/mice’ using the ‘autops2’ protocol whilst having X11 also reading from ‘/dev/input/mice’ using the ‘ImPS/2’ protocol.
‘glxgears’ gives me over 2000fps of pure goodness and Wolfenstein: Enemy Territory works fantastically. Of course to do this you will need X.Org (if you have used my /etc/apt/sources.list file you should already be okay), the Radeon DRI Open Source drivers and my /etc/X11/xorg.conf file. The order to install this all is:
# if some version of X is already present you will need to first run:
dpkg --force-depends --purge xserver-common libxdmcp6 libxpm-dev xcompmgr libxmuu1 libxinerama1 lsb-base libxp-dev xbase-clients libxss1 libxext-dev libxkbfile1 xlibmesa-glu netbase xorg-common libxrandr-dev libxv-dev libxxf86dga1 libxext6 xterm libxtst-dev libxpm4 pm-dev libxi-dev xserver-xorg libxrandr2 libdmx1 libsm-dev libxcomposite1 libice-dev libxv1 libdps1 libxtrap6 xlibmesa-glu-dev libxxf86misc1 xlibs libxt-dev libxkbfile-dev libxi6 xfonts-base xlibs-static-dev libxfixes3 libfs6 libxmu6 libxdamage1 libxaw7 libxaw8 xfonts-75dpi xvfb xfonts-75dpi-transcoded libxau-dev libx11-6 xlibmesa-gl xutils xlibmesa-gl-dev libxmuu-dev libx11-dev libxtrap-dev libxp6 libxkbui1 xlibs-data xlibs-dev libxtst6 libice6 libsm6 libxxf86vm1 libxmu-dev x-dev libxt6 libxau6 xfonts-scalable xfonts-cyrillic x-ttcidfont-conf
aptitude -t hoary install xserver-common libxdmcp6 libxpm-dev xcompmgr libxmuu1 libxinerama1 lsb-base libxp-dev xbase-clients libxss1 libxext-dev libxkbfile1 xlibmesa-glu netbase xorg-common libxrandr-dev libxv-dev libxxf86dga1 libxext6 xterm libxtst-dev libxpm4 pm-dev libxi-dev xserver-xorg libxrandr2 libdmx1 libsm-dev libxcomposite1 libice-dev libxv1 libdps1 libxtrap6 xlibmesa-glu-dev libxxf86misc1 xlibs libxt-dev libxkbfile-dev libxi6 xfonts-base xlibs-static-dev libxfixes3 libfs6 libxmu6 libxdamage1 libxaw7 libxaw8 xfonts-75dpi xvfb xfonts-75dpi-transcoded libxau-dev libx11-6 xlibmesa-gl xutils xlibmesa-gl-dev libxmuu-dev libx11-dev libxtrap-dev libxp6 libxkbui1 xlibs-data xlibs-dev libxtst6 libice6 libsm6 libxxf86vm1 libxmu-dev x-dev libxt6 libxau6 xfonts-scalable xfonts-cyrillic x-ttcidfont-conf
aptitude install wdm fluxbox # notice it gets them from Debian Unstable
/etc/init.d/wdm start
If you have opted to use my config files you should be able to simply fire up ‘wdm’ with the above.
My /etc/X11/XF86Config-4 file. The order to install this all is:
When you wish to update the drivers its just a case of ‘aptitude upgrade’'ing and then repeating the final two steps above whilst X11 is not running.
If you use my above TV enabled /etc/X11/XF86Config-4 file, you will also need the atitvout package compiled from source to flip between TV out (as root: ‘./atitvout -f t’) and regular LCD out (as root: ‘./atitvout -f l’).
The difference in battery usage between when the back light is at full brightness and minimal brightness is a whooping 17% (this I gained from polling /proc/acpi/battery/BAT0/state with ‘watch -n1 cat /proc/acpi/battery/BAT0/state’). The laptop when doing nothing uses about 12W (when playing OGG's it uses roughly an extra 1W) at 600Mhz.
The cute keyboard light uses only 50mW, which is nothing when compared to the 60Wh my battery can store. Unfortunately apparently the full capacity of 70Wh is a thing of the past. :(
*****************************************
According to the README files that come with the BIOS update utilities the memory that is available to such things needs to be adjusted a little. These adjusts need to be made to your /etc/pcmcia/config.opts which is detailed in the file and this is done so that nothing goes ahead and clashes with anything the BIOS has its greasy mitts on.
I have not actually got a PCMCIA Cardbus/PC-Card to use as I got myself a Thinkpad with all the bells and whistles. I cannot see why it would not work as everything looks okay and is detected correctly.
Sound support with Debian and the T40p is dead easy. With my kernel config file you should have all the drivers that you need to get the soundcard up and running, so all you should need to do is install:
# aptitude install alsa-base alsa-headers alsa-oss alsa-utils alsaplayer alsaplayer-alsa alsaplayer-common alsaplayer-gtk alsaplayer-oss
Installing these packages will let you have everything you need to have the computer configure your soundcard and remember your mixer settings, plus also let the dmixer support kick in; which will then let you play several sounds streams simulateously without have a hunky-chunky and naff userspace sound daemon (such as ‘esd’) clogging up your system.
When the Debian configuration screen kicks in you should be able to select the ‘intel8x0’ soundcard driver, if you fail with then then you can just use my /etc/modutils/alsa-base file and then as root type ‘depmod -a; /etc/init.d/alsa restart’.
To get DMixer to work you really just need a valid ~/.asoundrc file OSS programs should be wrapped with ‘aoss <program>’ whilst ALSA enabled software should have the sound-out device set simply to ‘dmixer’ instead of ‘default’.
When you compile the kernel you will need to make sure you have enabled CONFIG_NSC_FIR (and also CONFIG_ISA to be able to select the option). After that its a simple case of adding ‘nsc-ircc’ to /etc/modules (no need if you use mine) and ‘options nsc-ircc nsc-ircc irq=3 dma=3’ to /etc/modutils/99local (again no need if you use mine) get the FIR part of the IrDA port working.
Having said that you will find that the port is only able to transmit (I am yet to confirm this with a digital camera though) and not receive. Using the tool ‘irdadump’ shows only outgoing traffic. My friend had a similar problem on his Thinkpad laptop, a much older model, however he was able to resolve this by reverting to the SIR (slower and compatible) drivers. I am yet to try this but I really want to use the FIR drivers.
This is actually quite easy to get working and just a case of downloading the drivers (I however have gone for the unsupported drivers, it seems ‘slmdm == slmodem’) and compiling them.
********************
A rather handy facility to is automatically add people to particular groups if they log in physically to the machine. The useful groups are added are ‘audio’, ‘floppy’, ‘video’ and ‘cdrom’. To do this simply use (and of course amend to suit your needs) the following files.
/etc/pam.d
|-- chfn
|-- chsh
|-- common-account
|-- common-auth
|-- common-password
|-- common-session
|-- cron
|-- cvs
|-- login
|-- other
|-- passwd
|-- ppp
|-- samba
|-- ssh
|-- su
|-- sudo
|-- vlock
|-- wdm
|-- xlock
`-- xscreensaver
/etc/security/
|-- access.conf
|-- group.conf
|-- limits.conf
|-- pam_env.conf
`-- time.conf
All that needs to be done is to have the kernel module ‘ide-cd’ loaded (already done if you use my /etc/modules file). Also edit your ~/.mplayer/config file to contain the line “dvd-device = /dev/cdroms/cdrom0” and this simplifies everything.
Once you have compiled and installed mplayer (the only media player worthy enough to be on a UNIXeque OS) you should be able to just type ‘mplayer dvd://<x>’ where <x> is a number between one and however many chapters there are on your DVD, you will have to use trial and error this until you find the correct one to get the movie. :) Bear in mind that as mplayer on the fly works out the decryption key it can take a significant amount of time to start the movie, however one started once mplayer caches the decryption key and future invocation with the DVD are instant.
Now-a-days there are Debian packages avaliable for mplayer if the thought of compiling it is daunting.
If you have compiled NVRAM support into your kernel then you can also type as root ‘aptitude install tpb’ and if you add yourself to the ‘thinkpad’ group (by typing ‘addgroup <user> thinkpad’) when you log into X you will find when you press the brightness and volume buttons you will be in for a surprise. If you have followed my instructions on getting PAM on the fly to add you to the group on a local login then this is not required.
I have included my /etc/tpbrc file so you can see what I do with my laptop. The really only great thing I have done with this is so when you press the otherwise pointless blue ‘Access IBM’ button an x-terminal will appear. You might want to tweak this for your own needs but I find it very useful and convienent.
One problem some of my international chummies have found out is that tpb can complain with:
unable to initialize xosd, Running without onscreen display
If you strace the problem (‘strace tpb 2> errors.dump’), from the relevent section you get
open("/usr/share/locale/fr_FR@euro/LC_MESSAGES/tpb.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/fr@euro/LC_MESSAGES/tpb.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/fr_FR/LC_MESSAGES/tpb.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/fr/LC_MESSAGES/tpb.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Unable to initialize xosd. Runni"..., 60Unable to initialize xosd. Running without onsceen display.
The problem is due to locale codepages or something not being found. You should edit /etc/X11/Xsession.d/90tpb and change the line:
TPB=/usr/bin/tpb
to instead:
TPB="LANG=en /usr/bin/tpb"
A addition suggestion is to install the ‘xfonts-base-transcoded’ package and use the font ‘-*-lucidatypewriter-*-*-*-*-*-240-*-*-*-*-*-*’.
Here is all the various spiel that I can pull out of my laptop:
Below I have included a list of things I have found that make using the IBM Thinkpad T40p, not a life in heaven..... :-/ Sound of these are IBM specific, however some seem to occur on many laptops; although I feel for £3500 they should not.
| [yyyy/mm/dd] | stuff happened....... |
|---|---|
| [2005/01/26] | After a root parition corruption ‘session’ I started completely from scratch and got everything working perfectly, except for the internal security chip. A month later I started feeling guilty having not told the Linux community anything about my tweaks. I uploaded this today however I will shortly be adding more |
| [2004/03/22] | Kernel 2.6.4 is out and I have played with lots of things. I now have ALSA working in ‘dmixer’ mode so that I can now play with several different sound sources all at once, for example use XMMS whilst playing with MAME. I have removed the WiFi and Ethernet loading parts from /dev/modules as moved those entries into /etc/network/interfaces. Debian have finally released the udev package everything has been migrated to udev. Recently I have been playing with Software Suspend Version 2 and actually have managed to get the laptop reliably going in and out of hibernation. I will soon write up what I did however there are still some module reloading issues that should be resolved before I unleash it onto the public, the main one being that the usb system is completely deactivated on restart :-/ I also found out that I should for the graphics card be using the ‘r200’ driver rather than the ‘radeon’ driver; also now I have found out that whenever the X-libraries are updated then the DRI package needs to be recompiled. More fun has been had with the TV-out, especially now that I own my own S-Video/SCART cables which saves me having to pester a friend all the time for his. I will put up instructions at some stage however much like the hibernation part things are still rather on the rougher side of rough round the edges. After now using the laptop for a good number of months I thought it was about time to have goddamn annoying bits about the T40p. I am starting to play with the built in security chip (using the Enforcer package) and will let you know how I get along with it. I have a view to use it in combination with my crypto filesystem, however no way am I going to patch GRUB to use it :) I might even see if there is a way to get it to rope into the OpenSSL/SSH packages, plus of course setup a tripwire system; I will keep you informed once I work things out. |
| [2004/02/20] | Kernel 2.6.3 is now out and I worked out, due to the release of UT2004, how to get 3D DRI working properly; the problem was that I was not reading the instructions properly and skipped installing the ‘trunk’ packages. Added instructions for Bluetooth as well, although things seem a little unreliable once again :( The e1000 patch is no longer required now to get correct stats from the interface. Another nice thing I noticed is that Debian unstable now has XFree86 4.3.x in it, so there is now no longer any need to use the experimental tree. Since my last update I also got around to making the fonts look gorgeous under X11 through XftConfig/XF86Config-4 tweaking, details on this are now lurking under the fun section |
| [2004/01/03] | A New Year with updates to the site, especially now that 2.6.0 is out. As well as an update I also got myself a link on TuxMobil |
| [2003/11/09] | Noticed that for no reason my site was appearing on Google, felt obliged to update it |
| [2003/09/20] | Website released to the public |
| [2003/09/07] | Begun to write website |
| [----/--/--] | Work through trying to get as much of the laptop working under the Linux kernel 2.6 series and Debian Unstable before I produce a website |
| [2003/08/23] | Persuade flatmate to drive me up and collect the goods. I go equiped with memtest86 and stacks of other testing equipment, plus of course a Debian XFS Boot CD. WinXP disappears en route back to the BPL ;) |
| [2003/08/11] | I win the bid for a smooth £1,412.99 and get a free bag (eBay Link) |
| [2003/08/04] | Although still an eBay virgin I found a T40p 2373G1G on offer, get serial numbers and find everything is legit and only four months old....“excellent Smither's” |
| before [2003/08/04] | Dreamt of one day owning a £3500 IBM Thinkpad T40p |
me me and me again
Although I might of not gotten around to detailing above, the only things that remain to work-out are:
My name is Alexander Clouter (pronounced ‘Clue-ter’ as opposed to ‘Clow-ter’, its a ‘bou-quet’/‘buck-et’ thing you know ;) You can get in touch with me by e-mail, remember to remove the ‘junk-this’ bit in the e-mail address. Or if you want via instant messaging:
|
|
Web Hosting very kindly provided by
|
|---|