Difference between revisions of "Installing Debian Sid (October 2005) on a ThinkPad T42"

From ThinkWiki
Jump to: navigation, search
m (Add T42 category.)
 
(23 intermediate revisions by 6 users not shown)
Line 38: Line 38:
  
 
== Getting wireless to work ==
 
== Getting wireless to work ==
I had a Sony Vaio for a few months and I had to go through hell to get wireless to work on that one. The reason for that primarily was that it was an old machine and wireless access was through the PCMCIA port. However, Vaios are notorius for not passing their IRQ requests correctly, and so Linux was never able to assign the PCMCIA bus a correct IRQ channel and the PCMCIA devices never worked. I had to make do with a USB ethernet driver and it wasn't as fast, and stuck out from the back and looked very ugly.  
+
Intel 2200BG wireless chipsets work right out of the box since the source is in the kernel tree since 2.6.15. You will still need to download and install the firmware for these cards. The firmware files change with the version number of the driver that is included in the kernel source. The version of the firmware may be checked by apt-getting the kernel source and viewing Documentation/networking/README.ipw2200
  
I'm happy to report that nothing like that occurred in my ThinkPad {{T42}}.
+
The ipw2200 sourceforge page at [http://ipw2200.sourceforge.net/firmware.php IPW-Sourceforge] will have directions for you.
 
 
To get wireless to work on your Debian box, do the following
 
:$ apt-get install wireless-tools ipw2200-source ieee80211-source
 
 
 
In addition to this make sure you apt-get your kernel-source (linux-source as of 2.6.12), linux-headers, and linux-tree packages.
 
 
 
Once you have this navigate to /usr/src where all these packages are installed and bunzip/tar them so that a linux-source directory is created, and also a modules directory is created which has the ipw200, and ieee80211 sources.
 
 
 
Now, make a symlink called linux to your linux-sources directory
 
:$ ln -s linux-sources-2.6.x.y linux
 
 
 
Make sure it works by typing in ls -l in /usr/src and see that linux points to your linux-sources directory
 
 
 
To get the ipw2200 wireless utilities to work, you need to download the correct firmware from intel.com
 
The ipw2200 sourceforge page at [http://ipw2200.sourceforge.net/firmware.php IPW-Sourceforge] will have directions for you. Make sure you download the correct version that corresponds to your ipw2200-source. You can check your ipw2200-source version by going
 
:$ dpkg --info ipw2200-source
 
 
 
Now that you've downloaded and installed the firmware files in /usr/lib/hotplug/firmware/ you need to build your ipw and ieee80211 sources
 
 
 
You can do it by typing in these commands in /usr/src
 
:$ module-assistant a-i ieee80211
 
:$ module-assistant a-i ipw2200
 
 
 
This will create 2 .deb files in your /usr/src directory. If debian doesn't install them automatically, then do so yourself and then use the modules by modprobing them
 
:$ modprobe ieee80211
 
:$ modprobe ipw2200
 
 
 
You can add ieee80211 and ipw2200 in your /etc/modules to make sure they load up on boot time
 
  
 
Check that everything works by
 
Check that everything works by
:$ iwlist scanning
+
        $ iwlist scanning
  
 
Either eth1 or eth0 should show a list of available wirless networks (if any)
 
Either eth1 or eth0 should show a list of available wirless networks (if any)
Line 101: Line 73:
  
 
== Getting power management to work ==
 
== Getting power management to work ==
In my earlier Sony Vaio, I couldn't get ACPI or APM to work. I'm happy to report that in this laptop, I could get power-management to work very well with ACPI. I was able to put the laptop to sleep, and I'm still working on the hibernate feature, although I consider that non-critical. Here is how I got it all to work
+
Power-management works with ACPI but there are issues with getting ATI Radeon cards to sleep (see below).  
 +
 
 +
For power-management, apt-get install hibernate
  
 
=== ACPI sleep ===
 
=== ACPI sleep ===
 
+
ACPI sleep works out of the box. Just login as root and type
ACPI sleep worked straight of the bat. Just login as root and type
+
        $ echo mem > sys/power/state
:$ echo mem > sys/power/state
 
  
 
Your laptop should go through the suspend cycle and the sleep light should come on. To resume, press the Fn key and the laptop shoud resume where you left it.  
 
Your laptop should go through the suspend cycle and the sleep light should come on. To resume, press the Fn key and the laptop shoud resume where you left it.  
Line 112: Line 85:
 
You can automate this whole operation, so that when you close the lid, the laptop should go to sleep automatically. Here's how.
 
You can automate this whole operation, so that when you close the lid, the laptop should go to sleep automatically. Here's how.
  
=== ACPI sleep on lid close script ===
+
=== Hibernate ===
Add the following in your /etc/acpi/actions directory as lm_lid.sh and make sure that /etc/acpi/scripts/lm_lid points to it. This script was originally taken from [http://www.superk.org/index.php/HP_Pavilion_dv1245cl Superk.org]
+
I recommend using the suspend2 patch found on www.suspend2.net. The instructions there are quite easy to follow and after downloading the patch you can patch the kernel by executing in the kernel directory the command
  
  #!/bin/bash
+
        $bzcat /path/to/patch | patch -p1
  test -f /usr/sbin/laptop_mode || exit 0
 
  # lid button pressed/released event handler
 
  /usr/sbin/laptop_mode auto
 
  #!/bin/bash
 
  test -f /usr/sbin/laptop_mode || exit 0
 
  grep -q closed /proc/acpi/button/lid/*/state
 
  if [ $? = 0 ]
 
  then
 
          chvt 12
 
          echo mem > /sys/power/state
 
  else
 
          sleep 2
 
          chvt 7
 
  
=== ACPI sleep drain problem ===
+
Select the suspend2 configuration options in the kernel tree. Make sure LZF compression is built in in the Cryptographic routines section.
I had this problem also. I located the problem to be the Radeon driver. It turns out that the radeon power mangement source file in the 2.6.12 kernel doesn't put the radeon GPU to sleep during ACPI sleep. You need to patch the kernl to get this to work. The patch as of the time of this writing can be downloaded from [http://bugme.osdl.org/show_bug.cgi?id=3022 OSDL_Bugzilla]. Before you do that however, test to see if your laptop is affected by it using this [http://www.thinkwiki.org/wiki/ACPI_sleep_power_drain_test_script Test script].
 
  
If you need to patch the kernel, then the use the following command
+
=== Compiling the kernel ===
:$ patch -p0 < radeon_patch_file
+
In Debian this is easy to do using the kernel-package program. apt-get install kernel-package initramfs-tools fakeroot and in the kernel directory, you can execute
:Make sure you change the path to your linux sources in the patch file.
 
  
I got my power consumption down from 5W during sleep to a very small 300 mW which means I can put my laptop to sleep when fully charged and expect to be on for almost 10 days.
+
        $ make-kpkg --initrd --rootcmd fakeroot --append-to-version <system_name> --revision <2.6.x-y> --arch i386 kernel_image
  
Make sure you add the vide0=radeonfb:force_sleep to your kernel parameter in /boot/grub/menu.lst. Your grub kernel line will look something like this
+
and after a while the kernel .deb package is made. Make sure you have initramfs-tools installed and NOT yaird because suspend2 is not supported using yaird.  
  
  kernel          /vmlinuz-2.6.12.2 root=/dev/hda1 ro vide0=radeonfb:force_sleep
+
To get suspend2 to resume successfully, you will have to pass resume2=swap:/dev/hdax as a kernel parameter in /boot/grub/menu.lst
 +
 
 +
=== ACPI sleep drain and framebuffer problem ===
 +
Thinkpad laptops with ATI radeon cards currently suffer from high ACPI sleep power drain. This is because, the radeon card doesn't shut down when the rest of the laptop goes to sleep. This is probably because the Radeon driver programmers are working in the dark due to ATI not fully releasing the specs of their card. This problem may be fixed in kernel 2.6.21 where the ACPI subsystem is rumored to be completely revamped.
 +
 
 +
Another problem is that the current implementation of the radeon power management (drivers/video/aty/radeon_pm.c) maintains a whitelist of thinkpad systems where the radeon card can be successfully shut off using a kernel parameter. However, this stopped working sometime in eary 2007 with an upgrade of the X.org server. Thus many have reported hangs as covered in [http://bugme.osdl.org/show_bug.cgi?id=3022]. For the time being, if you want to use the framebuffer, you will have to recompile your kernel with the Radeon driver built in. Pass video=radeonfb:ignore_devllist=1 as the kernel parameter in grub or lilo.
 +
 
 +
=== Sample kernel configuration in Grub ===
 +
        title          Debian GNU/Linux, kernel 2.6.20-custom
 +
        root            (hd0,0)
 +
        kernel          /boot/vmlinuz-2.6.20-custom root=/dev/hda1 ro resume2=swap:/dev/hda5 video=radeonfb:ignore_devlist=1
 +
        initrd          /boot/initrd.img-2.6.20-custom
 +
        savedefault
 +
 
 +
=== ACPI sleep drain test script ===
 +
 
 +
You can test if your laptop suffers from the Radeon ACPI problems by running the script available at [http://www.thinkwiki.org/wiki/ACPI_sleep_power_drain_test_script]. If your power drain during ACPI sleep is greather than 1W, its too much. When working correctly, power usage during ACPI sleep for most ATI cards is around 620 mW.
 +
 
 +
=== Enabling power management Fn keys ===
 +
 
 +
apt-get install acpi-support. Modify the scripts found in /etc/acpi/events to point to actions that will do the necessary function.
 +
 
 +
=== Enabling hibernate on closing lid ===
 +
 
 +
Modify /etc/acpi/actions/lm_lid.sh so that it points to /usr/sbin/hibernate when the lid is shut. The one on my system is listed below
 +
<source lang="bash">
 +
        #!/bin/bash
 +
        test -f /usr/sbin/laptop_mode || exit 0
 +
        # lid button pressed/released event handler
 +
        /usr/sbin/laptop_mode auto
 +
        #!/bin/bash
 +
        test -f /usr/sbin/laptop_mode || exit 0
 +
        grep -q closed /proc/acpi/button/lid/*/state
 +
        if [ $? = 0 ]
 +
        then
 +
        #        chvt 12
 +
        #        rmmod uhci_hcd ehci_hcd usbhid
 +
                /usr/sbin/hibernate
 +
        else
 +
                sleep 2
 +
        #      modprobe uhci_hcd
 +
        #      modprobe ehci_hcd
 +
        #        modprobe usbhid
 +
              chvt 7
 +
</source>
  
 
=== CPU Frequency scaling ===
 
=== CPU Frequency scaling ===
Line 153: Line 155:
  
 
         Section "Device"
 
         Section "Device"
          Identifier      "ATI Technologies, Inc. Radeon Mobility M7 LW [Radeon Mobility 7500]"
+
                Identifier      "ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]"
          Driver          "radeon"
+
                Driver          "ati"
          VendorName      "IBM Thinkpad"
+
                Option          "AGPMode" "4"
          Option     "DynamicClocks" "on"      
+
                Option          "EnablePageFlip" "on"
          BusID          "PCI:1:0:0"
+
                Option          "RenderAccel" "on"
 +
                Option         "DynamicClocks" "on"
 +
                Option          "ColorTiling"  "on"
 +
                BusID          "PCI:1:0:0"
 +
                Option          "UseFBDev"              "true"
 +
                Option          "BIOSHotkeys"          "on"
 
         EndSection
 
         EndSection
  
Check to see that this is working by looking at /var/log/Xorg.0.log. This feature doesn't work with XFree86.
+
Check to see if DynamicClocks, etc are working by looking at /var/log/Xorg.0.log. These features doesn't work with XFree86.
  
=== Hibernate ===
+
== Thinkpad buttons ==
This for me is non-critical, and I haven't got it working just yet. The way I've tried it so far is by patching the kernel using Software suspend 2. However, the kernel panics on reboot, the reason for which is probably the initrd. I haven't quite figured out how to fix this. I tried making a bzImage kernl although that didn't work either. The kernel doesn't panic in this case but doesn't reusme either. If you have a solution, please edit this and let us all know.
+
You can get an online display for your screen brightness and volume control by apt-getting tpb. You need to make /dev/nvram user-writable to get it work with regular user perms. Add tpb to your .xsession file to have it running when you first start X. /dev/nvram can be made user-writable by adding yourself to the nvram group. This way you don't have to do it everytime you boot up.
  
== Thinkpad buttons ==
+
[[Category:T42]]
You can get an online display for your screen brightness and volume control by apt-getting tpb. You need to make /dev/nvram user-writable to get it work with regular user perms. Add tpb to your .xsession file to have it running when you first start X
 
 
[[Category:Debian]]
 
[[Category:Debian]]

Latest revision as of 11:06, 18 June 2015

Debian netinst

Insert the Debian net installation disk (download size ~130 MB) and on bootup, the laptop should go directly to the Debian splash image prompting you for a boot parameter. If you don't see this screen, then you possibly need to change the boot device configuration in your BIOS and make the CD drive the first boot disk.

Enter expert26 to start the installation with Kernel 2.6, and it will take you through the regular Debian setup which contrary to published reports on Slashdot and SuSe forums is very intuitive and non-scary. Everything I had on this machine (lspci output below) was detected with the sole exception of the Intel Pro Wireless 2200 wireless card. It turned out later that getting wirless to work was really easy in debian.

Debian should install just fine and on first bootup, install the packages you want. X should just work with all the auto-detect options in the installer. I have a SXGA monitor and the display worked correctly from the first go. The only problem I had with the Debian installer is that at the time of my install, gnome was in transition so I couldn't immediately install the mail client of choice -> Evolution.

My configuration

Here is the lspci output from my system, a more non-cryptic description of my config is below

0000:00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
0000:00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
0000:00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
0000:00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
0000:00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
0000:00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
0000:00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
0000:00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
0000:00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
0000:00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
0000:00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
0000:02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
0000:02:00.1 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
0000:02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
0000:02:02.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)

In summary,

Intel 1.73 Pentium M (Dothan)
Intel Pro Wirless 2200
SXGA monitor (14", 1400x1050)
512 MB of RAM
Intel Gigabit Ethernet
IBM Security System
Integrated fingerprint reader
56 K modem

Getting wireless to work

Intel 2200BG wireless chipsets work right out of the box since the source is in the kernel tree since 2.6.15. You will still need to download and install the firmware for these cards. The firmware files change with the version number of the driver that is included in the kernel source. The version of the firmware may be checked by apt-getting the kernel source and viewing Documentation/networking/README.ipw2200

The ipw2200 sourceforge page at IPW-Sourceforge will have directions for you.

Check that everything works by

       $ iwlist scanning

Either eth1 or eth0 should show a list of available wirless networks (if any)

You can create your wirless preferences by modifying your /etc/network/interfaces file. I show a part of mine as reference

Network intefaces file

  mapping eth1
       map home 
       map work
       map none
  # The loopback network interface
  auto lo
  iface lo inet loopback
  # The primary network interface
  # auto eth0
  iface eth0 inet dhcp
  autho eth1
  iface eth1 inet dhcp
  iface home inet dhcp
       wireless-essid enter your wireless ID 
       wireless-key whatever your wirless key is
  iface work inet dhcp
       wireless-essid whatever your work wireleess ID
       wireless-key whatever your wireless key is
  iface none inet dhcp
       wireless-essid ANY
       wireless-key none

Getting power management to work

Power-management works with ACPI but there are issues with getting ATI Radeon cards to sleep (see below).

For power-management, apt-get install hibernate

ACPI sleep

ACPI sleep works out of the box. Just login as root and type

       $ echo mem > sys/power/state

Your laptop should go through the suspend cycle and the sleep light should come on. To resume, press the Fn key and the laptop shoud resume where you left it.

You can automate this whole operation, so that when you close the lid, the laptop should go to sleep automatically. Here's how.

Hibernate

I recommend using the suspend2 patch found on www.suspend2.net. The instructions there are quite easy to follow and after downloading the patch you can patch the kernel by executing in the kernel directory the command

       $bzcat /path/to/patch | patch -p1

Select the suspend2 configuration options in the kernel tree. Make sure LZF compression is built in in the Cryptographic routines section.

Compiling the kernel

In Debian this is easy to do using the kernel-package program. apt-get install kernel-package initramfs-tools fakeroot and in the kernel directory, you can execute

       $ make-kpkg --initrd --rootcmd fakeroot --append-to-version <system_name> --revision <2.6.x-y> --arch i386 kernel_image

and after a while the kernel .deb package is made. Make sure you have initramfs-tools installed and NOT yaird because suspend2 is not supported using yaird.

To get suspend2 to resume successfully, you will have to pass resume2=swap:/dev/hdax as a kernel parameter in /boot/grub/menu.lst

ACPI sleep drain and framebuffer problem

Thinkpad laptops with ATI radeon cards currently suffer from high ACPI sleep power drain. This is because, the radeon card doesn't shut down when the rest of the laptop goes to sleep. This is probably because the Radeon driver programmers are working in the dark due to ATI not fully releasing the specs of their card. This problem may be fixed in kernel 2.6.21 where the ACPI subsystem is rumored to be completely revamped.

Another problem is that the current implementation of the radeon power management (drivers/video/aty/radeon_pm.c) maintains a whitelist of thinkpad systems where the radeon card can be successfully shut off using a kernel parameter. However, this stopped working sometime in eary 2007 with an upgrade of the X.org server. Thus many have reported hangs as covered in [1]. For the time being, if you want to use the framebuffer, you will have to recompile your kernel with the Radeon driver built in. Pass video=radeonfb:ignore_devllist=1 as the kernel parameter in grub or lilo.

Sample kernel configuration in Grub

       title           Debian GNU/Linux, kernel 2.6.20-custom
       root            (hd0,0)
       kernel          /boot/vmlinuz-2.6.20-custom root=/dev/hda1 ro resume2=swap:/dev/hda5 video=radeonfb:ignore_devlist=1
       initrd          /boot/initrd.img-2.6.20-custom
       savedefault

ACPI sleep drain test script

You can test if your laptop suffers from the Radeon ACPI problems by running the script available at [2]. If your power drain during ACPI sleep is greather than 1W, its too much. When working correctly, power usage during ACPI sleep for most ATI cards is around 620 mW.

Enabling power management Fn keys

apt-get install acpi-support. Modify the scripts found in /etc/acpi/events to point to actions that will do the necessary function.

Enabling hibernate on closing lid

Modify /etc/acpi/actions/lm_lid.sh so that it points to /usr/sbin/hibernate when the lid is shut. The one on my system is listed below

        #!/bin/bash
        test -f /usr/sbin/laptop_mode || exit 0
        # lid button pressed/released event handler
        /usr/sbin/laptop_mode auto
        #!/bin/bash
         test -f /usr/sbin/laptop_mode || exit 0
        grep -q closed /proc/acpi/button/lid/*/state
        if [ $? = 0 ]
        then
        #        chvt 12
        #        rmmod uhci_hcd ehci_hcd usbhid
                /usr/sbin/hibernate
        else
                sleep 2
        #       modprobe uhci_hcd
        #       modprobe ehci_hcd
        #        modprobe usbhid
               chvt 7

CPU Frequency scaling

In debian this is really easy. With your default stock kernel, you can just modprobe cpufreq_userspace and speedstep_centrino and your CPU will dynamically change the frequency to conserver power. Very cool. Most of the time, my processor sits at 599 MHz. Again, add them to /etc/modules to enable them at bootup.

HDD spin down

Again in debian, this is really easy. Just apt-get laptop-mode-tools and powernowd and your HDD will spn down when idle to conserve power. Very cool.

Misc tweaks

You can use the powerplay feature of your Radeon GPU by adding the following in your /etc/X11/xorg.conf

       Section "Device"
               Identifier      "ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]"
               Driver          "ati"
               Option          "AGPMode" "4"
               Option          "EnablePageFlip" "on"
               Option          "RenderAccel" "on"
               Option          "DynamicClocks" "on"
               Option          "ColorTiling"   "on"
               BusID           "PCI:1:0:0"
               Option          "UseFBDev"              "true"
               Option          "BIOSHotkeys"           "on"
       EndSection

Check to see if DynamicClocks, etc are working by looking at /var/log/Xorg.0.log. These features doesn't work with XFree86.

Thinkpad buttons

You can get an online display for your screen brightness and volume control by apt-getting tpb. You need to make /dev/nvram user-writable to get it work with regular user perms. Add tpb to your .xsession file to have it running when you first start X. /dev/nvram can be made user-writable by adding yourself to the nvram group. This way you don't have to do it everytime you boot up.