Difference between revisions of "Installing Debian on a ThinkPad G41"

From ThinkWiki
Jump to: navigation, search
(Disk Preparation and Partitioning)
(External Sources)
 
(60 intermediate revisions by 8 users not shown)
Line 1: Line 1:
IBM does not provide the rescue/recovery CD set with this model so I suggest before anything else that you immediately boot into Windows and create the set.  You could always order one from IBM and pay $45.  The set from IBM consists of a "Rescue and Recovery" CD plus 6 "Product Recovery" CD's which contain the actual image that gets written to the hard drive.  As mentioned in other places the default drive image contains two VFAT partitions: one large Windows XP partition and one smaller recovery partition.  After creating the recovery CD set I recommend going into the BIOS and [[PreDesktop Area#Three BIOS options|setting the "IBM Predesktop Area" in the BIOS under "Security"]] to "Disabled" so that it can be removed.  It is pretty much useless.
+
==What to do with existing Windows partition?==
  
 +
I like to keep the Windows XP partition for at least a little while to run it and see how much development effort IBM (now Lenovo) has spent to make the user experience under Windows a full-featured one, complete with many assistant applications and helper utilities rich in multi-media content and graphics - in sharp contrast with what they provide for Linux users.  I don't really want to pontificate here - but I find it highly dissapointing that a large company with so much potential leverage quite frequently totally ignores non-Windows users - even while their Linux marketing scheme is running in full gear.  For example, IBM (now Lenovo) could easily have used the much better supported Lucent/Agere modem (as they did on some models in the past) rather than the piece of crap slmodem but no, why would they bother?  They could even have hired or at least given a donation to the folks who work on the Lucent driver since, in effect, those developers are indirectly benefiting IBM.  But no.  I guess they would rather spend the millions on marketing campaings saying how much they are behind Linux rather than actually supporting it.  The same thing goes for the fingerprint readers (although they are not included on the G41 models).
  
== Disk Preparation and Partitioning ==
+
IBM (Lenovo) does not provide the rescue/recovery CD set with this model so I suggest before anything else that you immediately boot into Windows and create the set if you think you will ever want to re-image the drive.  You could always order the set from IBM for $45.  The set from IBM consists of a "Rescue and Recovery" CD plus 6 "Product Recovery" CD's which contain the actual image that gets written to the hard drive. 
  
If you want to keep the Windows XP partition you should seriously consider whether you want it to be VFAT or NTFS, because on the very first bootup of the system it will automatically run a command to convert from VFAT to NTFS.  I recommend disabling the automatic conversion as per instructions [http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2004-February/016069.html here], i.e.:
+
After creating the recovery CD set I recommend going into the BIOS and setting the "IBM Predesktop Area" in the BIOS under "Security" to "Disabled".  This enables you to remove the “PreDesktop Environment” area, which is the second partition and takes over 3 GB of disk space.  The Predesktop Environment is not very useful unless you want to have the feature of being able to re-image your disk and re-install Windows from scratch.
  
boot into Knoppix, mount the XP partition, and move the following files:
+
==Notes on the model used in this setup==
 +
This info is for setting up Debian on a G41 with the following features:
 +
* Processor: Mobile Intel Pentium 4 Processor 548 with HT Technology
 +
* Graphics: NVIDIA GeForce FX Go5200 (nVidia Corporation NV34M)
 +
* Display: 1400x1050 SXGA+
 +
* Wireless: ThinkPad 11b/g Wi-Fi Wireless (Atheros Communications, Inc. AR5212 802.11abg)
 +
* Ethernet: Integrated Gigabit Ethernet (Broadcom Corporation NetXtreme BCM5705M_2)
 +
* Sound: SoundMAX (Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller)
  
*{{path<windows/system32/convert.exe}}
+
If your model does not have these features, then some or most of this information might not apply.
:{{cmdroot|mv /target/windows/system32/convert.exe /target/windows/system32/convert_.ex_}}
 
*{{path<windows/system32/autoconv.exe}}
 
:{{cmdroot|mv /target/windows/system32/autoconv.exe /target/windows/system32/autoconv_.ex_}}
 
*{{path|i386/convert.exe}}
 
:{{cmdroot|mv /target/i386/convert.exe /target/i386/convert_.ex_}}
 
*{{path|i386/autoconv.exe}}
 
:{{cmdroot|mv /target/i386/autoconv.exe /target/i386/autoconv_.ex_}}
 
  
Next, I ran the QTparted graphical disk partitioning tool to alter the partition layout of the drive.  I deleted the recovery partition (partition 2) and shrunk the XP partiion to 8 GB. QTParted will correctly resize the XP partition regardless of whether it is VFAT or NTFS. Finally, I created a 2300 MB swap partition as the second partition and used the remainder of the disk (partition 3) as one large XFS filesystem for Linux.  The reason I chose the high value for the swap partition size was so that it can accomodate suspend to disk, which requires a swap partition larger than the amount of installed RAM.
+
== Debian installation ==
 +
I installed {{Debian}} using an official i386 Debian minimal bootable CD netinst image obtained from http://www.us.debian.org/CD/netinst/
  
