Difference between revisions of "Installing Gentoo on a ThinkPad R51-1830"

From ThinkWiki
Jump to: navigation, search
(UltraBay Enhanced)
m (Minor fix.)
 
(8 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__
 
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__
 
|style="vertical-align:top" |
 
|style="vertical-align:top" |
{{NOTE|This page is far from being complete and will be updated soon... --[[User:TpUser0|“TpUser0”]] 18:57, 22 August 2007 (UTC)}}
+
{{NOTE|This page is far from being complete; unfortunately it will stay that way since [[User:TpUser0|I]] no longer use this ThinkPad. Sorry. [[User:TpUser0|TpUser0]] ([[User talk:TpUser0|talk]]) 19:35, 18 May 2015 (CEST)}}
 +
{{NOTE|'''This guide is outdated.''' Especially non-KMS X.org drivers & framebuffers and the use of HAL is no longer possible. However, presented information may still be of value and of use. [[User:TpUser0|TpUser0]] ([[User talk:TpUser0|talk]]) 19:35, 18 May 2015 (CEST)}}
 +
{{NOTE|Last update 18:57, 22 August 2007 (UTC)}}
 
|}
 
|}
  
 
== Introduction ==
 
== Introduction ==
This page shows some partes 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?
+
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.
 
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.
 
If you also own a Thinkpad R51 (machine types 1829, 1830, 1831 and 1836) feel free to add what you think is missing.
  
== My system specs ==
+
== System specifications ==
 
Machine: IBM ThinkPad {{R51}} [[1830-DG4]]
 
Machine: IBM ThinkPad {{R51}} [[1830-DG4]]
  
 
* [[Intel Pentium M (Banias)|Pentium M]] 1.7 GHz
 
* [[Intel Pentium M (Banias)|Pentium M]] 1.7 GHz
* 1.5 GB [[PC2700]] DDR RAM (I upgraded by 1 GB)
+
* Chipset: Intel 855PM
* 100 GB Western Digital HDD (upgraded, not original)
+
** 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:
 
lspci:
  00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
+
  <nowiki>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: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.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.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.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: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: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.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.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.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.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)
+
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)
+
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.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: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: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)
+
02:02.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05)</nowiki>
  
== Preparing for Installation ==
+
== Installation ==
The laptop originally came with an 80&nbsp;GB Hitachi hard disk.
+
=== Preparation ===
 +
The laptop originally came with an 80&nbsp;GB Hitachi hard disk drive.
  
 
  <nowiki>TpUser0@localhost # fdisk -l /dev/hdc
 
  <nowiki>TpUser0@localhost # fdisk -l /dev/hdc
Line 53: Line 61:
 
When I received the ThinkPad I did '''not''' switch it on right away! I did also '''not''' start Windows&nbsp;XP!
 
When I received the ThinkPad I did '''not''' switch it on right away! I did also '''not''' start Windows&nbsp;XP!
  
A cronological list of what I did:
+
A cronological list of what I did, and why I did it the way I did it:
* Since I had a 2.5 inch IDE adaptor I removed the HDD from the ThinkPad and put it in my desktop computer. <br /> ''Use a Knoppix Live Linux (or any other Live Linux) on CD/DVD if you don't have an adaptor.''
+
* Since I had a 2.5″ IDE adaptor I removed the HDD from the ThinkPad and put it in my desktop computer. <br /> ''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 <code>partimage</code>. <br /> ''Use a program of you choice or even <code>dd</code> if you prefer, but keep in mind that it should also work if you change the parition sizes and positions.''
+
* I made a backup of each parition. Back in 2005 I used <tt>partimage</tt>. <br /> ''Use a program of you choice or even <tt>dd</tt> 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&nbsp;PE Windows Live system to not alter the original partition.''
* I resized the Windows partition from its almost 75&nbsp;GB to 20&nbsp;GB using <code>parted</code>.
+
* I resized the Windows partition from its almost 75&nbsp;GB to 20&nbsp;GB using <tt>parted</tt>. <br /> ''Note: the original partition is a FAT32 file system. This makes it a lot easier for Linux to resize the partition, although ''<tt>ntfsresize</tt>'' does a good job too.''
 
