Gentoo Linux On a Dell Latitude E5400 Laptop

Installing and running Gentoo Linux on the Dell Latitude E5400

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at http://www.gnu.org/licenses/fdl.txt.

June 27th, 2009

Revision History
Revision 0.5August, 28th 2009
Remarks on keyboard (Qt and dead keys on Greek keyboard layout)
Revision 0.4July, 3rd 2009
Keyboard and touchpad
Revision 0.3June, 30th 2009
Sound, SD card reader, CPU
Revision 0.2June, 28th 2009
DVD/R+W tested and described
Revision 0.1June, 27th 2009
Initial release

Table of Contents

1. Introduction
1.1. Summary
1.2. Conventions
1.3. Important Configuration Files
1.3.1. Kernel Configuration
1.3.2. /etc/make.conf
1.3.3. /etc/X11/xorg.conf
1.4. Status Of This Document
2. Mass Storage
2.1. Internal Hard Drive
2.2. DVD/R+W
2.3. SD Card Reader
2.3.1. Kernel Configuration
2.3.2. Mounting
3. Networking
3.1. Network Card
3.2. Wireless (WLAN) Card
3.2.1. Kernel Configuration
3.2.2. Hotplugging and Firmware
3.2.3. Network Configuration and wpa_supplicant
3.2.4. Troubleshooting
3.2.5. Stability
4. Graphics System
4.1. Pre-Flight Checklist
4.1.1. X11 Related Things In /etc/make.conf
4.1.2. DBUS
4.1.3. The Hardware Abstraction Layer Daemon - Hald
4.1.4. Initialize X11
4.2. Graphics Card
4.2.1. X Configuration
4.2.2. Hardware 3D Acceleration - DRI
4.3. Display
5. Input Devices
5.1. Xorg and Hal
5.2. Keyboard
5.2.1. X11 configuration
5.2.2. Dead Keys in KDE/Qt
5.2.3. Console Settings
5.3. Touchpad, Pointing Stick, and Mouse
6. Other Devices
6.1. Sound
6.1.1. Kernel Configuration
6.1.2. ALSA Configuration
6.1.3. Troubleshooting
7. CPU
7.1. Kernel Configuration
7.2. Compilation Options
7.3. ACPI
7.3.1. Suspend
7.3.2. Hibernation
7.3.3. CPU Scaling
8. See Also

1. Introduction

This guide should give you a complete walk-through for getting Linux to run on the E5400 laptop or others from the Dell Latitude E series. It is focussed on Gentoo Linux, and the Latitude E5400, but it is probably useful for other distributions, and other laptops from the Latitude E series, like E5500, E6400, and E6500.

The Dell Latitude E5400 replaced my older Latitude D820, which became dodgy recently, with spurious monitor failures. The first impression did not exactly make me ecstatic. Compared to the D820, the new gadget looks cheap, and not half as classy as its predecessor. On the other hand it is very light (2.49 kg plus 0.45 kg for the AC adaptor, your milage may vary depending on the exact production configuration), silent, and everything functional.

All sockets and connectors are on the sides of the device, the rear side is not used at all. The reason for this will remain a secret of the designers at Dell.

The coolest thing is actually the power supply. The plug has a very stylish blue, glowing LED ring as an indicator. Looks great, especially at night.

Apart from that, I'm not exactly happy with the notebook. The wireless is not working stable, it currently crashes (and freezes!), when watching videos with VLC, it has issues with the display, and - very annoying - the fan is almost constantly running. I could only manage to turn it off by cooling it externally. I would not recommend the notebook to anybody.

1.1. Summary

This is an overview of the hardware in my E5400:

Table 1. Hardware

TypeVendorModelDataState
Hard driveSeagate Momentus 7200.3 ST9160411ASGS-ATA 160 GB, 7.200 r/pmworks as /dev/sda
DVD/R+WPhilips & Lite-On Digital Solutions Corp. (PLDS)DS-8A3S Rev. HD11 works as
Network cardBroadcomNetXtreme BCM5756ME Gigabit Ethernet PCI ExpressGigabitworks out of the box with the Tigon3 (tg3) driver
Wireless (wlan) cardIntelWireless WiFi Link 5100802.11a/g/nworks with the iwlagn driver, but unstable
Graphics cardIntelGMA 4500 MHD-works out of the box with xf86-intel-video driver
DisplayDell 14.1” WXGA+ (1440x900)works out of the box
Sound chipIntel  works with the hda-intel driver
Bluetooth   not yet tested
USB ControllerIntel82801I (ICH9 Family)3xUSB UHCI, 1xUSB2 EHCIworks out of the box
SD Card ReaderRicohR5C847 works
PCMCIA (CardBus Bridge)Ricoh Co. Ltd.RL5c476 II (rev ba) can't test
FireWire (IEEE1394)Ricoh Co. Ltd. R5C832 (rev 04) can't test
CPUIntelCore 2 Duo P86002.40 GHzworks out of the box
KeyboardDell German keyboard layout (qwertz)works out of the box
Mouse, TouchpadALPSAlpsPS/2 ALPS DualPoint TouchPad basically works

