Thursday, September 01, 2005

Debian Linux on the Dell Latitude X300

I recently acquired a Dell Latitude X300 to replace my ThinkPad A31, which was reassigned to sales duty. This is a brief summary of my experience installing Debian on this laptop. The information here was gathered from many sources (see References).
You can grab a copy of some of my kernel config files if you want. They can serve as a good starting point for rolling your own:

Version Date Description
2.4.28 01/09/2005 Basic configuration for the X300.
2.6.10 01/15/2005 Configuration with most stuff working. Includes custom DSDT, but no sleep/suspend stuff.
2.6.10 01/18/2005 Configuration including custom DSDT and Software Suspend 2 configuration.
2.6.11.7 05/02/2005 Configuration including custom DSDT and Software Suspend 2 configuration (version 2.1.8).

The specs on my X300 are:

  • Intel® Pentium® M processor 738 (1.40GHz)
  • 1152MB RAM (Maximum supported)
  • 60 GB HD (Maximum available)
  • Intel® pro 2200 wireless
  • DVD/CD-RW via external D-Bay
  • Integrated v.92 56K modem
  • Integrated 10/100 Ethernet

lspci output

BIOS Options

The only things that needed to be changed in the BIOS were the system time (set to UTC) and the boot options. I enabled boot from USB CD-ROM and USB HDD.

Partitioning

The laptop came with Windows XP Professional. The hard drive was partitioned as follows:

DELLUTILITY, type FAT, 39MB
Local Disk, Type NTFS, 56 GB, of which nearly 5GB was already used.

I booted the laptop, went through the Windows setup junk, and installed Partition Magic. I left the utility partition alone. That may be useful someday. The NTFS partition was then cut down to a more reasonable 10 gigs, which left me space to install Starcraft and Duke Nukem 3D, since that’s about all I use Windows for. That left me 42GB of unallocated space, just begging for Linux.

Installing Debian

I prefer Debian. The “sarge” version was running nicely on my ThinkPad, and I wanted to keep what I know.

I used the latest Debian installer, netinst rc2. Booting from the USB CD-ROM worked perfectly. I used the expert install, because I like to know what’s going on. The installer worked with no problems. I was pleasantly surprised. Hat’s off to the Debian installer team!

The hard drive was partitioned as follows:

Device Boot Start End Blocks Id System
/dev/hda1 1 5 40131 de Dell Utility
/dev/hda2 * 6 1280 10241437+ 7 HPFS/NTFS
/dev/hda3 7175 7296 979965 82 Linux swap
/dev/hda4 1281 7174 47343555 f W95 Ext’d (LBA)
/dev/hda5 * 1281 3104 14651217 83 Linux
/dev/hda6 3105 3469 2931831 83 Linux
/dev/hda7 3470 7174 29760381 83 Linux

I opted for manual package selection, and installed the following major packages to get X and gnome:
x-window-system
xfree86-driver-synaptics (more on this later)
gnome-desktop-environment
gdm

After the install finished, I had a dual-boot Debian/Windows system.

Configuring Linux

X Window System

Configuring X can be a trying experience. I am happy to report that it Just Worked on this laptop. The configuration that was generated during install worked just fine, with the exception of the special touchpad features.

The touchpad on this laptop is pretty fancy. It can be configured so that the side edge acts as a vertical scroll bar, and the bottom edge acts as a horizontal scroll bar. In addition, the surface can be tapped or double tapped for a left click (mouse button 1). It also support tapping with multiple fingers – not to be confused with a double-tap. A tap with one finger is equivalent to mouse button 1. A tap with two fingers is equivalent to mouse button 2. A tap with three fingers is equivalent to mouse button 3. This takes a little getting used to, but it works quite well. These extra features require the synaptics driver, which is packaged as xfree86-driver-synaptics in Debian. To enable the special features, edit your XFree86Config-4 file. The changes are show below, with the original section commented out:

#Section “InputDevice”
# Identifier “Configured Mouse”
# Driver “mouse”
# Option “CorePointer”
# Option “Device” “/dev/psaux”
# Option “Protocol” “PS/2″
# Option “Emulate3Buttons” “true”
# Option “ZAxisMapping” “4 5″
#EndSection
Section “InputDevice”
Identifier “Configured Mouse”
Driver “synaptics”
Option “CorePointer”
Option “Device” “/dev/psaux”
Option “Protocol” “auto-dev”
Option “Emulate3Buttons” “true”
Option “LeftEdge” “1700″
Option “RightEdge” “5300″
Option “TopEdge” “1700″
Option “BottomEdge” “4200″
Option “FingerLow” “25″
Option “FingerHigh” “30″
Option “MaxTapTime” “180″
Option “MaxTapMove” “220″
Option “VertScrollDelta” “100″
Option “MinSpeed” “0.06″
Option “MaxSpeed” “0.12″
Option “AccelFactor” “0.0010″
Option “SHMConfig” “on”
# Option “Repeater” “/dev/ps2mouse”
EndSection

DRI

X is using hardware accleration (DRI), as reported by glxinfo:

jeremyb@talisker:~$ glxinfo | grep dire
direct rendering: Yes

This is working under kernel 2.4.28 and 2.6.10.

ACPI

This laptop supports ACPI, but has a buggy DSDT (Differentiated System Description Table). To get ACPI working, you need to do a little work.
NOTE: It is recommended that you use a 2.6.x series kernel. The procedure described here to include a custom DSDT will not work on kernels lower than 2.6.9. There are ways to make it work, but they won’t be covered here, since I am using 2.6.10.

  1. Get the IASL compiler from Intel. Scroll down to find the download link for “ACPI-CA Unix Build Environment".
  2. Extract and build:
  3. tar zxf acpica-unix-20041203.tar.gz
    cd acpica-unix-20041203/compiler/
    make

    NOTE: If you are running Debian sarge, and you get errors compiling IASL, remove the flex package, and install the flex-old package instead.

  4. Reboot. Note the BIOS version (upper right of the screen)
  5. Go to the ACPI project page and download the DSDT for your BIOS. Make sure you get the DSDT that matches the version of your BIOS!
  6. Decompress the downloaded DSDT.
  7. Disassemble your existing DSDT, using the IASL
  8. # cat /proc/acpi/dsdt > dsdt.aml

    # iasl -d dsdt.aml
    Intel ACPI Component Architecture
    ASL Optimizing Compiler / AML Disassembler version 20041203 [Jan 10 2005]
    Copyright © 2000 - 2004 Intel Corporation
    Supports ACPI Specification Revision 2.0c
    Loading Acpi table from file dsdt.aml
    Acpi table [DSDT] successfully installed and loaded
    Pass 1 parse of [DSDT]
    Pass 2 parse of [DSDT]
    Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)
    ……………………………………………………………………………………………….
    ……………………………………………………………………………………………….
    …………………………………………………………………………………
    Parsing completed
    Disassembly completed, written to “dsdt.dsl”

  9. Find the memory used in the disassembled DSDT and the downloaded DSDT:
  10. # grep SystemMemory dsdt.dsl
    OperationRegion (MNVS, SystemMemory, 0x476EBD79, 0x40)
    OperationRegion (PHSD, SystemMemory, 0x476FBDBD, 0x0190)
    OperationRegion (VNVS, SystemMemory, 0x476EBDB9, 0x00010004)
    # grep SystemMemory Dell-Latitude_X300-A08-custom.asl
    OperationRegion (MNVS, SystemMemory, 0x276EBD79, 0x40)
    OperationRegion (PHSD, SystemMemory, 0x276FBDBD, 0x00000190)
    OperationRegion (VNVS, SystemMemory, 0x276EBDB9, 0x00010004)

    Notice that the memory in the disassembled DSDT is different from the memory in the downloaded DSDT. Edit the downloaded DSDT so that the memory values match the values in the disassembled DSDT.

  11. Compile the new DSDT
  12. # iasl -tc Dell-Latitude_X300-A08-custom.asl
    Intel ACPI Component Architecture
    ASL Optimizing Compiler / AML Disassembler version 20041203 [Jan 10 2005]
    Copyright © 2000 - 2004 Intel Corporation
    Supports ACPI Specification Revision 2.0c
    ASL Input: Dell-Latitude_X300-A08-custom.asl - 5490 lines, 189077 bytes, 2645 keywords
    AML Output: DSDT.aml - 21882 bytes 656 named objects 1989 executable opcodes
    Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 626 Optimizations
  13. Copy the compiled DSDT to your kernel source directory:
  14. # cp Dell-Latitude_X300-A08-custom.hex /usr/src/linux-2.6.10/my-dsdt.hex
  15. Configure your kernel to use the new DSDT. Enable the custom DSDT option under . Specify the path to the compiled DSDT (/usr/src/linux-2.6.10/my-dsdt.hex).
  16. Install your new kernel. Install the ACPI packages if you have not already (acpi and acpid on Debian). You should be able to query for acpi status now
  17. $ acpi -V
    Battery 1: charged, 100%
    Thermal 1: ok, 49.0 degrees C
    AC Adapter 1: on-line