* I made an image of the resulting partition 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. <br /> ''You will have to turn of the "Rescue Parition" feature in the BIOS to do this!''
+
* I deleted the second partition which is the rescue partition. Since I now had my own rescue images I didn't need it anymore. <br /> ''You will have to turn off the "Rescue Partition" feature in the BIOS to do this!''
* I then booted into Windows&nbsp;XP for the first time ('''!''') and set it up to suit my needs. <br /> ''My system always converts FAT32 to NTFS and installs all the programs that came with the ThinkPad. I then need to install Service Pack 2 and all other recent updates for Windows and all the other programs. Use the Software Installer from IBM (Lenovo) to do this for you. 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&nbsp;XP recoveries.''
+
* I then booted into Windows&nbsp;XP for the first time ('''!''') and set it up to suit my needs. <br /> ''My system always converts FAT32 to NTFS and installs all the programs that came with the ThinkPad. I then need to install Service Pack&nbsp;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&nbsp;XP recoveries.''
 
* I then partitioned the rest of the hard disk with Linux and installed Gentoo Linux according to the manual. <br /> ''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.''
 
* I then partitioned the rest of the hard disk with Linux and installed Gentoo Linux according to the manual. <br /> ''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 100&nbsp;GB hard disk):
+
My partition layout (after I upgraded to a 250&nbsp;GB hard disk):
  <nowiki>tpuser0@localhost # fdisk -l /dev/hda
+
  <nowiki>tpuser0@localhost # fdisk -l /dev/sda
Disk /dev/hda: 100.0 GB, 100030242816 bytes
+
Disk /dev/sda: 250.0 GB, 250059350016 bytes
240 heads, 63 sectors/track, 12921 cylinders
+
240 heads, 63 sectors/track, 32301 cylinders
 
Units = cylinders of 15120 * 512 = 7741440 bytes
 
Units = cylinders of 15120 * 512 = 7741440 bytes
  
 
   Device Boot      Start        End      Blocks  Id  System
 
   Device Boot      Start        End      Blocks  Id  System
/dev/hda1               1       2774   20971408+  7  HPFS/NTFS
+
/dev/sda1               1       11107   83968888+  7  HPFS/NTFS
/dev/hda2   *       2775        2779       37800   83  Linux
+
/dev/sda2   *      11108      11134      204120   83  Linux
/dev/hda3            2780       12921    76673520   5  Extended
+
/dev/sda3          11135       32019  157890600   5  Extended
/dev/hda5            2780        5943   23919808+  83  Linux
+
/dev/sda4          32020      32301    2131920  82  Linux swap / Solaris
/dev/hda6            5944       12726   51279448+  83  Linux
+
/dev/sda5          11135      13781   20011288+  83  Linux
/dev/hda7           12727       12921    147416882 Linux swap / Solaris</nowiki>
+
/dev/sda6          13782      14311    4006768+  83  Linux
 +
/dev/sda7          14312       15635   10009408+  83  Linux
 +
/dev/sda8           15636       32019  12386300883 Linux</nowiki>
  
 
As you can see I have
 
As you can see I have
 
