Booting Linux from Firewire disk without initrd on a PowerBook
Content
Introduction
At the end of December 2004, I started installing Linux on my PowerBook G4 Titanium. Because the internal hard disk was (and, as of September 2005, still is) occupied by Mac OS X, I opted for an external hard disk. With repartitioning the hard disk, I created one partition for root (/), one for swap and one for bootstrap (required by yaboot):
# mac-fdisk -l /dev/sda
# type name length base ( size ) system
[…]
/dev/sdb9 Apple_UNIX_SVR2 root 31457280 @ 1824 ( 15.0G) Linux native
/dev/sdb10 Apple_UNIX_SVR2 swap 204800 @ 31459104 (100.0M) Linux swap
/dev/sdb11 Apple_Bootstrap bootstrap 1600 @ 31663904 (800.0k) NewWorld bootblock
[…]The installation of Gentoo Linux went trough without problems — until I got to the boot loader and after that, booting. Recently, I found a way how to do it without using an initrd, which was required before.
Configuring the kernel
The method without using an initrd builds upon the kernel parameter rootdelay=, which appeared in Linux 2.6.11 or 2.6.12. Therefore, you must Linux >=2.6.11.
Required options:
# SCSI device support CONFIG_SCSI=y # SCSI disk support CONFIG_BLK_DEV_SD=y # SCSI generic support CONFIG_CHR_DEV_SG=y # IEEE 1394 (FireWire) support CONFIG_IEEE1394=y # SBP-2 support (Harddisks etc.) IEEE1394_SBP2=y
Configuring yaboot
Here you find the needed parameters for booting via Firewire. Please note that you will need more parameters, but those are standard. Also see my example yaboot.conf.
boot=/dev/sda11- Unix path to the bootstrap partition.
ofboot=fw/node@00d0b87100002ca8/sbp-2@c000/disk@0:11- Open Firmware path to the bootstrap partition.
device=fw/node@00d0b87100002ca8/sbp-2@c000/disk@0:9- Open Firmware path to the root partition.
partition=9- Number of the root partition.
root=8:9- Specifies the root partition as major:minor. To get the numbers right, use either
ls -l /dev/sdaXor the table below. I was not able to get it to work with device names (like /dev/sda9) on an udev-enabled kernel. This might be because the kernel doesn't know anything about /dev/sd* itself when not using devfs. append="video=radeonfb:1024x768-16@60 rootdelay=10"rootdelay=10specifies that the kernel should wait ten seconds before mounting the root device. The kernel needs that time to detect the Firewire hard disk.
Getting the Open Firmware path
The programm ofpath currently doesn’t fully work with Firewire hard disks. Therefore, I used this command to get the Open Firmware path:
find /proc/device-tree -name 'sbp-2@*'
Be sure to reboot after attaching the hard disk.
You may replace the part that matches your aliases/fw alias by fw/, for example, look above. This will enable you to use the installation on computers with different hardware layouts.
Major and Minor numbers
This table is not complete, but you can see the way the numbers are allocated.
| Major | Minor | Device |
|---|---|---|
| 8 | 0 | sda |
| 8 | 1 | sda1 |
| 8 | 2 | sda2 |
| 8 | 3 | sda3 |
| 8 | 16 | sdb |
| 8 | 17 | sdb1 |
| 8 | 18 | sdb2 |
| 8 | 19 | sdb3 |
| 8 | 32 | sdc |
| 8 | 33 | sdc1 |
| 8 | 34 | sdc2 |
| 8 | 35 | sdc3 |
Feedback
As always, you can send feedback to the author, Michael Hanselmann (known as hansmi).
Links
- http://www.kernel.org/
- The Linux Kernel Archives
- http://www.linux1394.org/
- IEEE 1394 for Linux
- http://www.1394ta.org/
- 1394 Trade Association