After this I installed {{Debian}} using an official i386 Debian minimal bootable CD netinst image obtained from http://www.us.debian.org/CD/netinst/
+
When the CD booted I pressed the {{key|F3}} key which gave instructions to type "expert26" at the boot prompt in order to install in expert mode using a more recent 2.6 Linux kernel.  I mostly accepted the defaults for all questions.  I did choose to "manually edit the partition table" and created a 2400MB swap partition as the first primary partiton, and the remainder of the disk was allocated to the root partition with the XFS filesystem.  I prefer XFS since it is both stable and consistently ranks among the top in disk benchmarks.  The only downside is that the version of grub included with Debian currently has a bug and cannot install on Debian (although there is a patch to fix the "grub-install" script <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=309218">here</a> therefore you must choose to install the Lilo boot loader instead.
  
When the CD booted I pressed the {{key|F3}} key which gave instructions to type "expert26" at the boot prompt in order to install in expert mode using a more recent 2.6 Linux kernel.  I accepted the defaults for all questions except that when it asked about partitioning the disk I chose the option to "manually edit the partition table".  This is because I already partitioned the disk with QTParted above and created the swap and XFS filesystems I plan to use.  So in the manual partition setup section I simply told it to use hda2 as swap and to use hda3 as xfs, assign the mount point "/" to it, and to format the filesystem.  Once this is done the rest is simple.  When it asked about making Linux bootable directly from the hard disk, it is important to NOT chose the Grub boot loader since the version included with the installer has a serious problem dealing with XFS filesystems.  Choose Lilo instead and everything will be fine.
+
After the first reboot during the install it asks to set up apt sources.  I chose to use http and selected a local mirror in my country.  It then asked if I want to choose packages to install and I said no.  My philosophy is to install Debian with the minimal amount of stuff, get it working, and then later on install any other applications I want.  Also if you plan on dist-upgrading from the "stable" version to the more current "testing" or "unstable" versions at this point it is easier and faster since you won't have to upgrade a zillion packages.  (I have used "unstable" happily for years - but then again I have a lot of experience troubleshooting and fixing problems - do not use unstable or testing unless you are prepared to spend a lot of time learning and troubleshooting or also sometimes waiting for long periods of time for unbroken versions of packages to replace broken ones - i.e., unless you have a lot of patience).
 
 
After the first reboot during the install it asks to set up apt sources.  I chose to use http and selected a local mirror in my country.  It then asked if I want to choose packages to install and I said no.  My philosophy is to install Debian with the minimal amount of stuff, get it working, and then later on install any other applications I want.  Also, if you plan on dist-upgrading from stable to testing or Sid then it is easier to do with only a minimal installation.
 
  
 
== Installing a few important packages ==
 
== Installing a few important packages ==
 
 
Here are a few important packages that it is good to install right away:
 
Here are a few important packages that it is good to install right away:
:{{cmdroot|apt-get install less vim}}
+
:{{cmdroot|apt-get install anacron less ssh vim nvi-}}
:{{cmdroot|apt-get remove --purge nvi}}
 
  
 
vim is a much better than nvi.  Less is much better than more which is installed by default.
 
vim is a much better than nvi.  Less is much better than more which is installed by default.
 +
 +
== Building a Linux kernel with [[Software Suspend 2]] Support==
 +
As of this writing [[Software Suspend 2|Software Suspend 2 (suspend2)] is the only working implementation of power-saving functionality available. ACPI sleep and standby modes and the in-kernel software suspend do not work with this model. [[Software Suspend 2]] provides a patch for the kernel. I went to http://www.suspend2.net/ and downloaded "Suspend2 2.2-rc15 for kernel 2.6.14" which is the latest stable version. (note, as of this writing Linux 2.6.15 was just released, so a newer version for that kernel should be coming out soon.  Get whatever version supports the most recent stable Linux kernel release)  I downloaded the Suspend2 source into /usr/local/src/swsusp2 and untar/gziped it.  This gives you a directory /usr/local/src/swsusp2/suspend2-2.2-rc15-for-2.6.14 
 +
 +
You will also need the hibernate script.  The easist way to install it and make sure you have the most recent is to add the following lines to /etc/apt/sources.list:
 +
 +
# hibernate script for swsusp2
 +
deb http://cp.yi.org/apt/hibernate ./
 +
 +
then run "apt-get update && apt-get install hibernate"
 +
 +
You also will want to have at least the text-based suspend2-userui which shows the status when hibernating and resuming, available at http://www.suspend2.net/downloads/
 +
 +
 +
===Preparing for the kernel build===
 +
There are a few packages that must be installed prior to compiling a kernel:
 +
:{{cmdroot|apt-get install ncftp build-essential bin86 libncurses-dev bzip2}}
 +
 +
===Getting the kernel source===
 +
Use an ftp client like ncftp to retrieve linux-2.6.14.tar.bz2 from
 +
ftp://ftp.kernel.org/pub/linux/kernel/v2.6
 +
 +
:{{cmdroot|cd /usr/src}}
 +
:{{cmdroot|ncftp}}
 +
::{{cmd|open ftp.kernel.org|ncftp> }}
 +
::{{cmd|cd pub/linux/kernel/v2.6|ncftp> }}
 +
::{{cmd|get linux-2.6.14.tar.bz2|ncftp> }}
 +
::{{cmd|bye|ncftp> }}
 +
 +
===Unpack the kernel, configure, and compile===
 +
:{{cmdroot|tar -xjf linux-2.6.14.tar.bz2}}
 +
At this point I prefer to rename the kernel source tree so that if at some point in the future I wish to build another kernel version, I can do so in a separate tree.
 +
:{{cmdroot|mv linux-2.6.14 linux-2.6.13-smp}}
 +
I chose to append the name of the kernel with “-smp” as a shorthand for “Symmetric Multi-Processing”. This Pentium 4 CPU supports hyperthreading which when enabled causes the single CPU to appear as 2 separate CPUs which makes the system an SMP system. H
 +
 +
Next, edit the Makefile in the top level of the kernel source and change the line EXTRAVERSION so that it reads: <tt>EXTRAVERSION = -smp</tt>
 +
 +
And configure the kernel:
 +
:{{cmdroot|cd linux}}
 +
:{{cmdroot|make menuconfig}}
 +
 +
Now we must apply the swsusp2 kernel patch.  From the top-level of the unpacked kernel source directory run the command /usr/local/src/swsusp2/suspend2-2.2-rc15-for-2.6.14/apply
 +
 +
Prior to configuring the kernel it is important to have an inventory of the components in your system. Here is a list of the most important components in terms of how Linux sees them and what should be enabled in the kernel.
 +
 +
*Intel Pentium 4 PC-compatible processor.
 +
* Symmetric multi-processing support
 +
* Maximum number of CPUs
 +
* SMT (Hyperthreading) scheduler support
 +
* Timer frequency: 250 Hz
 +
* Suspend2
 +
*    File Writer
 +
*    Swap Writer
 +
*    Default resume device name (/dev/hda2 (or whatever partition you created for the root filesystem))
 +
* Support for hot-pluggable CPUs (very important for swsusp2 to resume)
 +
* ACPI interface supporting CPU frequency scaling
 +
* PCI bridge
 +
* ISA bridge
 +
* CardBus yenta-compatible PC Card controller
 +
* PC-style parallel port
 +
* Intel Ultra ATA ICH4 Storage Controller (IDE interface)
 +
* Broadcom Tigon3 1000 Mbit ethernet controller
 +
* PS/2 Mouse interface
 +
* 8250/16550 compatible serial port
 +
* Enhanced Real Time Clock Support (important for SMP)
 +
* Intel 855GM AGP chipset
 +
* Intel 82801 (ICH) SMBus (I2C)
 +
* VESA 2.0 compatible graphics chipset
 +
* Intel AC97 Audio controller
 +
* Intel MC97 Modem
 +
* Intel UHCI USB controller
 +
* Intel EHCI USB 2.0 controller
 +
 +
 +
There are a few important things in the kernel config to be aware of. 
 +
 +
* Power Management/ACPI - IBM Laptop extras:  You can either select this now, or not select it and manually build the kernel module using the latest source (available <a href="http://ibm-acpi.sourceforge.net/"> here</a>).  I chose to not enable it (ibm_acpi) in order to build a newer version later.
 +
* under ATA support be sure to select Intel PIIXn chipsets support
 +
* You must enable Direct Rendering Manager support (without selecting any of the driver modules, since we will build our own later)
 +
* In the Graphics section select VESA VGA graphics support but DO NOT select nVidia Framebuffer Support as it interferes with the nvidia DRM driver we will install below
 +
* There are a zillion options in the Linux kernel, and as it grows the list gets longer and longer.  Do not get overwhelemed.  Once you go through and read about options and select the ones you need you can save your kernel .config and use it later to build future kernels.  I find it very imformative to know what the Linux kernel is capable of, even if I do not use most of the features.
  
  
== Setting up graphics ==
+
:{{cmdroot|cp .config ../dot-config-2.6.14-smp}}  #save a copy of the .config for future use
 +
:{{cmdroot|make}}
 +
:{{cmdroot|make modules_install}}
 +
:{{cmdroot|cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.14-smp}}
 +
:{{cmdroot|cp System.map /boot/System.map-2.6.14-smp}}
 +
:{{cmdroot|vi /etc/lilo.conf}}
  
First, it is necessary to install the minimal essential components necessary to get the graphical environment working:
 
:{{cmdroot|apt-get install x-window-system-core}}
 
  
Then you need to set up the nvidia driverThe easiest way to do this is with the module-assistant utility:
+
#lilo stanza for image from {{path|lilo.conf}}
 +
image=/boot/vmlinuz-2.6.14-smp
 +
# set the resume2 partition to whatever your swap partition is below:
 +
append="resume2=swap:/dev/hda2" #needed for swsusp2 to work
 +
label=2.6.14-smp
 +
  # the following sets the console to framebuffer mode 1280x1024
 +
# you must have “VESA VGA graphics support” selected
 +
# in the kernel under Device Drivers -> Graphics support
 +
# otherwise set to “1” or “normal”
 +
vga=0x31B
 +
read-only
  
  apt-get install module-assistant
+
Then run {{cmdroot|lilo}} to install it to the MBR.
  m-a prepare
+
Now it should be possible to boot into the new 2.6.14-smp kernel.
  m-a a-i nvidia
 
  apt-get install nvidia-glx nvidia-settings
 
  echo nvidia >> /etc/modules
 
  modprobe nvidia
 
  dpkg-reconfigure xserver-xfree86 
 
  #if you are using Sid, then use dpkg-reconfigure xserver-xorg
 
  
At this point you should be able to start X from the command line with the startx command.  But there it will not look very appealing.  Install a window manager/desktop environment, e.g.,
+
== Setting up graphics ==
 +
First, it is necessary to install the minimal essential components necessary to get the graphical environment working:
 +
:{{cmdroot|apt-get install x-window-system-core}}
  
  apt-get install openbox fbpanel
+
===Setting up the proprietary nvidia driver (optional)===
 +
The easiest way to install the proprietary nvidia driver this is with Debian's module-assistant utility:
  
and then have these invoked when you run start X by creating a .xsession file in your home directory:
+
:{{cmdroot|apt-get install module-assistant}}
 +
:{{cmdroot|m-a prepare}}
 +
:{{cmdroot|m-a a-i nvidia}}
 +
:{{cmdroot|apt-get install nvidia-glx nvidia-settings}}
 +
:{{cmdroot|echo nvidia >> /etc/modules}}
 +
:{{cmdroot|modprobe nvidia}}
  
  #!/bin/sh
+
===Configuring the X server===
  # ~/.xsession: stuff to do when starting X
+
:{{cmdroot|dpkg-reconfigure xserver-xfree86}}
  #
+
If you are using Sid, then use :{{cmdroot|dpkg-reconfigure xserver-xorg}}.
  xsetroot -solid DarkSlateGrey  #set the background
 
  xset m 4 1  # increase the mouse sensitivity a bit, good for Trackpoints
 
  fbpanel &  #run fbpanel
 
  exec openbox  # run openbox, our window manager
 
  
The next thing I did is immediately build my own kernelThis involved installing:
+
This will ask a lot of questions about X setup.  Here are options I selected:
:{{cmdroot|apt-get install ncftp build-essential bin86 libncurses-dev bzip2}}
+
* allow it to attempt to autodetect video hardware. It will automatically select the "nv" driver, which is the one we want if we are going to use [[Software Suspend 2]]. Unfortunately this driver does not support OpenGL so you have to choose between 3D graphics acceleration or the ability to suspend-to-disk. If however you decide you want the nvidia driver scroll down one and select it.
 +
* leave video RAM setting blankX server will autodetect it
 +
* do NOT use kernel framebuffer interface
 +
* for keyboard layout do not select default "us" value, but replace with "intl" (this is better because it also supports multi-key on the right-alt key)
 +
* XKB rule set accept default value
 +
* for keyboard model replace "pc105" with "pc102"
 +
* attempt mouse autodetection and use the default /dev/input/mouse
 +
* Mouse protocol: select ImPS/2 (should be default)
 +
* yes to emulate 3 button mouse
 +
* yes to enable scroll events
 +
* accept all modules (default)
 +
* under display setup, select only mode 1400x1050
 +
* under choose method, select medium
 +
* select 1400x1050 @ 75Hz
 +
* select default color depth of 24 (you can select 16 which is slightly lower, and might give slightly better performance)
  
I then used ncftp to retreive linux-2.6.12.tar.bz2 from ftp.kernel.org/pub/linux/kernel/v2.6
+
At this point you should be able to start X from the command line with the startx command. But it will not look very appealing. Install a window manager/desktop environment, e.g.
  
  cd /usr/src
+
:{{cmdroot|apt-get install openbox obconf openbox-themes fbpanel}}
  ncftp
+
And some fonts to go along with it:
        open ftp.kernel.org
 
        cd pub/linux/kernel/v2.6
 
        get linux-2.6.12.tar.bz2
 
        bye
 
  
    tar -xjf linux-2.6.12.tar.bz2
+
:{{cmdroot|apt-get install ttf-dustin ttf-freefont ttf-opensymbol ttf-thryomanes \
    ln -s linux-2.6.12 linux
+
ttf-xfree86-nonfree xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi \
    cd linux
+
xfonts-75dpi-transcoded xfonts-artwiz xfonts-base xfonts-base-transcoded \
    make menuconfig
+
xfonts-biznet-100dpi xfonts-biznet-75dpi xfonts-biznet-base xfonts-scalable \
    ...
+
defoma fontconfig}}
    ...
 
    cp .config ../dot-config-2.6.12  #good to save a copy
 
    make
 
    make modules_install
 
    cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.12
 
    cp System.map /boot/System.map-2.6.12
 
    vi /etc/lilo.conf
 
          #stanza for image from lilo.conf
 
          image=/boot/vmlinuz-2.6.12
 
              label=2.6.12
 
              read-only
 
  
    lilo
+
For the fontconfig debconf question I chose to use Freetype<br><br>
  
 +
Then create a {{path|.xsession}} file in your home directory to invoke openbox/fbpanel when you run "startx":
  
 +
  #!/bin/sh
 +
  # ~/.xsession: stuff to do when starting X
 +
  #
 +
  #set the background
 +
  xsetroot -solid DarkSlateGrey
 +
  # increase the mouse sensitivity a bit, good for Trackpoints
 +
  xset m 4 1
 +
  #run fbpanel             
 +
  fbpanel &   
 +
  # run openbox, our window manager                             
 +
  exec openbox                         
  
 
== Setting up the Wireless driver ==
 
== Setting up the Wireless driver ==
 
+
lspci listing should show the Atheros Communications 802.11abg adapter.  Here is how to get it working using the [http://madwifi.sourceforge.net/ madwifi] driver:
lspci listing should show the Atheros Communications 802.11abg adapter.  This is how to get it working using the [http://madwifi.sourceforge.net/ madwifi] driver:
 
  
 
:{{cmdroot|apt-get install cvs}}
 
:{{cmdroot|apt-get install cvs}}
Line 108: Line 208:
 
:{{cmdroot|modprobe ath_pci}}
 
:{{cmdroot|modprobe ath_pci}}
  
:{{cmdroot|apt-get install wireless-tools}}  (you will need these to configure the interface)
+
:{{cmdroot|apt-get install wireless-tools dhcp3-client}}
:{{cmdroot|apt-get install dhcp3-client}} (dhcp client for use with wireless access points)
 
  
 
See {{path|/usr/local/src/madwifi/README}} for useful information about the configuring the interface.
 
See {{path|/usr/local/src/madwifi/README}} for useful information about the configuring the interface.
  
:{{cmdroot|iwlist ath0 scan}}  (scan for available access points (APs))
+
Before running any of the wireless utilities and configuring it you may need to bring the interface up first:
 +
:{{cmdroot|ifconfig ath0 up}} 
 +
The easiest way to configure the interface is to install kwifimanager
 +
:{{cmdroot|apt-get install kwifimanager}} 
 +
Once I scanned and had a list of access points (using :{{cmdroot|iwlist ath0 scan}}) basically all I had to do was go into the “Settings” menu and select “Configuration Editor”.  In there under “Network Name” enter the SSID of an access point, which is the name of the wireless network (not the BSSID which is the long hex address).  Make sure that “ath0” is selected in the “Settings apply to interface” text box (click “Autodetect” button and it should show up).  After activating the config it should associate with the AP.  Then run dhclient on the interface to obtain an IP address from the access point:
 +
:{{cmdroot|dhclient ath0}}
 +
 
 +
== Setting up sound ==
 +
 
 +
The ALSA sound module is snd_intel8x0m
 +
 
 +
:{{cmdroot|apt-get install alsa-base alsa-utils alsamixergui}}
 +
:{{cmdroot|alsaconfig}}
 +
 
 +
 
 +
== Power management ==
 +
 
 +
According to power/video.txt in the Linux kernel source documentation ACPI suspend-to-RAM mode (a.k.a. "Standby" or "Sleep") does not and can not work with Hyperthreading CPUs:
 +
 
 +
"S3 has absolutely no chance of working with SMP/HT. Be sure it to turn it off before testing (swsusp should work ok, OTOH)."
 +
 
 +
In order to get [[Software Suspend 2]] fully working you also need to download and install the hibernate-script from the [http://www.suspend2.net/downloads/ Software Suspend 2 site]. This will install a shell script called "hibernate" in {{path|/usr/local/sbin}} and also a configuration directory {{path|/etc/hibernate}}. Once installed, if your kernel was configured correctly, you should be able to run the command {{cmdroot|hibernate}}. The system will save the current contents of RAM to the swap partiton (make sure you have set the correct {{bootparm|resume2|swap:}} parameter in your bootloader config or else it will not work). The next time you restart the system it will detect that the swap partition contains the suspended information and automatically restore the system. If there is a problem with [[Software Suspend 2]] it may freeze while resuming. The only time that I personally experienced a resume problem was when I was running the {{cmdroot|top}} command in a gnome-terminal during a suspend operation.
 +
 
 +
===ibm-acpi===
 +
It is probably worth installing the latest [[ibm-acpi]], which adds functionality for {{key|Fn}} key combinations, allows setting of threshold temperatures for fans, and more.  As of this writing much of this functionality is untested or unknown on the {{G41}}. Still it doesn't hurt to install it:
 +
 
 +
Go to the [http://ibm-acpi.sourceforge.net/ IBM-acpi driver website] and download the latest driver (0.11 as of this writing) into {{path|/usr/local/src}}.
 +
 
 +
:{{cmdroot|tar -xzf ibm-acpi-0.11.tar.gz}}
 +
:{{cmdroot|cd ibm-acpi-0.11}}
 +
:{{cmdroot|make}}
 +
:{{cmdroot|make install}}
 +
:{{cmdroot|modprobe ibm_acpi}}
 +
:{{cmdroot|echo "ibm_acpi" >> /etc/modules}}
 +
 
 +
You can see the currently installed version with:
 +
:{{cmdroot|cat /proc/acpi/ibm/driver}}
 +
 
 +
== Additional stuff ==
 +
[http://www.nongnu.org/tpb/ tpb] is a neat program that enables the on-screen display for certain keys functions such as the volume control and LCD brightness levels. {{cmdroot|apt-get install tpb}} and then edit {{path|/etc/tpbrc}}.
 +
 
 +
{{Todo|This page still needs a section on configuring the modem.  The last time I tested on another Thinkpad model, neither the Open-Source nor the proprietary driver for the "slmodem" Intel AC'97 Modem Controller seemed to work to well.  Fortunately I have a miniPCI card with a true Lucent WinModem which uses the "alk" driver available [http://linmodems.technion.ac.il/packages/ltmodem/kernel-2.6/ here].  If you are planning to use the modem a lot it may be worth the $5 to pick one of these up on Ebay as it is much easier to configure and works quite reliably under Linux.}}
 +
 
 +
 
 +
==Going further with Debian==
 +
At this point you can install whatever you want on your system.  You will want to run X on it so:
 +
 
 +
apt-get install x-window-system-core
 +
 
 +
If you need to reconfigure the X server then:
 +
 
 +
dpkg-reconfigure xserver-xfree86 (or xserver-xorg for testing/unstable)
 +
 
 +
You can install a desktop environment such as kde with "apt-get install kde" although you may want to only install "kdebase" and then add whatever additional components you want.
  
Write down a list of the strongest APs, including essid and hexadecimal hardware address
+
Check out the excellent Debian Reference at: http://www.debian.org/doc/manuals/reference/reference.en.html (can also be installed "apt-get install debian-reference-en"
  
:{{cmdroot|/sbin/ifconfig ath0 up}}
+
=External Sources=
:{{cmdroot|iwconfig ath0 mode 0}}  (mode: 1 = 11a  2 = 11b  3 = 11g  0 = autoselect)
+
* [http://www.linlap.com/wiki/IBM-Lenovo+Thinkpad+G41 General Linux guide to the ThinkPad G41]
:{{cmdroot|iwconfig ath0 essid "foo"}}  (use AP with essid "foo")
+
*This guide is listed at the [http://tuxmobil.org/ibm.html TuxMobil Linux laptop and notebook installation survey (IBM/Lenovo)].
:{{cmdroot|iwconfig ath0 ap 01:23:45:67:89:AB}}  (associate with hw address of AP "foo")
 
:{{cmdroot|dhclient3 ath0}}
 
  
 
[[Category:G41]]
 
[[Category:G41]]

Latest revision as of 14:51, 1 March 2008

What to do with existing Windows partition?

I like to keep the Windows XP partition for at least a little while to run it and see how much development effort IBM (now Lenovo) has spent to make the user experience under Windows a full-featured one, complete with many assistant applications and helper utilities rich in multi-media content and graphics - in sharp contrast with what they provide for Linux users. I don't really want to pontificate here - but I find it highly dissapointing that a large company with so much potential leverage quite frequently totally ignores non-Windows users - even while their Linux marketing scheme is running in full gear. For example, IBM (now Lenovo) could easily have used the much better supported Lucent/Agere modem (as they did on some models in the past) rather than the piece of crap slmodem but no, why would they bother? They could even have hired or at least given a donation to the folks who work on the Lucent driver since, in effect, those developers are indirectly benefiting IBM. But no. I guess they would rather spend the millions on marketing campaings saying how much they are behind Linux rather than actually supporting it. The same thing goes for the fingerprint readers (although they are not included on the G41 models).

IBM (Lenovo) does not provide the rescue/recovery CD set with this model so I suggest before anything else that you immediately boot into Windows and create the set if you think you will ever want to re-image the drive. You could always order the set from IBM for $45. The set from IBM consists of a "Rescue and Recovery" CD plus 6 "Product Recovery" CD's which contain the actual image that gets written to the hard drive.

After creating the recovery CD set I recommend going into the BIOS and setting the "IBM Predesktop Area" in the BIOS under "Security" to "Disabled". This enables you to remove the “PreDesktop Environment” area, which is the second partition and takes over 3 GB of disk space. The Predesktop Environment is not very useful unless you want to have the feature of being able to re-image your disk and re-install Windows from scratch.

Notes on the model used in this setup

This info is for setting up Debian on a G41 with the following features:

  • Processor: Mobile Intel Pentium 4 Processor 548 with HT Technology
  • Graphics: NVIDIA GeForce FX Go5200 (nVidia Corporation NV34M)
  • Display: 1400x1050 SXGA+
  • Wireless: ThinkPad 11b/g Wi-Fi Wireless (Atheros Communications, Inc. AR5212 802.11abg)
  • Ethernet: Integrated Gigabit Ethernet (Broadcom Corporation NetXtreme BCM5705M_2)
  • Sound: SoundMAX (Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller)

If your model does not have these features, then some or most of this information might not apply.

Debian installation

I installed Debian using an official i386 Debian minimal bootable CD netinst image obtained from http://www.us.debian.org/CD/netinst/

When the CD booted I pressed the F3 key which gave instructions to type "expert26" at the boot prompt in order to install in expert mode using a more recent 2.6 Linux kernel. I mostly accepted the defaults for all questions. I did choose to "manually edit the partition table" and created a 2400MB swap partition as the first primary partiton, and the remainder of the disk was allocated to the root partition with the XFS filesystem. I prefer XFS since it is both stable and consistently ranks among the top in disk benchmarks. The only downside is that the version of grub included with Debian currently has a bug and cannot install on Debian (although there is a patch to fix the "grub-install" script <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=309218">here</a> therefore you must choose to install the Lilo boot loader instead.

After the first reboot during the install it asks to set up apt sources. I chose to use http and selected a local mirror in my country. It then asked if I want to choose packages to install and I said no. My philosophy is to install Debian with the minimal amount of stuff, get it working, and then later on install any other applications I want. Also if you plan on dist-upgrading from the "stable" version to the more current "testing" or "unstable" versions at this point it is easier and faster since you won't have to upgrade a zillion packages. (I have used "unstable" happily for years - but then again I have a lot of experience troubleshooting and fixing problems - do not use unstable or testing unless you are prepared to spend a lot of time learning and troubleshooting or also sometimes waiting for long periods of time for unbroken versions of packages to replace broken ones - i.e., unless you have a lot of patience).

Installing a few important packages

Here are a few important packages that it is good to install right away:

# apt-get install anacron less ssh vim nvi-

vim is a much better than nvi. Less is much better than more which is installed by default.

Building a Linux kernel with Software Suspend 2 Support

As of this writing [[Software Suspend 2|Software Suspend 2 (suspend2)] is the only working implementation of power-saving functionality available. ACPI sleep and standby modes and the in-kernel software suspend do not work with this model. Software Suspend 2 provides a patch for the kernel. I went to http://www.suspend2.net/ and downloaded "Suspend2 2.2-rc15 for kernel 2.6.14" which is the latest stable version. (note, as of this writing Linux 2.6.15 was just released, so a newer version for that kernel should be coming out soon. Get whatever version supports the most recent stable Linux kernel release) I downloaded the Suspend2 source into /usr/local/src/swsusp2 and untar/gziped it. This gives you a directory /usr/local/src/swsusp2/suspend2-2.2-rc15-for-2.6.14

You will also need the hibernate script. The easist way to install it and make sure you have the most recent is to add the following lines to /etc/apt/sources.list:

  1. hibernate script for swsusp2

deb http://cp.yi.org/apt/hibernate ./

then run "apt-get update && apt-get install hibernate"

You also will want to have at least the text-based suspend2-userui which shows the status when hibernating and resuming, available at http://www.suspend2.net/downloads/


Preparing for the kernel build

There are a few packages that must be installed prior to compiling a kernel:

# apt-get install ncftp build-essential bin86 libncurses-dev bzip2

Getting the kernel source

Use an ftp client like ncftp to retrieve linux-2.6.14.tar.bz2 from ftp://ftp.kernel.org/pub/linux/kernel/v2.6

# cd /usr/src
# ncftp
ncftp> open ftp.kernel.org
ncftp> cd pub/linux/kernel/v2.6
ncftp> get linux-2.6.14.tar.bz2
ncftp> bye

Unpack the kernel, configure, and compile

# tar -xjf linux-2.6.14.tar.bz2

At this point I prefer to rename the kernel source tree so that if at some point in the future I wish to build another kernel version, I can do so in a separate tree.

# mv linux-2.6.14 linux-2.6.13-smp

I chose to append the name of the kernel with “-smp” as a shorthand for “Symmetric Multi-Processing”. This Pentium 4 CPU supports hyperthreading which when enabled causes the single CPU to appear as 2 separate CPUs which makes the system an SMP system. H

Next, edit the Makefile in the top level of the kernel source and change the line EXTRAVERSION so that it reads: EXTRAVERSION = -smp

And configure the kernel:

# cd linux
# make menuconfig

Now we must apply the swsusp2 kernel patch. From the top-level of the unpacked kernel source directory run the command /usr/local/src/swsusp2/suspend2-2.2-rc15-for-2.6.14/apply

Prior to configuring the kernel it is important to have an inventory of the components in your system. Here is a list of the most important components in terms of how Linux sees them and what should be enabled in the kernel.

  • Intel Pentium 4 PC-compatible processor.
  • Symmetric multi-processing support
  • Maximum number of CPUs
  • SMT (Hyperthreading) scheduler support
  • Timer frequency: 250 Hz
  • Suspend2
  • File Writer
  • Swap Writer
  • Default resume device name (/dev/hda2 (or whatever partition you created for the root filesystem))
  • Support for hot-pluggable CPUs (very important for swsusp2 to resume)
  • ACPI interface supporting CPU frequency scaling
  • PCI bridge
  • ISA bridge
  • CardBus yenta-compatible PC Card controller
  • PC-style parallel port
  • Intel Ultra ATA ICH4 Storage Controller (IDE interface)
  • Broadcom Tigon3 1000 Mbit ethernet controller
  • PS/2 Mouse interface
  • 8250/16550 compatible serial port
  • Enhanced Real Time Clock Support (important for SMP)
  • Intel 855GM AGP chipset
  • Intel 82801 (ICH) SMBus (I2C)
  • VESA 2.0 compatible graphics chipset
  • Intel AC97 Audio controller
  • Intel MC97 Modem
  • Intel UHCI USB controller
  • Intel EHCI USB 2.0 controller


There are a few important things in the kernel config to be aware of.

  • Power Management/ACPI - IBM Laptop extras: You can either select this now, or not select it and manually build the kernel module using the latest source (available <a href="http://ibm-acpi.sourceforge.net/"> here</a>). I chose to not enable it (ibm_acpi) in order to build a newer version later.
  • under ATA support be sure to select Intel PIIXn chipsets support
  • You must enable Direct Rendering Manager support (without selecting any of the driver modules, since we will build our own later)
  • In the Graphics section select VESA VGA graphics support but DO NOT select nVidia Framebuffer Support as it interferes with the nvidia DRM driver we will install below
  • There are a zillion options in the Linux kernel, and as it grows the list gets longer and longer. Do not get overwhelemed. Once you go through and read about options and select the ones you need you can save your kernel .config and use it later to build future kernels. I find it very imformative to know what the Linux kernel is capable of, even if I do not use most of the features.


# cp .config ../dot-config-2.6.14-smp #save a copy of the .config for future use
# make
# make modules_install
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.14-smp
# cp System.map /boot/System.map-2.6.14-smp
# vi /etc/lilo.conf


#lilo stanza for image from lilo.conf
image=/boot/vmlinuz-2.6.14-smp
# set the resume2 partition to whatever your swap partition is below:
append="resume2=swap:/dev/hda2" #needed for swsusp2 to work
label=2.6.14-smp
# the following sets the console to framebuffer mode 1280x1024
# you must have “VESA VGA graphics support” selected
# in the kernel under Device Drivers -> Graphics support
# otherwise set to “1” or “normal”
vga=0x31B 
read-only

Then run # lilo to install it to the MBR. Now it should be possible to boot into the new 2.6.14-smp kernel.

Setting up graphics

First, it is necessary to install the minimal essential components necessary to get the graphical environment working:

# apt-get install x-window-system-core

Setting up the proprietary nvidia driver (optional)

The easiest way to install the proprietary nvidia driver this is with Debian's module-assistant utility:

# apt-get install module-assistant
# m-a prepare
# m-a a-i nvidia
# apt-get install nvidia-glx nvidia-settings
# echo nvidia >> /etc/modules
# modprobe nvidia

Configuring the X server

# dpkg-reconfigure xserver-xfree86

If you are using Sid, then use :# dpkg-reconfigure xserver-xorg.

This will ask a lot of questions about X setup. Here are options I selected:

  • allow it to attempt to autodetect video hardware. It will automatically select the "nv" driver, which is the one we want if we are going to use Software Suspend 2. Unfortunately this driver does not support OpenGL so you have to choose between 3D graphics acceleration or the ability to suspend-to-disk. If however you decide you want the nvidia driver scroll down one and select it.
  • leave video RAM setting blank. X server will autodetect it
  • do NOT use kernel framebuffer interface
  • for keyboard layout do not select default "us" value, but replace with "intl" (this is better because it also supports multi-key on the right-alt key)
  • XKB rule set accept default value
  • for keyboard model replace "pc105" with "pc102"
  • attempt mouse autodetection and use the default /dev/input/mouse
  • Mouse protocol: select ImPS/2 (should be default)
  • yes to emulate 3 button mouse
  • yes to enable scroll events
  • accept all modules (default)
  • under display setup, select only mode 1400x1050
  • under choose method, select medium
  • select 1400x1050 @ 75Hz
  • select default color depth of 24 (you can select 16 which is slightly lower, and might give slightly better performance)

At this point you should be able to start X from the command line with the startx command. But it will not look very appealing. Install a window manager/desktop environment, e.g.

# apt-get install openbox obconf openbox-themes fbpanel

And some fonts to go along with it:

# apt-get install ttf-dustin ttf-freefont ttf-opensymbol ttf-thryomanes \

ttf-xfree86-nonfree xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi \ xfonts-75dpi-transcoded xfonts-artwiz xfonts-base xfonts-base-transcoded \ xfonts-biznet-100dpi xfonts-biznet-75dpi xfonts-biznet-base xfonts-scalable \ defoma fontconfig

For the fontconfig debconf question I chose to use Freetype

Then create a .xsession file in your home directory to invoke openbox/fbpanel when you run "startx":

  #!/bin/sh
  # ~/.xsession: stuff to do when starting X
  #
  #set the background
  xsetroot -solid DarkSlateGrey 
  # increase the mouse sensitivity a bit, good for Trackpoints
  xset m 4 1
  #run fbpanel               
  fbpanel &    
  # run openbox, our window manager                               
  exec openbox                          

Setting up the Wireless driver

lspci listing should show the Atheros Communications 802.11abg adapter. Here is how to get it working using the madwifi driver:

# apt-get install cvs
# cd /usr/local/src
# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
# cd madwifi
# make && make install
# modprobe ath_pci
# apt-get install wireless-tools dhcp3-client

See /usr/local/src/madwifi/README for useful information about the configuring the interface.

Before running any of the wireless utilities and configuring it you may need to bring the interface up first:

# ifconfig ath0 up

The easiest way to configure the interface is to install kwifimanager

# apt-get install kwifimanager

Once I scanned and had a list of access points (using :# iwlist ath0 scan) basically all I had to do was go into the “Settings” menu and select “Configuration Editor”. In there under “Network Name” enter the SSID of an access point, which is the name of the wireless network (not the BSSID which is the long hex address). Make sure that “ath0” is selected in the “Settings apply to interface” text box (click “Autodetect” button and it should show up). After activating the config it should associate with the AP. Then run dhclient on the interface to obtain an IP address from the access point:

# dhclient ath0

Setting up sound

The ALSA sound module is snd_intel8x0m

# apt-get install alsa-base alsa-utils alsamixergui
# alsaconfig


Power management

According to power/video.txt in the Linux kernel source documentation ACPI suspend-to-RAM mode (a.k.a. "Standby" or "Sleep") does not and can not work with Hyperthreading CPUs:

"S3 has absolutely no chance of working with SMP/HT. Be sure it to turn it off before testing (swsusp should work ok, OTOH)."

In order to get Software Suspend 2 fully working you also need to download and install the hibernate-script from the Software Suspend 2 site. This will install a shell script called "hibernate" in /usr/local/sbin and also a configuration directory /etc/hibernate. Once installed, if your kernel was configured correctly, you should be able to run the command # hibernate. The system will save the current contents of RAM to the swap partiton (make sure you have set the correct resume2=swap: parameter in your bootloader config or else it will not work). The next time you restart the system it will detect that the swap partition contains the suspended information and automatically restore the system. If there is a problem with Software Suspend 2 it may freeze while resuming. The only time that I personally experienced a resume problem was when I was running the # top command in a gnome-terminal during a suspend operation.

ibm-acpi

It is probably worth installing the latest ibm-acpi, which adds functionality for Fn key combinations, allows setting of threshold temperatures for fans, and more. As of this writing much of this functionality is untested or unknown on the G41. Still it doesn't hurt to install it:

Go to the IBM-acpi driver website and download the latest driver (0.11 as of this writing) into /usr/local/src.

# tar -xzf ibm-acpi-0.11.tar.gz
# cd ibm-acpi-0.11
# make
# make install
# modprobe ibm_acpi
# echo "ibm_acpi" >> /etc/modules

You can see the currently installed version with:

# cat /proc/acpi/ibm/driver

Additional stuff

tpb is a neat program that enables the on-screen display for certain keys functions such as the volume control and LCD brightness levels. # apt-get install tpb and then edit /etc/tpbrc.

TODO
This page still needs a section on configuring the modem. The last time I tested on another Thinkpad model, neither the Open-Source nor the proprietary driver for the "slmodem" Intel AC'97 Modem Controller seemed to work to well. Fortunately I have a miniPCI card with a true Lucent WinModem which uses the "alk" driver available here. If you are planning to use the modem a lot it may be worth the $5 to pick one of these up on Ebay as it is much easier to configure and works quite reliably under Linux.


Going further with Debian

At this point you can install whatever you want on your system. You will want to run X on it so:

apt-get install x-window-system-core

If you need to reconfigure the X server then:

dpkg-reconfigure xserver-xfree86 (or xserver-xorg for testing/unstable)

You can install a desktop environment such as kde with "apt-get install kde" although you may want to only install "kdebase" and then add whatever additional components you want.

Check out the excellent Debian Reference at: http://www.debian.org/doc/manuals/reference/reference.en.html (can also be installed "apt-get install debian-reference-en"

External Sources