{| border="0" style="vertical-align:top" width="100%"
 
{| border="0" style="vertical-align:top" width="100%"
! align="center" | device
+
! align="center" colspan="2" bgcolor="#f9f9f9" | device
 
! align="center" | mount point
 
! align="center" | mount point
! align="center" | description and notes
+
! align="center" bgcolor="#f9f9f9" | description and notes
 
|-
 
|-
| valign="top" | <tt>/dev/hda1</tt>&nbsp;
+
| valign="top" colspan="2" bgcolor="#f9f9f9" | <tt>/dev/sda1</tt>&nbsp;
| valign="top" | <tt>/mnt/windows</tt>
+
| valign="top" | <tt>/mnt/windows&nbsp;</tt>
| valign="top" | ''20&nbsp;GB reserved for the Windows&nbsp;XP installation <br /> I bought it with the laptop, so why not use it from time to time?''
+
| valign="top" bgcolor="#f9f9f9" | ''80&nbsp;GB reserved for the Windows&nbsp;XP installation <br /> With the older hard disk (which only had 100&nbsp;GB space) I had the Windows partition resized to 20&nbsp;GB. Now I restored it to its original ~80&nbsp;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.''
 
|-
 
|-
| valign="top" | <tt>/dev/hda2</tt>&nbsp;
+
| valign="top" colspan="2" bgcolor="#f9f9f9" | <tt>/dev/sda2</tt>&nbsp;
 
| valign="top" | <tt>/boot</tt>
 
| valign="top" | <tt>/boot</tt>
| valign="top" | ''40&nbsp;MB for the kernels...''
+
| valign="top" bgcolor="#f9f9f9" | ''200&nbsp;MB for kernel and initrd (as created by genkernel)…''
 
|-
 
|-
| valign="top" | <tt>/dev/hda5</tt>&nbsp;
+
| valign="top" colspan="2" bgcolor="#f9f9f9" | <tt>/dev/sda3</tt>&nbsp;
 +
| valign="top" colspan="2" | <tt>''extended partition''</tt>
 +
|-
 +
| valign="top" | &nbsp; &nbsp;
 +
| valign="top" bgcolor="#f9f9f9" | <tt>/dev/sda5&nbsp;</tt>
 
| valign="top" | <tt>/</tt>
 
| valign="top" | <tt>/</tt>
| valign="top" | ''25&nbsp;GB for the root directory <br /> I figured it be best to have no seperate partitions for <tt>/</tt> and <tt>/usr</tt>...''
+
| valign="top" bgcolor="#f9f9f9" | ''20&nbsp;GB for the root directory…''
 +
|-
 +
| valign="top" |
 +
| valign="top" bgcolor="#f9f9f9" | <tt>/dev/sda6</tt>
 +
| valign="top" | <tt>/usr/portage&nbsp;</tt>
 +
| valign="top" bgcolor="#f9f9f9" | ''4&nbsp;GB for portage; this shows a significant speed-up to my previous configurations and it additionally reduces fragmentation on my root (<tt>/</tt>) partition…''
 +
|-
 +
| valign="top" |
 +
| valign="top" bgcolor="#f9f9f9" | <tt>/dev/sda7</tt>
 +
| valign="top" | <tt>/usr/local</tt>
 +
| valign="top" bgcolor="#f9f9f9" | ''10&nbsp;GB for all local programs and shared files in <tt>/usr</tt>''
 
|-
 
|-
| valign="top" | <tt>/dev/hda6</tt>&nbsp;
+
| valign="top" |
 +
| valign="top" bgcolor="#f9f9f9" | <tt>/dev/sda8</tt>
 
| valign="top" | <tt>/home</tt>
 
| valign="top" | <tt>/home</tt>
| valign="top" | ''53&nbsp;GB for all my personal files (and I have a lot of them!)''
+
| valign="top" bgcolor="#f9f9f9" | ''120&nbsp;GB for all my personal files (and I have a lot of them!)''
 
|-
 
|-
| valign="top" | <tt>/dev/hda7</tt>&nbsp;
+
| valign="top" colspan="2" bgcolor="#f9f9f9" | <tt>/dev/sda4</tt>&nbsp;
| valign="top" | <tt>swap</tt>
+
| valign="top" | <tt>''swap''</tt>
| valign="top" | ''1.5&nbsp;MB <br /> You need at least the size of RAM you have in your system for swap or hibernation will not be possible.''
+
| valign="top" bgcolor="#f9f9f9" | ''2&nbsp;GB of swap space…''
 
|-
 
|-
 
|}
 
|}
  
== Base configuration (Gentoo) ==
+
With this partitioning scheme I tried to cover the following
 +
* keep fragmentation low
 +
* possibility to format and reinstall the root (<tt>/</tt>) 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:
 +
* <tt>/dev/sda5  /</tt>
 +
* <tt>/dev/sda7  /usr/local</tt>
 +
* <tt>/dev/sda8  /home</tt>
 +
* <tt>/dev/sda4  ''swap''</tt>
 +
 
 +
These partitions contain all my personal files:
 +
* <tt>/dev/sda7  /usr/local</tt>
 +
* <tt>/dev/sda8  /home</tt>
 +
 
 +
=== Gentoo Linux installation ===
 
#<tt>/etc/make.conf</tt>:
 
#<tt>/etc/make.conf</tt>:
 
#* <tt>#=== hardware ===</tt>
 
#* <tt>#=== hardware ===</tt>
Line 123: Line 164:
 
{{Todo|...}}
 
{{Todo|...}}
  
== Graphics ==
+
== Hardware ==
The [[ATI Mobility Radeon 9000]] is fully supported by the open souce [[radeon]] driver.
+
=== CPU: Pentium-M (Banias) ===
 +
This is the first and original Intel Pentium-M processor, also known under the name ''Centrino'' (Intel Pentium-M&nbsp;+ Intel i855 chipset&nbsp;+ Intel PRO network card&nbsp;= Intel Centrino). It derives from the Intel Pentium&nbsp;III processor, improved by [[SpeedStep|Intel Enhanced SpeedStep]] power management capabilities and added [[SIMD|SSE2]] instruction set.
  
Install X11 (I use XOrg X11):
+
Add the following compiler flags to <tt>/etc/make.conf</tt>:
  <nowiki>tpuser0@localhost # echo VIDEO_CARDS="radeon" >> /etc/make.conf</nowiki>
+
<nowiki>CFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe"
 +
CXXFLAGS="${CFLAGS}"</nowiki>
 +
These flags require at least GCC 3.4. They are optimized for stability and a good compromise between speed and file size.
 +
 
 +
