Thinkpad R51 + Slackware + WXP multiboot

This document briefly explains how to install both Linux and WXP into IBM Thinkpad R51.

Content

My equipment
My hardware
Software

Preparing
Prerequisities
Preparing bootable CD with NU2 (applicable for windows only)
Current state
Recovery factory state

Installing Slackware 10
Repartitioning /dev/hda
Installing
Post-install
Installing boot sector to windows' boot.ini

Configuration
console framebuffer
console mouse & touchpad
Ethernet - GLAN
Bluetooth
hcid.conf
GPRS over BT
rfcomm.conf
ppp scripts
/etc/ppp/peers/gprs
/etc/ppp/chat-gprs
/etc/ppp/chat-gprs-disconnect
Modem V.90/92
WiFi
MaxSound
IrDA
Firewire
CD-R/RW/DVD-R/RW/RAM burning
cdrecord
cdrdao

My scripts
rc.network

Various listings
lspci
/proc/ioports
/proc/cpuinfo
/proc/iomem

Contact

My equipment

My hardware

Software

Preparing

Prerequisities

Start with WXP and run Start->Access IBM (or press Access IBM blue button). Select 'Protect & Recover', 'Protect computer data' and click on 'Create product recovery discs'. This will make a set of 7 cdr (or if you have DVD-RW, place one CDR as the first media, and then 1DVDR). Make sure you have burnt all the discs.

Caution. This is not the tool for backup your data. Backup your data separately.

Prepare bootable CD with partition resizer. You should use bootcd from nu2. I was trying Knoppix with qtparted, but it destroyed MBR everytime I've used it. The same result has parted, add by myself to crashrecovery iso image (used crash2424-mdk92-isolinux.iso). So I decided to create my own bootable CD with pqmagic - it works fine, and without data/MBR loss.

Preparing bootable CD with NU2 (applicable for windows only)

1. you need to download files BCD, BFD, Nero ASPI and cdromsi.

2. unpack all the files into one directory, put Nero ASPI into /bin

3. copy all the files from PQMagic installation directory/DOS into cds/cdromsi/files

4. start shell and type

c:\BOOT>bcd cdromsi

5. you might be prompted to insert blank cd-r(w) into cdrw

6. bootable cd is completed. Try it before you use it (strongly recommended)

Current state

You must have prepared a set of recovery CDs (or 1CD/1DVD), and bootable cdrom with partition resizer. Do not continue if you don't have it all.

Recovery factory state

Reboot your Thinkpad and press Access IBM on startup. Then select 'Recover to factory contents'. Software will restore factory state and ask to reboot.

Insert your bootcd and do reboot. Resize FAT32 partition, but leave it 12GB at least else factory recover won't work. Example resizing FAT32 partition to 20GB using parted

~# parted /dev/hda resize 1 0.031 20000

Reboot and allow XP to install completely. So you have working XP with smaller partition, and you are prepared to install linux.

Installing Slackware 10

Insert Slackware install CD#1, and boot. Login as root and continue to fdisk/cfdisk.

Repartitioning /dev/hda

I need to exchange some data between Linux and XP, so I decided to make one partition about 5GB for that. So, let's make /dev/hda3 as 5GB with type FAT32. We need to create swap, /boot and root for our system, so make extended partition (/dev/hda4) and /boot as _first_ logical partition. 20MB is enough. I choose 512MB for swap and the rest for /. I prefer fdisk to repartitioning, but you should use everything you like :)

~# fdisk /dev/hda

The partition table looks like:

/dev/hda1 20gb WXP
/dev/hda2 ~4gb IBM service partition
/dev/hda3  5gb shared FAT32
/dev/hda4 extended
 /dev/hda5 20mb /boot - make sure it's formatted as ext2
 /dev/hda6 /
 /dev/hda7 512mb swap partition