1.2. Conventions

Commands are formatted like this: ls -l, filenames like this: /etc/passwd.

Longer commands, or content of text files are formatted as a block:

$ lspci | grep Broadcom
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5756ME Gigabit Ethernet PCI Express

In such blocks, lines starting with a dollar sign ($) are commands that can or should be executed as an unprivileged user. Lines starting with a hash sign (#) are either commands to be executed as root, or sometimes comments in files. If you cannot tell from the context, better not type anything at all.

1.3. Important Configuration Files

If you got stuck, my central configuration files may be of interest for you.

1.3.1. Kernel Configuration

Download: config.txt.

Make sure that /usr/src/linux is a symbolic link to your actual kernel source directory, and then install the file as /usr/src/linux/.config. Even if your kernel version does not exactly mine (check line 3 of the config file for my version), you can probably still use it as a starting point. Just don't forget to run "make menuconfig" so that the file fits your kernel.

Then go on as follows:

# make clean
make menuconfig
make -j3
make modules
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-guido

In /boot/grub/menu.list have an entry like this:

title=Kernel configuration by Guido Flohr
root (hd0,5)
kernel /boot/vmlinuz-2.6.30-gentoo-r4 root=/dev/YOUR_ROOT_PARTITION_GOES_HERE

Make sure that you fill in the correct root partition (copy it from other entries?). And, of course, you can use other identifiers wherever I refer to my name.

If you wonder why there is nothing said about init ram disks or file systems (initram or initramfs), well, simply under normal circumstances you just don't need that. It only complicates kernel building.

1.3.2. /etc/make.conf

Download: make.conf.txt.

This is my /etc/make.conf. You should only use that for informational purposes because it will almost certainly not fit for your own system.

1.3.3. /etc/X11/xorg.conf

Download: xorg.conf.txt.

You should install this file as /etc/X11/xorg.conf, and please make a backup before. The file fits for the WXGA+ display (maximum resolution 1440x900). There are other E5400 flavors with a lower resolution of 1280x860. Please check that before you use the file.

Please note that I have a German keyboard layout. Please change the layout from "de" to yours or check the chapter Keyboard for better instructions how to change that.

1.4. Status Of This Document

This document is currently work in progress. Take it as my private protocol of installing Gentoo on the system, and getting all hardware that I need to work with it. Some sections are currently missing. If a section that you desperately need is still missing, drop me a line at guido.flohr@cantanea.com.

2. Mass Storage

2.1. Internal Hard Drive

My E5400 came with a 160 GB Seagate Momentus 7200.3 (model ST9160411ASG) hard drive. As all S-ATA drives it appears as SCSI drive in Linux systems, as block device files /dev/sda, /dev/sdb and so on.

The linear read throughput of the disk ranges from 45 to 90 MB/s, measured with zcav. You can download the raw data from here.

See that the performance for the outer tracks is a lot better than that on the inner ones. That is the reason why the performance of the first hard disk partitions is better than that of the last ones. You should keep that in mind, when planning your partion scheme.

2.2. DVD/R+W

The internal DVD reader and writer works out of the box for reading and writing both DVDs and CDs at acceptable speed.

The hardware seems to be a pretty much standard S-ATA DVD/R+W. If you have trouble writing DVDs or CDs, make sure that you are in the group "cdrom" and can actually access the device (/dev/sr0 most likely, and the soft links /dev/dvdrw and /dev/cdrom).

2.3. SD Card Reader

The SD/MMC card controller identifies itself as follows:

$ lspci | grep Ricoh
02:01.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
02:01.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)
02:01.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)
02:01.3 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 11)

The same chip also controls the cardbus bridge and the FireWire controller.

2.3.1. Kernel Configuration

Device drivers  -->
<M> MMC/SD/SDIO card support  -->
    ...
    <M> MMC block device driver (NEW)
    [*]   Use bounce buffer for simple hosts (NEW)
    ...
    <M> Secure Digital Host Controller Interface support
          <M> SDHCI support on PCI bus
                <M> Ricoh MMC Controller Disabler  (EXPERIMENTAL)