See also: “[[Intel Pentium M (Banias)#GCC Optimization Flags|GCC Optimization Flags for the Intel Pentium M (Banias)]]”
 +
 
 +
=== Graphics: ATI Radeon Mobility 9000 ===
 +
==== X.Org X11 ====
 +
The [[ATI Mobility Radeon 9000|ATI Radeon Mobility 9000]] is fully supported by the open souce [[radeon]] driver.
 +
 
 +
Install X11 (I use X.Org X11):
 +
  <nowiki>tpuser0@localhost # echo VIDEO_CARDS="radeon vesa" >> /etc/make.conf</nowiki>
 +
<nowiki>tpuser0@localhost # echo INPUT_DEVICES="evdev synaptics keyboard joystick mouse void" >> /etc/make.conf</nowiki>
 
  <nowiki>tpuser0@localhost # emerge x11-base/xorg-x11</nowiki>
 
  <nowiki>tpuser0@localhost # emerge x11-base/xorg-x11</nowiki>
  
 +
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 <tt>/etc/X11/xorg.conf</tt> 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 “<tt>hal</tt>” in your <tt>/etc/make.conf</tt> to the variable <tt>USE=</tt>).
 +
 +
Otherwise you can now go ahead and configure your <tt>/etc/X11/xorg.conf</tt>.
 +
 +
===== X.Org <7.5 =====
 
Prepare /etc/X11/xorg.conf: make sure you load the necessary X11 modules:
 
Prepare /etc/X11/xorg.conf: make sure you load the necessary X11 modules:
 
  <nowiki># a piece of /etc/X11/xorg.conf
 
  <nowiki># a piece of /etc/X11/xorg.conf
Line 194: Line 255:
 
{{Todo|...}}
 
{{Todo|...}}
  
== UltraBay hotswapping ==
+
==== Framebuffer console ====
 +
Generally it should not be a problem to use the [[#Radeon framebuffer|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 <tt>/usr/src/linux/.config</tt>:
 +
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 <tt>/usr/src/linux/.config</tt>):
 +
CONFIG_FB_VESA=y
 +
Alternatively you may consider compiling it as a module (<tt>CONFIG_FB_VESA=m</tt>), 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 <tt>radeonfb</tt> works fine for me and I don't desperately want to have a boot splash. Besides, there is a newer VESA framebuffer called <tt>vesa-tng</tt>, recently renamed to <tt>uvesa</tt>, available.
 +
 
 +
=== Trackpoint, Touchpad and USB mouse ===
 +
{{Todo|...}}
  
 +
=== UltraBay Enhanced hotswapping ===
 
If you want to be able to hotswap [[UltraBay|UltraBay Enhanced]] devices while running Linux you need a recent Linux kernel which supports <tt>ata_piix</tt> and preferrably the new generic <tt>bay</tt> driver. A recent kernel is 2.6.23 (2007-10-10) or newer.
 
If you want to be able to hotswap [[UltraBay|UltraBay Enhanced]] devices while running Linux you need a recent Linux kernel which supports <tt>ata_piix</tt> and preferrably the new generic <tt>bay</tt> driver. A recent kernel is 2.6.23 (2007-10-10) or newer.
  
Line 209: Line 296:
 
ENV{BAY_EVENT}=="1", KERNEL=="bay.0", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_insert"</nowiki>
 
ENV{BAY_EVENT}=="1", KERNEL=="bay.0", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_insert"</nowiki>
  
Get the required scripts (<tt>ultrabay_eject</tt> and <tt>ultrabay_insert</tt>) from “[[How to hotswap UltraBay devices]]”.
+
Get the required scripts (<tt>ultrabay_eject</tt> and <tt>ultrabay_insert</tt>) from “[[How to hotswap UltraBay devices]]”. In <tt>/sys/class/</tt> check for directories named <tt>scsi_host</tt> and <tt>scsi_device</tt> for the real UltraBay device and [[How to hotswap UltraBay devices#using the generic bay driver and udev|change the variables]] in the scripts accordingly. <br /> My devices are:
 +
/sys/class/scsi_host/host1
 +
/sys/class/scsi_device/1:0:0:0
 +
For <tt>host1</tt> and <tt>1:0:0:0</tt> the standard scripts don't have to be changed. Search for “<tt>block:sr0</tt>” (or “<tt>block:hdc</tt>” if you don't use the <tt>ata_piix</tt> driver), so you'll easily identify the correct host and device.
  
If you use an older kernel (pre-2.6.23) you need to utilize HAL to get the UltraBay Enhanced hotswappable.
+
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 [[#My system specs|lspci output]] this system has an Intel 82801DBM (ICH4-M) south bridge (PCI ID <tt>00:1f.1</tt>).
 
As you can see from the [[#My system specs|lspci output]] this system has an Intel 82801DBM (ICH4-M) south bridge (PCI ID <tt>00:1f.1</tt>).
Just follow the instructions from “[[How to hotswap UltraBay devices]]” and configure HAL with <tt>[[How to hotswap UltraBay devices#Details|ID 8086_24ca]]</tt>. I used the <tt>lshal</tt> command to find out the required ID of the south bridge for HAL.
+
Just follow the instructions from “[[How to hotswap UltraBay devices]]” and configure HAL with [[How to hotswap UltraBay devices#Details|ID <tt>8086_24ca</tt>]]. I used the <tt>lshal</tt> command to find out the required ID of the south bridge for HAL.
  
 
== Kernel configuration ==
 
== Kernel configuration ==

Latest revision as of 18:36, 18 May 2015

NOTE!
This page is far from being complete; unfortunately it will stay that way since I no longer use this ThinkPad. Sorry. TpUser0 (talk) 19:35, 18 May 2015 (CEST)
NOTE!
This guide is outdated. Especially non-KMS X.org drivers & framebuffers and the use of HAL is no longer possible. However, presented information may still be of value and of use. TpUser0 (talk) 19:35, 18 May 2015 (CEST)
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

  1. /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
...