IBM Thinkpad G40 & Debian Linux

The 'G' range is a strange annex of the thinkpad line, and doesn't have most of the normal features (e.g. Ultrabays, Thinklights), nor does it use the standard thinkpad power supply. It is also huge since it has a desktop P4 and a lot of copper. Despite this it's a reasonably quiet laptop which can last a few hours away from power.

There's nothing particularly unusual you have to do to get debian up and running---the install process should guide you through to at least a command prompt. Debian stock kernels work just fine.

BIOS setup

Update to the latest BIOS, of course. Then press some buttons. I dunno.

Like other IBM's, there's the recovery area to disable ( IMO it's not that useful, if you don't trust yourself enough that you get the BIOS to hide a backup windows installation then you probably shouldn't be using Linux).

Graphics configuration

Warning: It seems the VGA connector on the laptop is prone to breaking off, this inhibits use of dualheading somewhat. Whilst nosing on ebay for spares, it seems I'm not the only one to suffer this. It doesn't appear to be easily repairable, either.


Current versions of the "intel" driver (2:2.3.2-2+lenny6) work pretty much flawlessly, can rotate screens, shut the lid (which hasn't been possible for some time). Config looks like:

Section "Device"
      Identifier      "Internal Video"
      Driver          "intel"
      BusID           "PCI:0:2:0"
      Screen          0

Section "Monitor"
      Identifier      "Laptop LCD"
      Option          "DPMS"
      DisplaySize     270 203

Section "Monitor"
      Identifier      "Sun GDM-20E20"
      Option          "DPMS"
      HorizSync       30-85
      VertRefresh     48-160
      DisplaySize     337 270

Section "Screen"
      Identifier      "Default Screen"
      Device          "Internal Video"
      Monitor         "Laptop LCD"
      Option          "monitor-VGA" "Sun GDM-20E20"
      DefaultDepth    24
      SubSection "Display"
              Depth 16
              Virtual 2304 1024
      SubSection "Display"
              Depth 24
              Virtual 1280 1024


This seems to just-work™ & glxgears gives me ~400fps, which isn't great but I'm not that fussed. Select the following Character Devices in your kernel setup:-

  • Direct Rendering Manager
  • Intel 830M, 845G, 852GM, 855GM, 865G
  • i915 driver

If you compiled them as a module, insert "i915" into /etc/modules to get it to load on bootup.


The intelfb fb driver will coexist with the intel X11 driver, however it gets confused when X11 takes over and disables accelleration.

To use intelfb, enable "Intel 830M/845G/852GM/855GM/865G/915G/945G support" under Graphics support in your kernel (compiled in, not a module). Add the following to your kernel command line:

vga=0x318 video=intelfb

Powersaving/ACPI configuration

ACPI works fairly well out of the tin. Make sure you have compiled "IBM ThinkPad Laptop Extras" and add the following to /etc/modprobe.d/g40hardware:

options thinkpad-acpi experimental=1

The laptop exposes:-

  • AC Adapter / Battery information
  • Lid & power buttons
  • 1 Thermal Zone
  • Processor throttling & C states 1+2
  • Video control (although I haven't used it)
  • The thinkpad-acpi driver gives you:-
    brightness controlIBM Hotkey support (that can be modded to include Access IBM keys)

A lot of thinkpad-acpi won't do much, e.g. the volume control will flip bits, but this has no affect on the sound (presumably they didn't bother wiring the sound chip into whatever the volume controls set), the video options also don't do anything. Maybe I play with these at some point.

Sleep States

The laptop supports S3 (suspend-to-ram) reasonably well. Add the following to your kernel command line:


This tells ACPI to run the video BIOS after a resume. It will work fine without, but you need to switch VT's and back again before you can see your mouse cursor.

DSDT Hacks: Extra keys

The DSDT I have modified to include ACPI hotkey support for more keys. This is a similar process for any thinkpad.

  1. Install the iasl compiler, copy /proc/acpi/dsdt and decompile it.
  2. Look at the source code. Search for "_Q"
  3. You should see a whole load of Method (_Q03, 0, NotSerialized). Each one of these is triggered when the Embedded controller receives an event. Through trial and error, I found these events were triggered by some keys:

Adding a call to MHKQ in each of these blocks means that thinkpad_acpi will get told about them. My patch is here.

Recompile the DSDT using iasl -tc into a hex file, and configure the kernel to compile this into it's source code. You could also use the initrd patch, but the new initramfs stuff is a bit cumbersome if that's the only thing you use it for.


Even if it's predominantly a desktop, this is a good-thing™ to keep heat (and therefore noise) down. I wanted to just use one of the kernel governors and not play around that much. Compile in support for "Intel Pentium 4 clock modulation", and whatever governors you want. Although you can't select ondemand or conservative for the default govenor, you can install sysfs-tools and add to /etc/sysfs.conf:

devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand

Audio Configuration

Pretty easy to setup using alsa. Make sure you compile the "Intel/SiS/nVidia/AMD/ALi AC97 Controller" ALSA module (snd_intel8x0), and udev should load it for you.

The mixer channels:-

  • Master refers to the internal speaker
  • Headphone refers to the headphone socket
  • There's an option "headphone jack sense" which I guess should stop the master output turining off when I insert a headphone jack—it doesn't. I guess it could also select headphone/line-level.

You can also set the driver to disable the chip when nothing is being played. Put the following in /etc/sysfs.conf:

module/snd_ac97_codec/parameters/power_save = Y