Installing Gentoo on a ThinkPad R51-1830
NOTE!
NOTE!
NOTE!
Last update 18:57, 22 August 2007 (UTC)
|
Introduction
This page shows some parts of how I did once install Gentoo Linux on my ThinkPad. Since the R51 is now quite outdated (2005) everyone having such a laptop surely has his/her system installed already. So why this page?
Mainly out of interest and for fun.
The plan is to update the instructions on how to get the hardware running on a recent Gentoo Linux system. So it should be useful to everyone, even if he/she doesn't use a R51.
If you also own a Thinkpad R51 (machine types 1829, 1830, 1831 and 1836) feel free to add what you think is missing.
System specifications
Machine: IBM ThinkPad R51 1830-DG4
- Pentium M 1.7 GHz
- Chipset: Intel 855PM
- Southbridge: 82801DBM ICH4-M
- Northbridge: 82855PM MCH
- 2 GB PC2700 DDR RAM (I upgraded by 2×1 GB DIMMs, the existing 512 MB DIMM had to be removed)
- 250 GB Western Digital HDD (upgraded, not original)
lspci:
00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03) 00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03) 00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01) 00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01) 00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01) 00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81) 00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01) 00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01) 00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01) 00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01) 00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01) 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV250 [Mobility FireGL 9000] (rev 02) 02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01) 02:00.2 FireWire (IEEE 1394): Texas Instruments Unknown device 802a (rev 01) 02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03) 02:02.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05)
Installation
Preparation
The laptop originally came with an 80 GB Hitachi hard disk drive.
TpUser0@localhost # fdisk -l /dev/hdc Disk /dev/hdc: 80.0 GB, 80026361856 bytes 240 heads, 63 sectors/track, 10337 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes Device Boot Start End Blocks Id System /dev/hdc1 * 1 9736 73604128+ c W95 FAT32 (LBA) /dev/hdc2 9737 10337 4543560 12 Compaq Diagnostics
When I received the ThinkPad I did not switch it on right away! I did also not start Windows XP!
A cronological list of what I did, and why I did it the way I did it:
- Since I had a 2.5″ IDE adaptor I removed the HDD from the ThinkPad and put it in my desktop computer.
Use a Knoppix Live Linux (or any other Linux Live distribution) on CD/DVD/USB-Stick if you don't have an adaptor. Be aware that the boot process has to start from this device, otherwise the HDD will be used – and once Windows gets started, it configures itself for the first run. Stop the boot process by entering the BIOS setup (press F1 when you see the IBM ThinkPad logo) and altering the boot sequence. - I made a backup of each parition. Back in 2005 I used partimage.
Use a program of you choice or even dd if you prefer, but keep in mind that it should also work if you change the parition sizes and positions. If I had to do it now I would use Drive Snapshot, which is a Windows program. For this purpose I would have to boot from a Part PE Windows Live system to not alter the original partition. - I resized the Windows partition from its almost 75 GB to 20 GB using parted.
Note: the original partition is a FAT32 file system. This makes it a lot easier for Linux to resize the partition, although ntfsresize does a good job too. - I made an image of the resulting partition too.
- I deleted the second partition which is the rescue partition. Since I now had my own rescue images I didn't need it anymore.
You will have to turn off the "Rescue Partition" feature in the BIOS to do this! - I then booted into Windows XP for the first time (!) and set it up to suit my needs.
My system always converts FAT32 to NTFS and installs all the programs that came with the ThinkPad. I then need to install Service Pack 3 and all other recent updates for Windows and all the other programs I use. The System Update from Lenovo installes all required programs. You will need a broadband internet connection though, or you have all the files at hand (offline update). Another partition image of a recent and updated configuration will save your time for future Windows XP recoveries. - I then partitioned the rest of the hard disk with Linux and installed Gentoo Linux according to the manual.
In my case I just copied an existing installation from my desktop to the ThinkPad and re-emerged everything with the correct CFLAGS and USE flags.
My partition layout (after I upgraded to a 250 GB hard disk):
tpuser0@localhost # fdisk -l /dev/sda Disk /dev/sda: 250.0 GB, 250059350016 bytes 240 heads, 63 sectors/track, 32301 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes Device Boot Start End Blocks Id System /dev/sda1 1 11107 83968888+ 7 HPFS/NTFS /dev/sda2 * 11108 11134 204120 83 Linux /dev/sda3 11135 32019 157890600 5 Extended /dev/sda4 32020 32301 2131920 82 Linux swap / Solaris /dev/sda5 11135 13781 20011288+ 83 Linux /dev/sda6 13782 14311 4006768+ 83 Linux /dev/sda7 14312 15635 10009408+ 83 Linux /dev/sda8 15636 32019 123863008+ 83 Linux
As you can see I have
device | mount point | description and notes | |
---|---|---|---|
/dev/sda1 | /mnt/windows | 80 GB reserved for the Windows XP installation With the older hard disk (which only had 100 GB space) I had the Windows partition resized to 20 GB. Now I restored it to its original ~80 GB of space, which allows me to play various Windows games and to install the one or the other Windows program without the risk of running out of space. | |
/dev/sda2 | /boot | 200 MB for kernel and initrd (as created by genkernel)… | |
/dev/sda3 | extended partition | ||
/dev/sda5 | / | 20 GB for the root directory… | |
/dev/sda6 | /usr/portage | 4 GB for portage; this shows a significant speed-up to my previous configurations and it additionally reduces fragmentation on my root (/) partition… | |
/dev/sda7 | /usr/local | 10 GB for all local programs and shared files in /usr… | |
/dev/sda8 | /home | 120 GB for all my personal files (and I have a lot of them!) | |
/dev/sda4 | swap | 2 GB of swap space… |
With this partitioning scheme I tried to cover the following
- keep fragmentation low
- possibility to format and reinstall the root (/) partition without loosing importaint data
- easily backup specific partitions and catch all my files that need to be preserved
- have importaint partitions encrypted
Thus the following partitions are encrypted:
- /dev/sda5 /
- /dev/sda7 /usr/local
- /dev/sda8 /home
- /dev/sda4 swap
These partitions contain all my personal files:
- /dev/sda7 /usr/local
- /dev/sda8 /home
Gentoo Linux installation
- /etc/make.conf:
- #=== hardware ===
- ALSA_CARDS="intel8x0 intel8x0m virmidi dummy" – add "usb-audio" if you have additional devices such as TV capture cards.
- VIDEO_CARDS="radeon fbdev dummy vesa" – add "fglrx" for the proprietary driver from ATI.
- INPUT_DEVICES="keyboard joystick mouse synaptics"
- SANE_BACKENDS="genesys" – if you have a scanner, add your SANE backend here.
- #=== host settings optimizations ===
- CHOST="i686-pc-linux-gnu"
- CFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe" – I'm using very stable settings here because I want to work with my laptop, not tune it for crashing all the time...
- CXXFLAGS="${CFLAGS}"
- #=== portage ===
- Most of the other settings are explaned in
/etc/make.conf.example
– don't forget to add them too! - SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" – use
mirrorselect
- FEATURES="sandbox ccache parallel-fetch userfetch userpriv usersandbox"
- USE=" your USE flags here " – use
ufed
(Use Flag EDitior)
TODO
|
...
|
Hardware
CPU: Pentium-M (Banias)
This is the first and original Intel Pentium-M processor, also known under the name Centrino (Intel Pentium-M + Intel i855 chipset + Intel PRO network card = Intel Centrino). It derives from the Intel Pentium III processor, improved by Intel Enhanced SpeedStep power management capabilities and added SSE2 instruction set.
Add the following compiler flags to /etc/make.conf:
CFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe" CXXFLAGS="${CFLAGS}"
These flags require at least GCC 3.4. They are optimized for stability and a good compromise between speed and file size.
See also: “GCC Optimization Flags for the Intel Pentium M (Banias)”
Graphics: ATI Radeon Mobility 9000
X.Org X11
The ATI Radeon Mobility 9000 is fully supported by the open souce radeon driver.
Install X11 (I use X.Org X11):
tpuser0@localhost # echo VIDEO_CARDS="radeon vesa" >> /etc/make.conf tpuser0@localhost # echo INPUT_DEVICES="evdev synaptics keyboard joystick mouse void" >> /etc/make.conf tpuser0@localhost # emerge x11-base/xorg-x11
The drivers include certain fallback choices, like the vesa video driver and the void input driver.
Starting with X.org version 1.5 there is no longer the need to have /etc/X11/xorg.conf set when additionally using HAL. If you want automatic configuration of graphics and devices (like keyboard and mouse) during runtime you can just skip creating this file. Just make sure you emerged x11-base/xorg-server with USE=hal (append “hal” in your /etc/make.conf to the variable USE=).
Otherwise you can now go ahead and configure your /etc/X11/xorg.conf.
X.Org <7.5
Prepare /etc/X11/xorg.conf: make sure you load the necessary X11 modules:
# a piece of /etc/X11/xorg.conf Section "Module" Load "GLcore" Load "dri" Load "glx" EndSection
Prepare /etc/X11/xorg.conf: create a dri group and restrict access to the DRI driver for users in that group (replace “408” by the group id of your dri group):
# a piece of /etc/X11/xorg.conf Section "DRI" Group 408 # group "dri", next available id 408 Mode 0660 EndSection
Prepare /etc/X11/xorg.conf: the 15″ TFT flat panel:
# a piece of /etc/X11/xorg.conf Section "Monitor" Identifier "Monitor1" VendorName "IBM" ModelName "LCD Panel ThinkPad R51" Option "dpms" EndSection
Prepare /etc/X11/xorg.conf: finally, the xorg-x11 radeon driver:
# a piece of /etc/X11/xorg.conf Section "Device" # ATI Radeon R250 (ATI Radeon Mobility 9000 M9) Identifier "ati-xorg" Driver "radeon" BusID "PCI:1:0:0" Option "DynamicClocks" "true" Option "RenderAccel" "true" Option "EnablePageFlip" "true" Option "BackingStore" "true" EndSection
For more performance in X11 I also played with some additional parameters in /etc/X11/xorg.con, with various effects:
# a piece of /etc/X11/xorg.conf Section "Device" # ATI Radeon R250 (ATI Radeon Mobility 9000 M9) Identifier "ati-xorg" Driver "radeon" BusID "PCI:1:0:0" # ALWAYS "ON" OPTIONS Option "DynamicClocks" "true" Option "RenderAccel" "true" # ENCOURAGED OPTIONS Option "EnablePageFlip" "true" Option "BackingStore" "true" # "PLAY WITH" OPTIONS FOR TUNING PURPOSES #Option "AGPFastWrite" "on" # ERROR: mplayer/xine/... xv (xvideo) modules don't work anymore! #Option "DDCMode" "true" # use DDC (monitor) data to calculate mode lines #Option "AccelDFS" "on" # (disabled by default for AGP due possible problems) #Option "FBTexPercent" "0" # with EXA: (set to 0: reserve all offscreen RAM for EXA, OpenGL textures only in GART memory) # CRASH options: #Option "AGPMode" "2" # CRASH! (with or without AGPFastWrite) #Option "AGPFastWrite" "on" # CRASH! (with AGPMode "2") # SLOW options: #Option "AccelMethod" "EXA" # newer and faster (!?) acceleration method EndSection
TODO
|
...
|
Framebuffer console
Generally it should not be a problem to use the radeon framebuffer driver and still be able to use hibernation. The fix in the official Linux kernel will detect an affected ThinkPad automatically (using a blacklist) and activate a workaround.
Radeon framebuffer
Set your kernel configuration in /usr/src/linux/.config:
CONFIG_FB_RADEON=y CONFIG_FB_RADEON_I2C=y CONFIG_FB_RADEON_BACKLIGHT=y
Add this statement to your kernel command line:
video=radeonfb:mtrr,ywrap,1400x1050-32
The only setback is that this driver is not supported by most boot splash configurations. At least I wasn't able to get it working...
VESA framebuffer
Configure the kernel (check your /usr/src/linux/.config):
CONFIG_FB_VESA=y
Alternatively you may consider compiling it as a module (CONFIG_FB_VESA=m), although it wouldn't make much sense...
Add this statement to you kernel command line:
vga=837
I didn't do much testing with this framebuffer driver since radeonfb works fine for me and I don't desperately want to have a boot splash. Besides, there is a newer VESA framebuffer called vesa-tng, recently renamed to uvesa, available.
Trackpoint, Touchpad and USB mouse
TODO
|
...
|
UltraBay Enhanced hotswapping
If you want to be able to hotswap UltraBay Enhanced devices while running Linux you need a recent Linux kernel which supports ata_piix and preferrably the new generic bay driver. A recent kernel is 2.6.23 (2007-10-10) or newer.
Corresponding kernel configuration (/usr/src/linux/.config):
CONFIG_ACPI_DOCK=m CONFIG_ACPI_BAY=m
Alternatively the drives can be compiled into the kernel. If compiled as modules (as in my example), the bay module needs to be added to the /etc/modules.autoload.d/kernel-2.6 file:
tpuser0@localhost # echo bay >> /etc/modules.autoload.d/kernel-2.6
With the generic bay driver udev should be used. Create /etc/udev/rules.d/60-ibm-ultrabay.rules and add the following:
ENV{BAY_EVENT}=="3", KERNEL=="bay.0", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_eject" ENV{BAY_EVENT}=="1", KERNEL=="bay.0", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_insert"
Get the required scripts (ultrabay_eject and ultrabay_insert) from “How to hotswap UltraBay devices”. In /sys/class/ check for directories named scsi_host and scsi_device for the real UltraBay device and change the variables in the scripts accordingly.
My devices are:
/sys/class/scsi_host/host1 /sys/class/scsi_device/1:0:0:0
For host1 and 1:0:0:0 the standard scripts don't have to be changed. Search for “block:sr0” (or “block:hdc” if you don't use the ata_piix driver), so you'll easily identify the correct host and device.
If you use an older kernel (pre-2.6.23) you will need to utilize HAL to get the UltraBay Enhanced hotswapable. As you can see from the lspci output this system has an Intel 82801DBM (ICH4-M) south bridge (PCI ID 00:1f.1). Just follow the instructions from “How to hotswap UltraBay devices” and configure HAL with ID 8086_24ca. I used the lshal command to find out the required ID of the south bridge for HAL.
Kernel configuration
TODO
|
...
|
Installation
TODO
|
...
|
Configuring relevant kernel modules
TODO
|
...
|
External Sources
TODO
|
...
|