Recompile the kernel and reboot.

2.3.2. Mounting

As soon as you plug-in a supported SD card, you should see a new block device /dev/mmcblk0 pop up in your syslog (/var/log/messages):

mmc0: new SD card at address 9ffc
mmcblk0: mmc0:9ffc SD01G 968 MiB 
mmcblk0: p1

The naming scheme is /dev/mmcblkDpN where D is the card-reader device (0 .. n) and N is the partition number (1 .. n) on that device. The command ls -l /dev/mmcblk* should give you the idea.

If hald is running and properly configured, you should see that hald already mounted the device for you.

3. Networking

3.1. Network Card

The Broadcom Corporation NetXtreme BCM5756ME Gigabit Ethernet PCI Express worked out of the box with the Tigon3 (tg3) driver. Your kernel should be configured as follows:

Device drivers  -->
  [*] Network device support  -->
      ...
      [*] Ethernet (1000 Mbit)  --->
          ...
          <*> Broadcom Tigon3 support

For Gentoo you should make sure that the symbolic link /etc/init.d/net.eth0 exists and points to /etc/init.d/net.lo.

3.2. Wireless (WLAN) Card

My E5400 shipped with an Intel Wireless WiFi Link 5100. It identifies itself as:

# lspci | grep 4232
0c:00.0 Network controller: Intel Corporation Device 4232

3.2.1. Kernel Configuration

As far as I know, support for the Intel Wireless WiFi Link 5100 is relatively new. It is present in my kernel (2.6.29), but you have to turn on experimental features in your kernel:

General setup  -->
  [*] Prompt for development and/or incomplete code/drivers  -->

You have to enable the mac80211 subsystem:

[*] Networking support  -->
    [*] Wireless  -->
        <*> Generic IEEE 802.11 Networking Stack (mac80211) 

The iwlwifi project provides the drivers Intel Wireless WiFi Link devices. You have to activate the core and the Next Gen AGN driver:

    Device drivers  -->
    [*] Network device support  -->
        Wireless LAN  -->
        [*] Wireless LAN (IEEE 802.11)
            <*> Intel Wireless WiFi Core
            [*] Iwlwifi RF kill support
            [ ] Enable full debugging output in iwlagn driver
            <*> Intel Wireless WiFi Next Gen AGN
            [*]   Enable Spectrum Measurement in iwlagn driver (NEW)
            [*]   Enable LEDS features in iwlagn driver (NEW)
            [ ]   Intel Wireless WiFi 4965AGN (NEW)
            [*]   Intel Wireless WiFi 5000AGN (NEW)

3.2.2. Hotplugging and Firmware

Before you reboot, you should install the hotplug system because the wlan device requires loading a piece of firmware.

# emerge hotplug

Then you have to emerge the package net-wireless/iwl5000-ucode:

# emerge iwl5000-ucode

This will install the file iwlwifi-5000-ucode-VERSION.tgz in /lib/firmware/ so that the hotplug system can find it, when the kernel driver requests it. You go on with installing wpa_supplicant:

3.2.3. Network Configuration and wpa_supplicant

# emerge wpa_supplicant

Then you want to make the new device known to the system:

# ln -s net.lo0 /etc/init.d/net.wlan0

Go ahead with configuring wpa_supplicant. First add the following two lines to /etc/conf.d/net:

modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"

See the manpage wpa_supplicant(5) for the meaning of the option. Finally, configure your wireless connections in /etc/wpa_supplicant.conf. The following example illustrates how to configure wpa_supplicant to first try to connect to an access point with the SSID "private_idaho" with WPA-PSK2, and then to any unsecured network:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0 
eapol_version=2 
update_config=1 

# This is a network block that connects to any unsecured access point. 
# We give it a low priority so any defined blocks are preferred. 
network={ 
    key_mgmt=NONE 
    priority=-9999999 
}

network={ 
    ssid="private_idaho" 
    scan_ssid=1
    psk="PASSPHRASE_GOES_HERE" 
    # Pick either WPA or WPA2 (latter preferred, of course) 
    #proto=WPA 
    proto=WPA2 
    key_mgmt=WPA-PSK
    pairwise=TKIP 
    group=TKIP 
    priority=2 
}