Sleep/Suspend

Sleep is saving the state of the laptop to RAM. It should then power up quickly, leaving you where you left off. If you’ve ever used an Apple iMac/iBook/PowerBook, you know what I want.
Sleep requires enabling CONFIG_ACPI_SLEEP in your kernel config. You can then echo -n mem > /sys/power/state to suspend to RAM. And if you try this, your laptop will go to sleep, but it’s more like a coma.

Suspend is saving the state of the laptop to disk. It should then power up more quickly than from a cold boot, but not as quickly as from a sleep state. This requires enabling CONFIG_SOFTWARE_SUSPEND and CONFIG_PM_STD_PARTITION. You can then echo -n disk > /sys/power/state to suspend to disk. This works pretty well. I configured it to suspend when the lid is closed. I can then open it up, hit power, and it unsuspends. The only obvious problem so far is that the sound stops working after resume. Modules are all there, no errors in the logs, but no sound.

Software Suspend 2 is a kernel patch that adds additional functionality to the suspend/resume code. To get it, head over to the Software Suspend 2 home page, download the patch for your kernel, apply, configure, and compile. The directions on the page are easy to follow. The relevant part of my kernel config is:

#
# Software Suspend 2
#
CONFIG_SOFTWARE_SUSPEND2=y
CONFIG_SOFTWARE_SUSPEND2_BUILTIN=y
CONFIG_SOFTWARE_SUSPEND_SWAPWRITER=y
#
# Page Transformers
#
CONFIG_SOFTWARE_SUSPEND_LZF_COMPRESSION=y
#
# User Interface Options
#
CONFIG_SOFTWARE_SUSPEND_TEXT_MODE=y
#
# General Options
#
CONFIG_SOFTWARE_SUSPEND_DEFAULT_RESUME2="/dev/hda3″
# CONFIG_SOFTWARE_SUSPEND_KEEP_IMAGE is not set
CONFIG_SOFTWARE_SUSPEND_CHECK_RESUME_SAFE=y
#
# Debugging
#
CONFIG_SOFTWARE_SUSPEND_DEBUG=y
# CONFIG_SOFTWARE_SUSPEND_CHECKSUMS is not set

I also installed the hibernate script from sarge. The only change I had to make was to uncomment the SwitchToTextMode yes line in the file /etc/hibernate/hibernate.conf. I can now suspend to disk and resume gracefully. And sound works.
UPDATE:It appears that DRI does not recover gracefully. After a restore, programs that do 3D stuff (GL screensavers, glxgears) do not work. They will run, but there is no animation. Getting DRI back is simply a matter of logging out of Gnome. There is an option in /etc/hibernate/hibernate.comf called UseDummyXServer that is supposed to help the DRI drivers reinitialize when resuming, but this is not working for me.

Wireless

This laptop has the Intel Pro Wireless 2200 chipset. The driver can be found at http://ipw2200.sourceforge.net. Download the latest archive, untar, and read the INSTALL and README files. They have very good step-by-step instructions.

Once the modules are compiled and the firmware installed, you should be able to use the standard wireless tools to configure the interface.

Modem

Coming soon!

Ethernet

The ethernet adapter is supported by the tg3 driver. It works perfectly.

Sound

Works with the ALSA drivers.

This page will be updated as I have time to work with the laptop.

No comments: