Lenovo T400
This is a description of installing Gentoo (amd64) Linux on a Lenovo T400 notebook. The T400 is the 14.1" version of the well known business T-series notebooks. Since introducing the new models in summer 2008 Lenovo offers widescreen displays only. My major demands on a new notebook have been:- It should be relatively small and handy. A battery runtime of noticeably more than 3 hours. High quality chassis. With other words: a mobile notebook.
- The screen resolution has to be noticeably higher than 1280x800.
- It will be my main computer. Therefore it should offer good performance, but not necessarily in graphics domain.
- Finally, there has to be good Linux support.
Changelog
- 2011-11-21: Clean up xorg.conf.d files
- 2011-03-26: Adding 2.6.38 kernel config, adding kernel parameters for radeon, updating xorg configuration
- 2010-11-21: Adding tempinfo.sh
- 2010-05-21: Adapting content to vga_switcheroo
- 2010-05-08: Removing '.sh' for the acpi event file names
- 2010-03-28: Update info on xorg's and AMD's driver for the ATI graphics card
- 2010-03-01: Note on switchable graphics, reviewed sleep.d and acpi scripts
- 2009-12-12: Kernel 2.6.32 config, widely distributed minor updates.
- 2009-12-10: Update xorg-conf init script
- 2009-11-08: Cleanup some notes on really old package versions.
- 2009-09-26: Update infos on keymap, xrandr, intels virtual size
- 2009-08-07: Linking to Gentoo Intel GMA site, note on KMS
- 2009-07-30: Font DPI issue
- 2009-07-28: Some notes on fingerprint sensor
- 2009-07-26: Temperature sensors
- 2009-07-24: Gzip kernel configs, note on hdaps and tp_smapi
- 2009-07-19: Info on Load_Cycle_Count problem
- 2009-07-05: Updates on ati-drivers, xf86-video-ati, and new 2.6.30 kernel config
- 2009-06-29: Linguistic improvementes
- 2009-04-24: Patch of ati-drivers for 2.6.29 kernel
- 2009-04-21: Update btn-lock.sh script and xorg-conf init script.
- 2009-04-10: Adding a new kernel config. Some intel graphic notes.
- 2009-04-07: Adding xorg-server-1.5 notes and files
- 2009-03-16: Note on transflective display
- 2009-03-05: Initial version
Specification
The model number of my notebook is 276521G and the order number is NM321GE. The German specification site of this model is available at the IBM website. A summary is given in the following:- Centrino 2 chipset, ICH9 family
- Intel Core 2 Duo Processor P8600, 2.4GHz, 3MB L2 cache
- 1GHz FSB, 2GB DDR3 RAM at 1066MHz
- WXGA+ TFT, 14.1", 1440x900 pixels
- Internal graphics: Intel GMA X4500HD (IGP) max.384MB shared memory
- Discrete graphics: ATI Mobility Radeon HD 3470 256MB
- 250GB SATA hard disk, WDC WD2500BEVS-08VAT1
- UltraBay Slim DVD writer for CD-R(W), DVD-R(W) double layer, DVD+R(W), DVD+R double layer
- 7-in-1 card reader
- V.90 modem
- Intel WiFi 5300AGN, Intel 82567LM Gigabit Ethernet
- Firewire: Ricoh Co Ltd R5C832 IEEE 1394 Controller
- Broadcom ThinkPad Bluetooth with Enhanced Data Rate II
- UMTS modem: Ericsson F3507g Mobile Broadband Minicard Composite Device
- AuthenTec Inc. fingerprint sensor
- 6 cell battery with 56 Wh
- 2.13kg, 31.9 x 335 x 238 mm
Support overview
Generally speaking the Lenovo notebooks, especially the ThinkPads, have excellent Linux support. Actually, there is no device that did not work for me by now. However, I have not yet tested the Bluetooth module, UMTS modem, fingerprint sensor, and the V.90 modem.
Component | State |
WXGA+, VGA, dual-head | Works |
WLAN, kismet, Ethernet | Works |
DVD-writer | Works |
Card reader | Works |
Firewire | Not yet tested |
ACPI, special keys | Works |
Suspend, hibernate | Works |
V.90 modem, Bluetooth, UMTS modem | Not yet tested |
Microphone | Works |
Fingerprint sensor | Not yet tested |
Anyhow, other test reports tell us that all the untested components from above should work. In particular, the finger print sensor is supported by the thinkfinger project. The following references provide more in-depth details:
- ThinkWiki.org: an absolute must-have for all Linux users owning a ThinkPad.
- Gentoo-Wiki an article on installing and configuring a T400 and related models.
- ArchWiki: a detailed discussion on configuring a T400 on ArchLinux.
Installing Gentoo Linux
Unfortunately the 2008 Gentoo installer CD lacks of support for the SATA CD-drive. Hence, you have to use another Linux Live-system for booting and installing. In my case I downloaded an Ubuntu 8.10 DVD and followed the Gentoo Wiki instructions. I assume you decided to install the amd64 architecture using stage3 tarballs. You can basically jump directly to the chapter 4 of the Gentoo handbook and we assume that an internet connection is already working. In chapter 6, you have to mount /proc and /dev in a different way than listed in the Gentoo handbook, namely If you are using a gcc-4.3 or newer, you can select core2 as march for the CFLAGS. Hence my make.conf results in something like the following listing. Since our processor accommodates two cores we want to set at least -j3 in the MAKEOPTS variable to enable up to three simultaneous compilation jobs. Configuration files: Some additional notes:- For some reasons related to udev my fresh installed system caused extremely long delays while booting. I solved the problem by removing the files `/etc/udev/rules.d/70-*`. They will be restored correctly after a reboot. However, this could also be related to the installation of baselayout-2 and openrc.
- Deactivate switchable graphics before installing Linux. See the note below in the Graphics section.
- The 64bit support under Linux is very good. Even java and flash-plugins have been made available for 64bit Linux systems.
- You can make use of the multiple cores when compiling the kernel by calling "make -j 3".
- For all config files KMS has been activated per default
- It is sometimes reported that the parameters 'radeon.audio=0 radeon.modeset=1' should be passed to the kernel in grub.conf
Graphics, xorg
Many ThinkPads are actually shipped with two graphics adapters built in, known as switchable graphics: The so-called internal adapter (Intel GMA X4500HD (IGP) max.384MB shared memory) and the co-called discrete adapter (ATI Mobility Radeon HD 3470 256MB). Currently only Windows Vista (or later) is able to switch between both adapters on-the-fly. For all other operating systems a reboot and a subsequent change in the BIOS settings is necessary. However, since the release of the Linux kernel 2.6.34, support for switching the graphics adapter at runtime got available, see below.Intel chip
I almost constantly use the Intel chip since I rarely need high 3D performance. Regarding the Intel chip the package x11-drivers/xf86-video-intel driver is pulled in when "intel" is added to make.conf's variable VIDEO_CARDS. There is a very informative Gentoo wiki site on the Intel GMA.ATI chip
The ATI chip can be used with at least two different drivers: the xorg open source driver (x11-drivers/xf86-video-ati) and the closed source driver (x11-drivers/ati-drivers). I once had both installed bit for a while I use the closed source drivers only.- xorg's driver: Currently, I have xf86-video-ati installed
which is pulled in when adding 'radeon' to VIDEO_CARDS in
/etc/make.conf. (I had reoccuring problems when
updating to new kernel versions and AMD had not updated their
proprietary driver already.) The xorg driver has good working 3D
support and performance is getting better from version to version.
You may want to visit the RadeonFeature and the Radeon 3D acceleration Portal sites of xorg.
- AMD's driver: I once had the package ati-drivers installed by adding 'fglrx' to VIDEO_CARDS in /etc/make.conf. The proprietary driver from AMD has currently a much better 3D performance but is constantly incompatible with new kernel versions. Nevertheless, the proprietary drivers undoubtely exhibits the better performance.
xorg-server
For the current stable xorg-server hal support has again been replaced by udev, which is good. The current xorg-server version has the ability to save configurations for devices in /etc/X11/xorg.conf.d, see for example here and here.Summarizing, I placed the following files in /etc/X11/xorg.conf.d/
10-hdaps.conf
80-synaptics.conf
90-keyboard.conf
And finally, these are my actual xorg.conf files, which are quite short once one uses xorg.conf.d-files to manage input devices. Note that the actual xorg.conf is generated by my script vga_switch.sh by concatenating, say xorg.conf.intel, with xorg.conf.common, see below.
/etc/X11/xorg.conf.intel
/etc/X11/xorg.conf.radeon
/etc/X11/xorg.conf.common
Performance
As already known for the i810 Intel graphics chip, better performance is gained if color depth is set to 16 Bits in xorg.conf. The difference in glxgears is about 400 fps from 1200 fps to 1600 fps. In contrast using the ATI chip results in about 4200-4400 fps. However, glxgears is not a serious benchmark for graphics chips. But, like everywhere in life, better performance comes with another drawback: the ATI chip consumes about 10W more power than the Intel chip.KMS (Kernel mode setting)
If you use a xorg-server of at least version 1.6 you can gain from a new feature called KMS. With KMS the kernel is responsible for setting resolutions and the like and not the xorg server any more. Within this change a very fast and potential more stable switch from a virtual terminal to a X session is gained. Beside that there is no need to use a framebuffer for higher resolutions on virtual terminals. See the Gentoo wiki of the Intel GMA for more info. Since recently, I am using KMS for the Radeon card, too. However, I recommend a recent kernel and xorg's graphics driver for that purpose.Please note that I have activated KMS for the Intel card per default in my 2.6.30 kernel config. So if you use my kernel config you either disable this option, our you use at least xorg-server-1.6.
Automatically switching xorg.conf
Once someone wants to use both chips we have the problem that the xorg.conf has to be exchanged according to the currently enabled graphics chip. I solved the problem by writing a little init.d script and a shell script /usr/local/bin/vga_switch.sh which is doing that for me. Note that 'vga_switch.sh' has now support for vga_switcheroo, see below./etc/init.d/xorg-conf This script also generates a xorg.conf by xorg.conf.common and xorg.conf.{intel,radeon}. Note that you will need the file 'getXenv.inc', which is provided at this site. To call this script at boot time execute the following command:
Switching graphics at runtime
With Linux kernel 2.6.34 support for switching graphics adapters at runtime became available. The corresponding code is called 'vga_switcheroo' and has been developed by David Airlie. The kernel config for 2.6.34 listed on this site activates the support for vga_switcheroo. In order to make vga_switcheroo working it is necessary that (i) the Intel and Radeon drivers support KMS and have been integrated directly into the kernel, (ii) support for debugfs is activated. Further, I had to activate detection of primary console (CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY); otherwise I got a blank screen some time. The scripts 'vga_switch.sh' already brings the support for changing the graphics adapter, see above.I configured acpid to execute 'vga_switch.sh --gui' when pressing Fn+F3. A gui using kdialog pops up and asks to which adapter one wants to switch to. You can select one adapter and then the kernel waits until you logout and X is restarted. After that kdm reappears and X is up with the selected graphics adapter. Calling 'vga_switch.sh' without an argument tells you the current powering state.
Dual head, mirroring
With current xrandr packages (or grandr, or krandrtray) setting up dual head or mirroring with an VGA-connected monitor can be done on-the-fly. However, note that (at least for Intel chip) the Virtual screen size is per default limited to 2048x2048. Hence adding a 1024x768 display to the 1440x900 LVDS panel does not fit. You can override this settings in the xorg.conf. There is a good description of xrandr-1.2 at thinkwiki.org. Interestingly, for some time I am using version 2.8 of the intel drivers and the virtual size is now 8192x8192 for some reason.If you want to set up the Fn-key combinations appropriately, you may want to setup ACPI properly. (See later section for that.) I use the following configuration:
/etc/acpi/events/btn-fn7
/etc/acpi/events/btn-fn9
/etc/acpi/actions/btn-vga.sh
/etc/acpi/actions/btn-vgapause.sh
/usr/local/bin/getXenv.inc
Multimedia keys
There are several explanations for setting up the multimedia keys for the T400 notebook, like here, here, or here. The latter also links to a more detailed tutorial.As a shortcut you may want to add the following file:
/etc/X11/Xmodmap Update: It seems that the buton now work without setting the keymaps obove. So I recommend to test them before applying the recommended settings from above.
By the way, the ThinkLight which illuminates the keyboard with a led on the top of your display works via BIOS mechanisms and has not be setup. Also the kmilo plugin for KDE works for me. It display via an OSD changes in brightness of the display or volume settings. Also the power button works out of the box. However, it took me a week to find out that I have to press the button about a second for a shutdown. My old notebook reacted instantly. But be aware that if you press the button several seconds then the notebook will simply be powered off, without shutting down cleanly.
Font sizes
In my case KDE, gvim, thunderbird and virtually all applications show unusable font sizes. To fix this, you can add the following line to the given file. See this information from Mozilla for further infos./etc/X11/Xresources
As an alternative one could also set this value via the "Fonts" properties in 'kcontrol'. Anyhow, the solution above is much cleaner, since it applies also to non-KDE environments.
Framebuffer
I formerly used vesafb as framebuffer to increase the screen resolution at the virtual terminals. However, when activating the ATI chip my kernel was not able to boot: display got black and then the notebook rebooted. Removing the vga kernel parameter "fixes" the problem. But since I use KMS now for the Intel graphics there is no need for a vga kernel parameter to gain higher resolution.Transflective Display
There have been some speculations of Lenovo having built in transflective displays in the T-series of the Thinkpads. Interestingly, I have never found some official information from Lenovo on that stuff. Even though one could expect heavy marketing for such a feature. However, there is definitely something going on with the panel on my notebook. Reports stating that one could use the T400 outdoor without backlight in the same way as with backlight are clearly wrong (at least for my model). However, if I turn off the backlight, one can percept the content on the display. (Ok, that was possible, to some extent, for my old notebook too. But this panel has a much better contrast for that test case.) However, I do not expect someone to use that constantly for his work. On the bottom line, I would call that possibly a semi-transflective display...Energy consumption, suspend/hibernate
My 6 cell battery has a capacity of 56Wh powering the notebook for about 4-5 hours when doing non energy consuming tasks. If I turn off WiFi, bring the TFT brightness to 30% and use the ondemand frequency governor the energy consumption comes down to about 12-13W. Installing laptop-mode-tools can bring down power consumption to approximately 10-11W. By the way, I recommend using more recent versions of laptop-mode-tools since they have better support for recent hardware, like the wireless card of the T400. Using the ATI graphics adapter instead of the Intel internal graphics adapter adds about 10W to the total power consumption. See some German notes on the ATI card for details.On the T400 both, suspend and hibernate, works without the tuxonice patchset. While KDE's klaptop applet was already able to trigger suspend and hibernate, I installed sys-power/pm-utils for making that available from command line. The most important commands are pm-hibernate and pm-suspend and they worked out of the box. A short 45' experiment reveals about 390mW power consumption in suspend mode. If you use pm-utils, you can place scripts in /etc/pm/sleep.d/ which are called after resume, suspend, hibernate, et cetera. In particular, I use the following scripts:
/etc/pm/sleep.d/90vga_switch
/etc/pm/sleep.d/20lockscreen
/usr/local/bin/lockkde.sh
Load_Cycle_Count problem
Too aggressive power management properties of the hard disk can lead to a frequent number of so-called "load cycles". However, hard disks are only built for a specific number of such load cycles. This problems, in some variants, have been frequently described on various places. See for example here, here and here.The problem can sometimes be recognized by click-sounds from the hard disk. You can simply check if your system is affected by calling
This shows us, that in the mean my hard disk performed 127 load cycles per hour! This is far too much! The hard disk used in this notebook is specified at the website of Western Digital. Summarizing, my hard disk is specified for 600.000 cycles and in the last half year it performed 200.000 of them. However, my old notebook even performed 1.2 Million cycles up to now.
To temporarily this problem you can call The output tells us first that the APM parameter is at 128 and then we set it to 254. This parameter controls the power management behaviour of the hard disk. Unfortunately, after a power state change of the notebook (for example suspend to ram) this parameter is reset to 128, and the hard disk shows the old behaviour. (I guess this is done by the BIOS.) My solution is the following: Install laptop-mode-tools and check that the file '/etc/pm/sleep.d/99laptop-mode' has been created. (Do not use too old versions of laptop-mode-tools.) This file re-applies laptop-mode-tools settings after resuming. Further, configure in '/etc/laptop-mode/laptop-mode.conf' the parameters LM_AC_HD_IDLE_TIMEOUT_SECONDS and LM_BATT_HD_IDLE_TIMEOUT_SECONDS to a higher value. With recent versions of laptop-mode-tools this has been changed from 5 to 20 as default. However, I use 60 on my notebook. Do not forget to enable CONTROL_HD_IDLE_TIMEOUT!
You want to check if the settings work by monitoring the idle notebook (no IO performing tasks running) with the following command:
The tools lm-profiler (included in the laptop-mode-tools package) and iotop show you IO performing tasks.
ACPI
It is recommended to activate the IBM resp. Thinkpad related ACPI capabilities in the kernel. In my '/etc/conf.d/modules' I set the line 'modules_2_6="acpi-cpufreq thinkpad_acpi"' for enabeling ACPI and additional IBM features. For example you may want to inspect '/proc/acpi/ibm' where you can (de)activate bluetooth, WiFi, ThinkLight, et cetera. To use the Fn-keys for suspending and hibernating my notebook I added the following files. Do not forget to make the action scripts executeable./etc/acpi/events/btn-fn2
/etc/acpi/events/btn-fn3
/etc/acpi/events/btn-fn4
/etc/acpi/events/btn-fn12
/etc/acpi/actions/btn-lock.sh
/etc/acpi/actions/btn-suspend.sh
/etc/acpi/actions/btn-hibernate.sh
/etc/acpi/actions/btn-battery.sh
Temperature sensors
Using the thinkpad_acpi kernel module, a file '/proc/acpi/ibm/thermal' is offered which looks for example like this:- CPU neighbourhood: This value is identical to the one reported by '/proc/acpi/thermal_zone/THM0/temperature'. However, ACPI reports that THM1 is the CPUs temperature. Both strongly respond on launching CPU consuming tasks, where THM1 does this even faster. However, this value also responds on hot air at the cooling gill.
- Ultrabay: Blowing hot air at the dvd drives location leads to a response on this sensor.
- Express card: Blowing hot air at the express card location leads to a response on this sensor.
- ATI graphics: Choosing discrete graphics in BIOS changes this value from -1 to a reasonable value which responds on launching fgl_glxgears. If you have no ATI card installed, you get -128.
- Main battery: Value changes to -128 if battery is removed. However, this value is almost always at about 50 and only sometimes changing. On the other hand I heard of T400 with a 9 cell battery having values around 34.
- Ultrabay battery? At thinkwiki.org there is a conjecture for the T500 that this could be the corresponding value to sensor no. 5 for the ultrabay battery. I have no such battery, so I could not test this.
- Main battery: Value changes to -128 if battery is removed. This value correlates much better with '/sys/devices/platform/smapi/BAT0/temperature'.
- Ultrabay battery? See the note above.
- Hard disk: Blowing hot air at the hard disks location leads to a response on this sensor. However, the value is a few degrees below the one reported by 'smartctl --all /dev/sda'. The reason might be that SMART reads the hard disks sensor which is inside the hard disk. This corresponds to the observation that the SMART value is responding much slower.
- Intel graphics: This value strongly responds on calling 'gtkperf' if integrated graphics is selected in BIOS. Even if ATI graphics card is selected in BIOS, this value is provided.
- Heatsink? This conjecture is due to the entry for the T500 at thinkwiki.org. Nevertheless, this value responds on CPU load and hot air at the cooling gill, but much slower than value no. 1.
Modules tp_smapi and hdaps
As an owner of a Lenovo T400 you may probably be interested into the modules tp_smapi and hdaps. The former one controls the so-called SMAPI-BIOS build in, which itself controls for example in-depth battery settings and the latter one is used for accessing the built-in acceleration sensor. There is a detailed website at thinkwiki.org.I recommend to set the hdaps use-flag such that the hdaps module is installed too. Further, the module thinkpad_ec needs the parameter "force_io=1". Therefore, my /etc/conf.d/modules file contains the lines