Restart your system, and you should be able to connect to your access point. Of course, there are a zillion other ways to set this up, but this setup works. If you you don't use the wireless permanently, you can compile the driver as modules (at little avail, however). Or you can use wireless-tools instead of wpa_supplicant.

3.2.4. Troubleshooting

If things do not work, you should check the other end. Is the access point present at all? You can either check from another machine, or emerge wireless-tools and try to scan your neighborhood with iwlist scan.

If /etc/init.d/net.wlan0 start complains about:

network interface wlan0 does not exist
Please verify hardware or kernel module (driver)

Check again your kernel configuration. One possible reason is that you forgot to add support for the IWL 5000 type of card.

As a last resort you should check messages in the syslog /var/log/messages (search for "wlan"), and if you cannot find anything scan the output of dmesg. You should find something like this:

[ 0.516501] iwlagn: Intel(R) Wireless WiFi Link AGN driver for Linux, 1.3.27ks 
[ 0.516609] iwlagn: Copyright(c) 2003-2008 Intel Corporation 

If that is all that the iwlagn driver says to you, the device was not recognized. Check the kernel configuration and make sure that the wireless switch at the front of your E5400 is in "on" positionn (you cannot see the red background). A sane output from dmesg looks like this:

[ 0.516501] iwlagn: Intel(R) Wireless WiFi Link AGN driver for Linux, 1.3.27ks 
[ 0.516609] iwlagn: Copyright(c) 2003-2008 Intel Corporation 
[ 0.516737] iwlagn 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17 
[ 0.516843] iwlagn 0000:0c:00.0: setting latency timer to 64 
[ 0.516884] iwlagn: Detected Intel Wireless WiFi Link 5100AGN REV=0x54 
[ 0.538689] iwlagn: Tunable channels: 13 802.11bg, 24 802.11a channels 
[ 0.538908] iwlagn 0000:0c:00.0: PCI INT A disabled 
[ 0.539040] wmaster0 (iwlagn): not using net_device_ops yet 
[ 0.539288] phy0: Selected rate control algorithm 'iwl-agn-rs' 
[ 0.539368] wlan0 (iwlagn): not using net_device_ops yet 
[ 0.539716] console [netcon0] enabled

A little time later, the driver should try to load the firmware from userspace:

[ 23.845389] iwlagn 0000:0c:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17 
[ 23.845463] iwlagn 0000:0c:00.0: restoring config space at offset 0x1 (was 0x100102, writing 0x100106) 
[ 23.845554] iwlagn 0000:0c:00.0: irq 29 for MSI/MSI-X 
[ 23.845611] iwlagn 0000:0c:00.0: firmware: requesting iwlwifi-5000-1.ucode 
[ 23.956067] iwlagn loaded firmware version 5.4.1.16

And after that you should see how it authenticates with the access point. If the WiFi LED is lit, the kernel driver should have recognized the hardware. Good luck!

3.2.5. Stability

The wireless connectivity is quite unstable here. I use a WRTGL54 1.1 Linksys router, and I often lose the connection to the router. I also have routing problems in the internal network: I can route package from any machine in the internal network to the wireless interface of the E5400 but not back. Routing packets to and from the internet via the router works, however, so it could well be a router problem.

Googling suggests that this is apparently a hardware problem, as it happens with other operating systems as well. I have to do some more testing with other routers, and maybe try it out with the MS-DOS 7 installation on the same machine.

4. Graphics System

4.1. Pre-Flight Checklist

If you experience strange or unpleasant behavior like unresponsive mouse or keyboard, freezes, and so on, when X starts for the first time, you should check this section.

4.1.1. X11 Related Things In /etc/make.conf

Check that your /etc/make.conf contains the following:

VIDEO_CARDS="intel"
    INPUT_DEVICES="keyboard mouse evdev synaptics"
    

Especially the "evdev" entry in INPUT_DEVICES is very important. Without it, you will have no working mouse and keyboard, when starting your graphical system. After these changes, make sure that all your X related stuff is compiled with the right options.

# emerge --newuse --deep --update world

4.1.2. DBUS

You should have DBUS up and running:

# emerge dbus
# rc-update add dbus default
# /etc/init.d/dbus start

4.1.3. The Hardware Abstraction Layer Daemon - Hald

Nowadays' X servers usually rely on the hal daemon. You should emerge and start it:

# emerge hal
# rc-update add hald default
# /etc/init.d/hald start

4.1.4. Initialize X11

If you haven't done so already, it is time now to install your server. You can either emerge gnome for a complete desktop environment (or emerge kde if you can't help it), or emerge xorg-server for the bare server. Make sure that you have read the pre-flight checklist, before you start X for the first time.