I wrote the partition table, reboot to WXP and format shared partition to FAT32 (I'll use it for store of linux boot sector...)

Installing

Insert CD#1 and boot into setup again. Login as root and type

~# setup

Process setup from adding swap space to install selected packages (or packages groups).

Post-install

When ask to install LILO, do NOT install lilo to MBR! You have to install it to the first sector of your boot partition (eg. /dev/hda6).

Example of my lilo.conf

# install to Root (1.sector) of booting partition
boot = /dev/hda6
prompt
timeout = 1200
change-rules
reset
# FB with 1024x768x32k
vga=790
# allow booting back to XP
other = /dev/hda1
 label = WindowsXP
 table = /dev/hda
# linux
image = /boot/vmlinuz
 root = /dev/hda6
 label = Linux
 read-only
# EOF

Re-run lilo to write it to the boot sector

~# lilo

Installing boot sector to windows' boot.ini

Mount your share partition (or floppy disc)

~# mount /dev/hda3 /mnt/share
and get first sector using dd
~# dd if=/dev/hda6 bs=512 count=1 of=./boot.lnx
1+0 records in
1+0 records out

To verify, if your boot.lnx is the true boot sector, do

~# hexdump -C boot.lnx
and the result must be like this one
00000000 fa eb 21 01 b4 01 4c 49  4c 4f 16 05 30 29 1b 41  |......LILO......|

If you have the boot sector as file, reboot to Windows.

In Windows, copy boot.lnx into c:\. Then run cmd.exe and change attributes of boot.ini allow edit access

C:\>attrib -R -S -H c:\boot.ini
C:\>notepad c:\boot.ini

Add following line at the end of boot.ini

c:\boot.lnx="Linux"
change attributes back
C:\>attrib +R +S +H c:\boot.ini
and reboot. After reboot you'll see a menu to select desired OS.

Example of my c:\boot.ini

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
c:\boot.lnx="Linux"

Configuration

console framebuffer

Modify /etc/lilo.conf and change vga=790 to vga=834

image = /boot/vmlinuz
 root = /dev/hda6
 append = "video=mtrr,vesafb:1400x1050"
 label = Linux
 read-only
then run
~# lilo

Please note. Everytime you use 'lilo', you have to repeat steps in section "Installing boot sector to windows' boot.ini". The only way how to make it better is to use grub loader.

console mouse & touchpad

Both works great. I'm using ps2 driver without synaptics. Running gpm as

~# gpm -m /dev/input/mice -t ps2

Ethernet - GLAN

I'm using e1000 driver, compiled in kernel and it's working fine. My .config contains

CONFIG_E1000=y
CONFIG_E1000_NAPI=y

Bluetooth

R51 has BT connected internally via USB. At first, download and apply patch from bluez.org - 2.6.7-mh4.

~# cd /usr/src/linux
~# patch -p1 < ~/bluez-2.6.7-mh4.patch

Kernel configuration is

CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_SCO=m
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=m
CONFIG_BT_HIDP=m
CONFIG_BT_HCIUSB=m
CONFIG_BT_HCIUART=m

Download, compile and install all the packages from bluez homepage. After that, you'll have new directory in /etc

~# ls /etc/bluetooth
hcid.conf pin rfcomm.conf

hcid.conf

My hcid.conf is

options {
	autoinit yes;
	security user;
	pairing multi;
	#pin_helper /usr/bin/bluepin;
    # pin app replacement
    pin_helper /usr/bin/pin;
}
device {
	name "notebook %h";
	class 0x100;
	iscan enable; pscan enable;
	lm accept;
	lp rswitch,hold,sniff,park;
}

Run hcid daemon and test BT

~# hcid

~# hciconfig -a
hci0:   Type USB
        BD Address: 00:.... ACL MTU 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes: 953 acl:0 sco:0 events: 25 errors:0
       ...
        Link mode: SLAVE ACCEPT
        Name: 'notebook darkstar'
        Class: 0x000100
        Service Classes: Unspecified
        Device Class: Computer, Uncategorized
        HCI Ver: 1.1 (0x1) HCI Rev: 0x222 LMP Ver: 1.1 (0x1) LMP Subver: 0x222
        Manufacturer: Cambridge Silicon Radio (10)
Now you can perform scan for available devices
~# hcitool scan
Scanning ...
        00:07:E0:A0:32:32     tom
        00:60:57:F0:A0:A0     Nokia-znouza

GPRS over BT

I've got Nokia 6310i with BT and GPRS, so I would like to connect via gprs.

verify modem functionality (it'll scan all the available devices)

~# sdptool search DUN
Inquiring ...
Searching for DUN on 00:07:E0:A0:32:32 ...
Searching for DUN on 00:60:57:F0:A0:A0 ...
Service Name: Dial-up networking
Service RecHandle: 0x1004f
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
   Channel: 1
Language Base Attr List:
  code_ISO639: 0x656e  
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
  Version: 0x0100

So channel for dialup is "1". Now try to bind via rfcomm

~# rfcomm bind 00:60:57:F0:A0:A0 1
~# rfcomm show
rfcomm0: 01:00:00:00:00:00 channel 1 clean

You have to replace bluepin (/usr/bin/bluepin) with simpler one (because bluepin is buggy). So create /usr/bin/pin file:

#!/bin/bash
cat /etc/bluetooth/phone_pin
save, and create /etc/bluetooth/phone_pin with your pin:
PIN:1234

To test if your rfcomm works, do the following

~# rfcomm release 00:60:57:F0:A0:A0
~# rfcomm connect rfcomm0 00:60:57:F0:A0:A0
Connected /dev/rfcomm0 to 00:60:57:F0:A0:A0 on channel 1
Press CTRL-C for hangup

rfcomm.conf

If you want to establish rfcomm devices 'by request', write them to rfcomm.conf file

.rfcomm0 {
   bind yes;
   device 00:60:57:F0:A0:A0;
   channel 1;
   comment "NOKIA - GPRS";
}

ppp scripts

/etc/ppp/peers/gprs
/dev/rfcomm0 57600
connect '/usr/sbin/chat -v -f /etc/ppp/chat-gprs'
disconnect '/usr/sbin/chat -v -f /etc/ppp/chat-gprs-disconnect'
noauth
defaultroute
usepeerdns
debug
/etc/ppp/chat-gprs
TIMEOUT         5
ECHO            ON
ABORT           '\nBUSY\r'
ABORT           '\nERROR\r'
ABORT           '\nNO ANSWER\r'
ABORT           '\nNO CARRIER\r'
ABORT           '\nNO DIALTONE\r'
ABORT           '\nRINGING\r\n\r\nRINGING\r'
''              \rAT
TIMEOUT         12
OK              ATE1
OK              'AT+cgdcont=1,"IP","internet"'
OK              ATD*99***1#
/etc/ppp/chat-gprs-disconnect
ABORT		"BUSY"		
ABORT		"ERROR"		
ABORT		"NO DIALTONE"	
''		'\K'	
''		'\K'	
''		'\K'	
''		'+++ATH'	
''		'+++ATH'	
''		'+++ATH'	

And now test your new gprs connection

~# pppd call gprs

Modem V.90/92

R51 contains s softmodem Intel ICH4 (82801DB) with Conexant CXT23 chipset. Unfortunately, it's NOT working with slmodem driver from Smart Link Ltd. You have to purchase (or try degraded 14.4kbps driver) from linuxant.com

I've downloaded a hsfmodem-6.03 and run make install, and then hsfconfig. Anwer some questions and.. voila... modem linked to /dev/modem

You could try it by running minicom, type ATA and press Enter -- you must hear high-pitched sound.

Modules loaded for HSF modem get working are:

hsfusbcd2              43536  0
hsfmc97ali             51220  0
hsfmc97via             49048  0
hsfmc97ich             50704  0
hsfpcibasic2           56464  0
hsfserial              20644  5 hsfusbcd2,hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2
hsfengine            1218980  1 hsfserial
hsfosspec              84068  10 hsfusbcd2,hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2,hsfserial,hsfengine
hsfsoar                52480  4 hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2

WiFi

Using ipw2200 driver from ipw2200.sourceforge.net. You have to download both driver and firmware, enable hotplug in kernel, compile and.. voila :)

~# modprobe ipw2200
~# lsmod
Module                  Size Used by
ipw2200               102500 0
firmware_class          7680 1 ipw2200
ieee80211              14084 1 ipw2200
ieee80211_crypt         4996 1 ieee80211

MaxSound

Using Intel 8x0 ALSA module, built in kernel.

CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_AC97_CODEC=y
CONFIG_SND_INTEL8X0=y

IrDA

Not tried yet.

Firewire

Not tried yet, but seems to be working (appropriate kernel modules are loaded, kernel messages say it is OK).

CD-R/RW/DVD-R/RW/RAM burning

cdrecord

For CD-R/RW burning works with dev=/dev/hdc

cdrdao

I'm using ~/.cdrdao config file with
write_device: ATA:1,0,0

My scripts

rc.network

This is a humbly replacement to Patrik's rc.inet1. With config file you're able to switch between profiles, start multiple interfaces or add routes. Download it freely (two files inside rc.network.tgz). Install into /etc/rc.d and change rc.M to start rc.network instead of rc.inet1.

There is a sample configuration for two LAN and one WiFi (file rc.network.conf)

# first connection
CONNECTIONS[1]="work"
# second
CONNECTIONS[2]="home"
# third
CONNECTIONS[3]="home-wifi"

# what to load as default
# to load multiple interfaces, separate them by space, eg "home home-wifi"
DEFAULT="home"

# configuration for 'work' connection
IPADDR[1]="10.10.10.10"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
GATEWAY[1]="10.10.10.1"
USEIF[1]="eth0"
# I prefer to shutdown all other interfaces (*) before initializing this one
SHUTDOWN_OTHER_FIRST[1]="*"
IS_WIRELESS[1]=""

IPADDR[2]="192.168.0.1"
NETMASK[2]="255.255.255.0"
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""
GATEWAY[2]="192.168.0.254"
USEIF[2]="eth0"
SHUTDOWN_OTHER_FIRST[2]="eth2"
IS_WIRELESS[2]=""

IPADDR[3]="192.168.0.2"
NETMASK[3]="255.255.255.0"
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""
GATEWAY[3]="192.168.0.254"
USEIF[3]="eth2"
SHUTDOWN_OTHER_FIRST[3]="eth0"
IS_WIRELESS[3]="yes"

So, switching between profiles is pretty simple. Just run

~# rc.network switch home
and it will shutdown your wireless, and reconfigure eth0 with home settings (default gateways and routes too).

Various listings

lspci

00:00.0  Class 0600: 8086:3340 (rev 03)  Host bridge: Intel Corp. 82855PM Processor to I/O Controller 
                                         (rev 03)
00:01.0  Class 0604: 8086:3341 (rev 03)  PCI bridge: Intel Corp. 82855PM Processor to AGP Controller (rev 03)
00:1d.0  Class 0c03: 8086:24c2 (rev 01)  USB Controller: Intel Corp. 82801DB (ICH4) USB UHCI #1 (rev 01)
00:1d.1  Class 0c03: 8086:24c4 (rev 01)  USB Controller: Intel Corp. 82801DB (ICH4) USB UHCI #2 (rev 01)
00:1d.2  Class 0c03: 8086:24c7 (rev 01)  USB Controller: Intel Corp. 82801DB (ICH4) USB UHCI #3 (rev 01)
00:1d.7  Class 0c03: 8086:24cd (rev 01)  USB Controller: Intel Corp. 82801DB (ICH4) USB2 EHCI Controller 
                                         (rev 01)
00:1e.0  Class 0604: 8086:2448 (rev 81)  PCI bridge: Intel Corp. 82801BAM/CAM PCI Bridge (rev 81)
00:1f.0  Class 0601: 8086:24cc (rev 01)  ISA bridge: Intel Corp. 82801DBM LPC Interface Controller (rev 01)
00:1f.1  Class 0101: 8086:24ca (rev 01)  IDE interface: Intel Corp. 82801DBM (ICH4) Ultra ATA Storage 
                                         Controller (rev 01)
00:1f.3  Class 0c05: 8086:24c3 (rev 01)  SMBus: Intel Corp. 82801DB/DBM (ICH4) SMBus Controller (rev 01)
00:1f.5  Class 0401: 8086:24c5 (rev 01)  Multimedia audio controller: Intel Corp. 82801DB (ICH4) AC'97 Audio 
                                         Controller (rev 01)
00:1f.6  Class 0703: 8086:24c6 (rev 01)  Modem: Intel Corp. 82801DB (ICH4) AC'97 Modem Controller (rev 01)
01:00.0  Class 0300: 1002:4c66 (rev 02)  VGA compatible controller: ATI Technologies Inc Radeon R250 Lf 
                                         [Radeon Mobility 9000 M9] (rev 02)
02:00.0  Class 0607: 104c:ac46 (rev 01)  CardBus bridge: Texas Instruments PCI4520 PC card Cardbus 
                                         Controller (rev 01)
02:00.2  Class 0c00: 104c:802a (rev 01)  FireWire (IEEE 1394): Texas Instruments: Unknown 
                                         device 802a (rev 01)
02:01.0  Class 0200: 8086:101e (rev 03)  Ethernet controller: Intel Corp. 82540EP Gigabit Ethernet 
                                         Controller (Mobile) (rev 03)
02:02.0  Class 0280: 8086:4220 (rev 05)  Network controller: Intel Corp.: Unknown device 4220 (rev 05)

/proc/ioports

0000-001f : dma1
0020-0021 : pic1
0040-005f : timer
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
01f0-01f7 : ide0
0376-0376 : ide1
03c0-03df : vesafb
03f6-03f6 : ide0
03f8-03ff : serial
0cf8-0cff : PCI conf1
1000-107f : 0000:00:1f.0
  1008-100b : ACPI timer
  1010-1015 : ACPI CPU throttle
1180-11bf : 0000:00:1f.0
1800-181f : 0000:00:1d.0
  1800-181f : uhci_hcd
1820-183f : 0000:00:1d.1
  1820-183f : uhci_hcd
1840-185f : 0000:00:1d.2
  1840-185f : uhci_hcd
1860-186f : 0000:00:1f.1
  1860-1867 : ide0
  1868-186f : ide1
1880-189f : 0000:00:1f.3
18c0-18ff : 0000:00:1f.5
1c00-1cff : 0000:00:1f.5
2000-207f : 0000:00:1f.6
  2000-207f : hsfmc97ich
2400-24ff : 0000:00:1f.6
  2400-24ff : hsfmc97ich
3000-3fff : PCI Bus #01
  3000-30ff : 0000:01:00.0
4000-40ff : PCI CardBus #03
4400-44ff : PCI CardBus #03
8000-803f : 0000:02:01.0
  8000-803f : e1000

/proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 13
model name	: Intel(R) Pentium(R) M processor 1.60GHz
stepping	: 6
cpu MHz		: 1595.282
cache size	: 64 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 2
wp		: yes
flags		: fpu vme de pse tsc msr mce cx8 sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse 
              sse2 ss tm pbe tm2 est
bogomips	: 3162.11

/proc/iomem

00000000-0009efff : System RAM
0009f000-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cffff : Video ROM
000d0000-000d0fff : Adapter ROM
000d1000-000d1fff : Adapter ROM
000d2000-000d3fff : reserved
000e0000-000effff : Extension ROM
000f0000-000fffff : System ROM
00100000-1ff5ffff : System RAM
  00100000-00399211 : Kernel code
  00399212-0049f5ff : Kernel data
1ff60000-1ff76fff : ACPI Tables
1ff77000-1ff78fff : ACPI Non-volatile Storage
1ff80000-1fffffff : reserved
20000000-200003ff : 0000:00:1f.1
20400000-207fffff : PCI CardBus #03
20800000-20bfffff : PCI CardBus #03
b0000000-b0000fff : 0000:02:00.0
  b0000000-b0000fff : yenta_socket
c0000000-c00003ff : 0000:00:1d.7
  c0000000-c00003ff : ehci_hcd
c0000800-c00008ff : 0000:00:1f.5
  c0000800-c00008ff : Intel 82801DB-ICH4 - Controller
c0000c00-c0000dff : 0000:00:1f.5
  c0000c00-c0000dff : Intel 82801DB-ICH4 - AC'97
c0100000-c01fffff : PCI Bus #01
  c0100000-c010ffff : 0000:01:00.0
    c0100000-c010ffff : radeonfb
c0200000-c020ffff : 0000:02:01.0
  c0200000-c020ffff : e1000
c0210000-c0213fff : 0000:02:00.2
c0214000-c0214fff : 0000:02:02.0
c0215000-c02157ff : 0000:02:00.2
  c0215000-c02157ff : ohci1394
c0220000-c023ffff : 0000:02:01.0
  c0220000-c023ffff : e1000
d0000000-dfffffff : 0000:00:00.0
e0000000-e7ffffff : PCI Bus #01
  e0000000-e7ffffff : 0000:01:00.0
    e0000000-e7ffffff : radeonfb
ff800000-ffffffff : reserved

Contact

This document is property of Tom Meinlschmidt <tomas at meinlschmidt dot org>. Feel free to contact me.
Thank to jimmac for his nice icon -> <-