You should now create a skeleton X11 configuration file . You can either take /etc/X11/xorg.conf.example a try, or let it generate:

# emerge --oneshot mkfx86config
# mkfx86config.sh

Under normal circumstances, a startx or /etc/init.x/xdm start should now bring you into a basically working graphical environment.

4.2. Graphics Card

4.2.1. X Configuration

You need the xf86-video-intel driver package for X11:

# emerge xf86-video-intel

In /etc/X11/xorg.conf go to section "Device" and change the driver from "vesa" to "intel".

4.2.2. Hardware 3D Acceleration - DRI

With my setup (kernel 2.6.30-gentoo-r4) 3D acceleration and DRI worked out of the box. If you have problems, check the following.

You need MTRR support in your kernel:

Processor type and features  -->
[*] MTRR (Memory Type Range Register) support 

You also have to enable AGP and support for the Intel GM45 Express chipset using the Intel I965 driver:

Device drivers  -->
  Graphics support  -->
  <*> /dev/agpgart (AGP) Support  -->
      ...
      <*> Intel 440LX/BX/GX, I8xx and E7x05 chipset support
      ...

You can safely unselect support for the other drivers here. You also have to check the kernel support for DRI:

Device drivers  -->
  Graphics support  -->
  <*>  Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) -->
      ...
      <*> Intel 830M, 845G, 852GM, 855GM, 865G (i915 driver)  --->
          ( ) i830 driver
          (X) i915 driver 
      ...

Again, you can safely unselect support for all other drivers.

If you have changed something, re-compile and re-install the kernel and check that the kernel detected your hardware:

$ dmesg | grep agpgart
[    0.422080] Linux agpgart interface v0.103
[    0.422201] agpgart-intel 0000:00:00.0: Intel Mobile Intel® GM45 Express Chipset
[    0.423241] agpgart-intel 0000:00:00.0: detected 32764K stolen memory
[    0.426290] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xe0000000

In /etc/X11/xorg.conf you must load the "glx" and "dri" modules:

Section "Module"
        ...
        Load   "dri"
        ...
        Load   "glx"
        ...
EndSection
...
Section "DRI"
        Mode 0666
EndSection

Restart X if you had to change your configuration. You can check that everything works with the program glxinfo

# emerge mesa-progs
# exit
$ glxinfo | grep '^direct rendering'
direct rendering: Yes

With glxgears you can see DRI in action.

4.3. Display

Important

The display of the E5400 comes in two flavors, as WXGA (1280x800) and WXGA+ (1440x900). Make sure that you know what type of display you have, before you configure new modes in /etc/X11/xorg.conf. If you are unsure, press F2 while rebooting the machine. In the BIOS go to Settings->System Information. When you scroll down the panel on the right side, you will see the capabilities of your monitor.

My notebook has a WXGA+ display. To use the maximum resolution, edit /etc/X11/xorg.conf:

Section "Monitor"
        DisplaySize     303 190
        HorizSync    28.0 - 96.0
        VertRefresh  50.0 - 75.0
        Option       "PreferredMode" "1440x900"
EndSection

Associate the monitor with the graphics chip in the screen section:

Section "Screen"
        Identifier      "Screen0"
        Device  "Card0"
        Monitor "Monitor0"
        # DefaultColorDepth 24
        SubSection "Display"
                Depth   1
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   4
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   8
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   15
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   16
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   24
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
        SubSection "Display"
                Depth   32
                Modes "1440x900" "1152x864" "1024x768" "832x624" "800x600" "640x480" "720x400" "640x400" "640x350"
        EndSubSection
EndSection

Again! Make sure that your monitor actually supports these resolutions. Theoretically you could damage your display if you use these mode lines on a WXGA (1280x800) display.

5. Input Devices

5.1. Xorg and Hal

In Gentoo, by default the xorg server is now built in a way that it relies on hal, a typical case of premature release, features working out of the box were sacrificed for some unneeded or even unwanted flexibility. You are supposed to edit some so-called fdi files for hal, but whenever somebody tells you that you should fiddle around with XML files because it would make your life easier or better, don't believe them. It's a lie, always.

The effect of this premature change is that settings for input devices like mouse, keyboard and so in in your /etc/X11/xorg.conf are ignored, and you suddenly end up with a US keyboard layout (although you configured another one), or a mouse without scroll wheel.

If you can't help going the hard way, follow the Gentoo Xorg 1.5 Upgrade Guide. Otherwise, just disable the hal support in Xorg until it is really working:

# echo "x11-base/xorg-server -hal" >>/etc/portage/package.use
# emerge --update --newuses xorg-server

5.2. Keyboard

I'm really unhappy with the keyboard of the E5400. For a fast typer it is a nightmare. Many characters are dropped, and the feeling is just not right, especially when compared to my old Latitude D820.

I also have a problem, which seems to be unrelated to the hardware because it existed already on my D820 with an almost identical setup. From time to time CAPS lock is turned on, although the CAPS lock LED is not lit (and vice versa). After some typing, the effect usually vanishes but it is very annoying.

A similar effect, that I also know from my D820 already is that X somehow occasionally thinks that I have the control key permantly pressed. Typing "D" in a terminal window closes it (think "CTRL-D"), "C" terminates process, and moving the mouse will permanently select text, so that I can no longer type anything (because I would overwrite my selection). This can usually be cured only by a reboot, restarting X is not enough.

5.2.1. X11 configuration

My keyboard has German layout (qwertz). The relevant section for it in /etc/X11/xorg.conf looks like this:

Section "InputDevice"
        Identifier "Keyboard0"
        Driver     "kbd"
        Option     "Protocol" "Standard"
        Option     "XkbRules" "xorg"
        Option     "XkbLayout" "de"
        Option     "XkbModel" "latitude"
#       Option     "XkbVariant" ",deadgraveacute"
#       Option     "XdbOption" "grp:toggle,grp_led:scroll"
EndSection

For Gentoo you should normally use xorg rules. You can find a list of support keyboard layouts in /usr/share/X11/xkb/rules/xorg.lst in the section "! layout", and for the model in "! model". Variants of the keyboad layout can be found in the section "! variant" (those for the "de" keyboard layout are marked with "de:"). You can find a better explanation for the specific layout in /usr/share/X11/xkb/symbols/XY (replace XY with your selected layout). Options are explained in /usr/share/X11/xkb/rules/xorg.lst in the "! options" section.

5.2.2. Dead Keys in KDE/Qt

There was a problem with KDE resp. Qt applications. KDE/Qt seems to have an unglory tradition of problems with dead keys (see for example http://bugs.scribus.net/view.php?id=1908). In my case the dead keys in the Greek keyboard layout did not work, whereas dead keys for German keyboard layout did work (for example for "é" or other accented characters). This applied only to Qt applications.

It turned out to be a problem of the locale settings. I did not set any locale, so that all my apps somehow thought that "ANSIX3.4-1968" (which is simly the canonical name for "ASCII") was my preferred locale. Setting the environment variables LANG and LC_ALL to "en_US.UTF-8" (or any other utf-8 locale, try locale -a for a list of options) fixed the problem.

You can also use any Greek 8-bit locale, for example "el_GR.iso88597". It seems that Qt refuses to compose characters with diacritic marks that are not included in the current locale. No matter what the Qt guys say, it's a bug ...

5.2.3. Console Settings

You also have to set the console keymap to the desired keymap if the default "us" (standard US keyboard layout) does not fit for you. You can find a tree of valid keyboard mappings in /usr/share/keymaps/i386.

I still have issues with the console settings. When typing non-ASCII characters into a console (or terminal emulator, local and remote), for each non-ASCII character deleted with backspace, there is a discrepancy of one byte:

# aböö

Now I hit backspace one and hit return:

# abö
-bash: abö?: command not found

It looks like backspace deletes bytewise in the console input buffer but character-wise in the display. Any help on this issue would be appreciated.

5.3. Touchpad, Pointing Stick, and Mouse

The touchpad and that quirky pointing stick between the G, H, B, and N work as a basic mouse, when you follow the basic instructions outlined in the section Graphics. Read on, if you want to get the scroll wheel emulation, mouse gestures and so on running.

Your kernel (2.6.11 or better) must have support for the input device event interface compiled in:

Device drivers  --->
    Input device support  --->
    <*> Event interface

Check /proc/bus/input/devices for all input devices recognized. For each one there should be a device node in /dev/input.

Now make sure that the variable INPUT_DEVICES in /etc/make.conf contains at least "keyboard mouse evdev synaptics":

VIDEO_CARDS="intel"
INPUT_DEVICES="keyboard mouse evdev synaptics"

Check whether you have to recompile your X server:

# emerge --update --newuse xorg-server

The above should automatically emerge the X11 driver synaptics. You can also force a check on that:

# emerge --update xf86-input-synaptics

6. Other Devices

6.1. Sound

6.1.1. Kernel Configuration

In the 2.6.29 kernel, everything you need is actually compiled in by default. But alsaconf from ALSA utilities expects some stuff to be compiled as modules. I didn't bother to find a way to get around this, and instead simply compiled the necessary stuff as a module:

Device Drivers  --->
<*> Sound card support  --->
    <*> Advanced Linux Sound Architecture  --->
        ...
        <*> OSS Mixer API
        [*]   OSS PCM (digital audio) API - include plugin [sic!] system
        <*> OSS Sequencer API
        ...
        [*] Support old ALSA API
        ...
        [*] PCI sound devices  --->
            ...
            <M> Intel HDA Audio  -->
                [*] Build hwdep interface for HD-audio driver
                [ ]  Allow dynamic codec reconfiguration (EXPERIMENTAL)
                [ ] Support digital beep via input layer
                [*] Build Realtek HD-audio codec support
                [*] Build Analog Device HD-audio codec support
                [*] Build IDT/Sigmatel HD-audio codec support
                [*] Build VIA HD-audio codec support
                [*] Build ATI HDMI HD-audio codec support
                [*] Build NVIDIA HDMI HD-audio codec support
                [*] Build INTEL HDMI HD-audio codec support
                [*] Build Conexant HD-audio codec support
                [*] Build C-Media HD-audio codec support
                [*] Build Silicon Labs 3054 HD-modem codec support
                [*] Enable generic HD-audio codec parser
                [ ] Aggressive power-saving on HD-audio

This looks a little like a debianesque christmas tree kernel configuration. You can experiment with different code support but this setup works. In any case, be sure to build the "Intel HDA Audio" driver as a module!

It is probably a good idea to also disable the obsolete OSS layer in favor of ALSA:

Device Drivers  --->
<*> Sound card support  --->
    <*> Advanced Linux Sound Architecture  --->
    < > Open Sound System (DEPRECATED)  -->

Compile the new kernel, install it, and reboot.

6.1.2. ALSA Configuration

Make sure that you have alsa-utils merged and run alsaconf as root:

# emerge --update alsa-utils
# alsaconf

You can safely ignore a warning "modinfo: could not find module snd". I think that the problem is caused by alsaconf assuming that most of the sound architecture has been built as a module. However, if that is not the first time that you configure your sound system, shut down all applications that use the sound system.

Unless you want to re-configure your sound configuration whenever you use it, you should make the configuration persistant:

# rc-update add alsa boot

You should add the init script to the boot runlevel, not to default!

Important: Every user that is supposed to use the sound device (what about yourself?) must be member of the group "audio"! This is often overlooked and hard to debug because the vast majority of multimedia applications have very poor error reporting practice.

6.1.3. Troubleshooting

If alsaconf complains "No supported PnP or PCI card found. Would you like to probe legacy ISA sound cards/chips?", there are basically two possibilities. Either you haven't configured your kernel to compile the sound card/chip driver as a module (see above), or you did not compile any driver for your device. Check your kernel configuration.

Sound works for root but not for other users? Make sure that the user that tries to access the sound system is member of the group "audio" (see above).

Your system hangs during shut down, and the last thing you see is "Unloading ALSA modules"? See Gentoo bug 253535. Setting UNLOAD_ON_STOP to "no" in /etc/conf.d/alsasound will probably fix it.

7. CPU

My laptop has a Core 2 Duo P8600 (from the "Penryn" model family at Intel) with 2.40 GHz. There are other options available, and you should check your own type:

 # grep "model name" /proc/cpuinfo 
model name	: Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
model name	: Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz

You see two lines because it is a dual core processor.

7.1. Kernel Configuration

In order to get the most out of your CPU, check your kernel configuration for the following:

Processor type and features  --->
    [*] Tickless System (Dynamic Ticks)
    ...
    [*] Symmetric multi-processing support
    ...
    (2) Maxumum number of CPUs
    [ ] SMT (Hyperthreading) scheduler support
    [*] Multi-core scheduler support
    ...
    < > Dell laptop support

As you can see, I did not activate Dell laptop support. Anybody knows, with which models this actually makes sense?

On the other hand I activated the "tickless system" option. This reduces the power consumption.

7.2. Compilation Options

With gcc 4.3 or better, you should use these CFLAGS in /etc/make.conf:

CFLAGS="-O2 -pipe -march=core2 -msse4.1"

For older gccs try it with -O2 -pipe -march=-nocona

Since it is a dual-core processor, you should use three parallel make processes. In /etc/make.conf:

MAKEOPTS="-j3"

7.3. ACPI

With the default options in the gentoo-sources kernel, ACPI is working quite well out of the box. These are the options that matter:

Power Management and ACPI options  --->
[*] Power Management support
[*]   Power Management Debug support
[ ]     Verbose Power Management debugging
[*] Suspend/resume event tracing
[*] Suspend to RAM and standby
[ ]   Test suspend/resume and wakealarm during bootup
[*] Hibernation (aka 'suspend to disk')
()    Default resume partition
[*] ACPI (Advanced Configuration and Power Interface) Support  --->
    [ ] Deprecated /proc/acpi files
    [ ] Deprecated power /proc/acpi directories
    [*] Future power /sys interface
    [ ] Deprecated /proc/acpi/event support
    <*> AC Adapter
    <*> Battery
    <*> Button
    <*> Fan
    -*- Dock
    <*> Processor
    <*>   Thermal zone
    (0) Disable ACPI for systems before Jan 1st this year
    [ ] Debug Statements
    < > PCI slot detection driver
    -*-   ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
    < >   Smart Battery System
< > APM (Advanced Power Management) BIOS support  --->
    CPU Frequency scaling  ---> 
-*- CPU idle PM support

As you can see, I have turned off most of the deprecated /proc interfaces. It's a new system, and I can well afford to use userspace applications that support the new stuff.

7.3.1. Suspend

When you suspend the laptop, everything needed to wake up the machine is copied to RAM, power consuming devices like the hard disk, monitor, graphics chip are turned off, and finally the CPU is put into a very low power state. Resuming goes in the opposite order.

That said, it should be clear that you cannot remove the battery from your Dell Latitude E5400, while the machine is suspended.

In order to make suspend work, make sure that you have the use flags "acpi" (=turned on), "laptop" (=turned on) and "-apm" (=turned off) in your USE variable in /etc/make.conf. Check if you have to recompile anything after that with:

# emerge --update --deep --newuse --ask world

For debugging purposes it is handy to emerge pm-utils (should be done automatically if you have emerged hal with the "laptop" use flag. You may have to unmerge powermgmt-base for that first.

Now, as the superuser "root" try the command pm-suspend. The screen should become black, you here how everything is turned off, and then you only see the LED in the power switch quietly blinking. Press the power switch, and after a few seconds you should be back where you came from.

If you want to use suspend functionality integrated into your desktop, make sure that hal is running and has been compiled with the "acpi" use flag. Turn "apm" off!

7.3.2. Hibernation

I did not give hibernation a try yet. From what I read, it is not really in the state of being of great help. I rather wait for the TuxOnIce patch set to be properly integrated in the kernel.

7.3.3. CPU Scaling

CPU scaling or CPU throttling adapts the frequency of your CPU to the current computing requirements. That saves energy resp. battery power, and also improves the lifetime of the hardware because of the lower heat emission.

The Linux kernel supports multiple "governors" (strategies for scaling the CPU power). The "performance" governor always selects the maximum performance, "userspace" allows userspace programs to change the frequency, "powersave" minimizes the power consumption by selecting the minimum frequency, "ondemand" switches between the available frequencies depending on the current system load. The "conservative" governor does the same as the "ondemand" governor, but instead of jumping between frequencies, it gradually increases or decreases the frequency. The "conservative" governor is therefore the ideal governor for mobile hardware like the Dell Latitude.

Power management and ACPI options  --->
       CPU Frequency Scaling
       [*] CPU Frequency scaling
       [*]   Enable CPU Frequency scaling debugging
       < >   CPU frequency translation statistics
             Default CPUFreq governor (conservative)  --->
       <*>   'performance' governor
       <*>   'powersave' governor
       <*>   'userspace' governor for userspace frequency scaling
       <*>   'ondemand' cpufreq policy governor
       -*-   'conservative' cpufreq governor
              *** CPUFreq processor drivers ***
       <*>   ACPI Processor P-States driver

I have disabled all the rest on this page. After recompiling and rebooting (if necessary) you should have cpu frequency scaling up and running.

You can check whether things have worked out by monitoring the files /proc/cpuinfo or the files in /sys/devices/system/cpu/cpu0/cpufreq and /sys/devices/system/cpu/cpu1/cpufreq.

watch -n 1 -d cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

You may stumble upon pages telling you to install things like cpufreqd and do all kinds of configuration, boot scripts or the like in order to get throttling running. I didn't find anything of that necessary.

8. See Also

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones