[ydl-gen] YDL 5 installation on Xserve
Bill Fink
billfink at mindspring.com
Tue Sep 4 11:15:24 MDT 2007
On Tue, 4 Sep 2007, Atro Tossavainen wrote:
> > I'd install YDL 5.0.2 onto an external FireWire drive, boot that,
> > use rsync to copy the FireWire "/" root filesystem to the RAID1
> > root file system, update /etc/fstab and /etc/yaboot.conf as necessary
> > on the RAID1 root file system, and then hopefully reboot into the
> > RAID1 root file system (and re-run "ybin -v" after the reboot to
> > make the boot process be properly associated with the internal
> > disks rather than the external FireWire drive, but it would be
> > good to leave a yaboot entry that allows booting back to the
> > FireWire drive should that ever become necessary).
>
> I'm basically comfortable with all of the above except the fixing of
> yaboot.conf. The boot tools haven't got a clue about metadevices,
> I think, and I'm wondering how I should proceed with it.
>
> Also wondering about whether the Xserve will boot from either a FireWire
> or a USB disk, or internals only. If it's internal only, the whole
> exercise will be pointless.
You can't boot from a USB disk, but you can boot from an external
FireWire disk, although I've never actually tried it on an XServe
(but I don't know any reason it shouldn't work).
I'm attaching a copy of a HOWTO I wrote describing how to boot from
an external FireWire disk. It's somewhat outdated at this point,
and geared for the opposite of what you're trying to do (it describes
a scenario going from an internal boot disk to an external FireWire
boot disk), but a lot of the principles should be the same. I believe
recent YDL allows you to install directly to an external FireWire disk,
and should take care of most of the FireWire details for you. The main
thing you need to do is make sure that the initrd loads all the
necessary modules to deal with metadevices / RAID disks (I thought
this was all already in the distributed YDL initrd). Note one area
that has changed since I wrote my HOWTO is that the initrd is now
in a different format (it's now in cpio format so you'll have to
use cpio if you need to mess with the initrd ("man cpio")).
-Hope this helps
-Bill
FireWire Booting HOWTO:
--------------------------------------------------------------------------------
HOWTO Boot PPC Linux From An External FireWire Disk
---------------------------------------------------
Prerequisites:
1. A fairly recent PowerMac that has support for OpenFirmware
booting of FireWire disks (if you can't boot MacOS from
FireWire then you won't be able to boot Linux either).
2. A recent Linux distro and kernel, with the kernel built
having the ieee1394, ohci1394, raw1394, and sbp2 drivers
configured as modules.
3. Recent Linux IEEE1394 drivers.
4. Necessary SCSI drivers such as basic SCSI support
(CONFIG_SCSI) and SCSI disk support (CONFIG_BLK_DEV_SD),
and any other kernel drivers required for booting such
as ext3 filesystem support should be built into the
kernel, or else you will have to modify the initial
RAM disk (initrd) accordingly.
A sample configuration that was used to verify FireWire booting is
running YellowDog Linux 3.0 with an SMP 2.4.20-ben10 kernel on a
dual 500 MHz G4 and using version 948 of the SVN branches/linux-2.4
tree from:
http://svn.linux1394.org/
The FireWire disk that was used is a LaCie 80 GB FireWire disk.
The following steps outline the process for enabling booting from
an external FireWire disk:
1. Load the necessary Linux IEEE1394 drivers by:
modprobe ieee1394
modprobe ohci1394
sleep 2
modprobe raw1394
modprobe sbp2
The sleep may be necessary to allow the ohci1394 driver
to fully initialize before loading the sbp2 module that
recognizes any FireWire disks.
The raw1394 driver isn't really necessary for booting
from a FireWire disk, but it is very useful in conjunction
with the gscanbus utility for obtaining information about
all the devices connected to the FireWire/IEEE1394 bus
and their capabilities.
2. If using very recent Linux IEEE1394 drivers, it will
be necessary to run:
rescan-scsi-bus.sh
to attach any FireWire disks to the SCSI subsystem.
On the sample configuration this results in the
LaCie 80 GB FireWire disk being recognized as sdd.
Here is the output of "cat /proc/scsi/scsi":
Attached devices:
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: QUANTUM Model: XP34550S Rev: LYK8
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 04 Lun: 00
Vendor: UMAX Model: Astra 1220S Rev: V1.2
Type: Scanner ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 05 Lun: 00
Vendor: IOMEGA Model: ZIP 100 Rev: J.02
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 06 Lun: 00
Vendor: iomega Model: jaz 1GB Rev: J.86
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: ST380021 Model: A Rev: 3.05
Type: Direct-Access ANSI SCSI revision: 06
The kernel had already identified four SCSI devices before
the IEEE1394 sbp2 module was loaded (three disks and a
scanner). The first disk is a 4 GB Quantum XP34550S that
becomes sda. The UMAX Astra 1220S Scanner is not a disk
and uses the SCSI generic device driver thus becoming sg1.
The second real SCSI disk is an IOMEGA ZIP 100 MB which
becomes sdb, while the IOMEGA JAZ 1 GB disk becomes sdc.
Finally the last SCSI device listed is the LaCie 80 GB
FireWire disk, which as the fourth SCSI disk becomes sdd.
Note it is on scsi1 whereas all the real SCSI devices are
on scsi0, and also note the listed values for Channel,
Id, and LUN. The sequence "1 0 0 0" will be important
later, where the '1' is the '1' in scsi1, the first '0'
is the Channel, the second '0' is the Id, and the third '0'
is the Lun.
Also checkout "cat /proc/bus/ieee1394/devices":
Node[00:1023] GUID[XXXXXXXXXXXXXXXX]:
Vendor ID: `LaCie Group SA ' [0x00d04b]
Capabilities: 0x0083c0
Bus Options:
IRMC(0) CMC(0) ISC(0) BMC(0) PMC(0) GEN(0)
LSPD(0) MAX_REC(64) CYC_CLK_ACC(255)
Unit Directory 0:
Vendor/Model ID: LaCie Group SA [00d04b] / LaCie 1394 Disk drive LUN 0 [000000]
Software Specifier ID: 00609e
Software Version: 010483
Driver: SBP2 Driver
Length (in quads): 8
Node[01:1023] GUID[YYYYYYYYYYYYYYYY]:
Vendor ID: `Linux OHCI-1394' [0x000000]
Capabilities: 0x0083c0
Bus Options:
IRMC(1) CMC(1) ISC(1) BMC(0) PMC(0) GEN(0)
LSPD(2) MAX_REC(2048) CYC_CLK_ACC(0)
Host Node Status:
Host Driver : ohci1394
Nodes connected : 2
Nodes active : 2
SelfIDs received: 2
Irm ID : [01:1023]
BusMgr ID : [63:1023]
In Bus Reset : no
Root : yes
Cycle Master : yes
IRM : yes
Bus Manager : no
Node[00:1023] is the LaCie 80 GB FireWire disk. Also
make note of its 16 hexadecimal (8 byte) GUID, here
just represented as XXXXXXXXXXXXXXXX.
3. Partition the FireWire disk as desired, in this case sdd,
but replace sdd with whatever sdX corresponds to your
actual hardware configuration. The LaCie 80 GB FireWire
disk was originally formatted with the Apple MacOS
Drive Setup utility and then the desired Linux partitions
were added with the Linux pdisk utility. Here is the
output of "pdisk -l /dev/sdd" (again replace sdd with
your specific equivalent):
Partition map (with 512 byte blocks) on '/dev/sdd'
#: type name length base ( size )
1: Apple_partition_map Apple 63 @ 1
2: Apple_Driver43*Macintosh_SL 128 @ 64
3: Apple_Driver_ATA*Macintosh_SL 128 @ 192
4: Apple_FWDriver Macintosh_SL 224 @ 320
5: Apple_Free Extra 224 @ 544
6: Apple_HFS "extra" 78150000 @ 768 ( 37.3G)
7: Apple_HFS "extra2" 25165824 @ 78150768 ( 12.0G)
8: Apple_UNIX_SVR2 / 8388608 @ 103316592 ( 4.0G)
9: Apple_Bootstrap bootstrap 40960 @ 111705200 ( 20.0M)
10: Apple_UNIX_SVR2 swap 2056192 @ 111746160 (1004.0M)
11: Apple_UNIX_SVR2 /home 42499135 @ 113802352 ( 20.3G)
Device block size=512, Number of Blocks=156301487 (74.5G)
DeviceType=0x1, DeviceId=0x1
Drivers-
1: 92 @ 64, type=0x1
2: 97 @ 192, type=0x701
Using the Apple MacOS Drive Setup utility to originally
format the FireWire disk is only required if MacOS is
also going to be run from the FireWire disk. Note MacOS 9
and earlier requires the FireWire driver installed on the
FireWire disk as part of this process to be able to boot
from FireWire (note the "Apple_FWDriver" listed above
on sdd4). MacOS X does not require these driver
partitions to be able to boot from FireWire. If only
Linux is being booted from the FireWire disk, pdisk may
be used to create the partition table, and the extra
partitions for MacOS aren't necessary. In that case
the first Linux partition would be partition 2 (since
partition 1 is the partition map).
The LaCie 80 GB FireWire disk was partitioned with four
Linux partitions, namely the root partition ("/") on sdd8,
the bootstrap partition for yaboot on sdd9, a swap partition
on sdd10, and the /home partition on sdd11. Note the bootstrap
partition needs to be created as type Apple_Bootstrap. These
sample partitions will be used throughout the rest of this
HOWTO but you should of course replace them with whatever is
appropriate for your specific hardware setup and partitioning
scheme.
4. Make the root filesystem on the FireWire disk:
mkfs /dev/sdd8
Replace sdd8 with the actual root partition in your case,
where the second 'd' in sdd8 represents which SCSI disk
is being referenced and the '8' represents the desired
partition for the root partition on that disk. Make
extremely certain you reference the correct SCSI disk
and partition as this step will destroy any previously
existing data that may have been on that partition.
You optionally may want to use the "-t ext3" option to
mkfs to create an ext3 filesystem (recommended) or the
"-c" option to check the device for bad blocks before
building the filesystem (also recommended but somewhat
time consuming).
5. Format the bootstrap partition as HFS for yaboot with:
hformat /dev/sdd9
Again replace sdd9 with the actual partition created
for the bootstrap partition and be extra careful to
reference the correct SCSI disk and partition.
6. Create the swap partition by:
mkswap /dev/sdd10
You may also want to use the "-c" option for mkswap to
check for bad blocks (recommended).
Replace sdd10 with your actual swap partition and be
sure to use the correct disk and partition.
7. Optionally create a /home partition with:
mkfs /dev/sdd11
You may also want to use the "-t ext3" or "-c" options
to mkfs. Change sdd11 to the actual desired partition
and make certain it is the correct partition.
8. Mount the FireWire root filesystem:
mkdir /fw
mount /dev/sdd8 /fw
You may want to create an entry in /etc/fstab:
/dev/sdd8 /fw ext2 noauto 0 0
If you created the FireWire root filesystem as ext3, then
of course change ext2 above to ext3. If you have this entry
in /etc/fstab, then you can mount the FireWire root file
system by simply:
mount /fw
Use the appropriate sdXX for your actual FireWire root
filesystem partition instead of the sample sdd8.
If you plan on moving the FireWire disk around to different
systems with different SCSI configurations, the hardcoded
device /dev/sdd8 won't work, since for example on a system
with no real SCSI disks, instead of sdd8 the FireWire root
filesystem would become sda8, so attempts to mount the
filesystem would fail.
To deal with this situation, you can use filesystem labels
for mounting the FireWire filesystems instead of specifying
a hardcoded device name. First you need to create the
filesystem labels on the FireWire filesystems, which can
be done using "tune2fs -L". For example, to give the
FireWire root filesystem on sdd8 a label of "fw1-root",
use the command:
tune2fs -L fw1-root /dev/sdd8
You can check what you've done by:
tune2fs -l /dev/sdd8
Now change the /etc/fstab entries for the FireWire
filesystems to reference the filesystem labels instead
of the device name. For example, for the FireWire
root filesystem, the /etc/fstab entry would become:
LABEL=fw1-root /fw ext2 noauto 0 0
Use of filesystem labels for mounting those filesystems
requires DEVFS_FS support in the kernel (and also PROC_FS
support so /proc/partitions can be examined). In addition,
the devfs device nodes must be accessible through /dev,
which can be accomplished by enabling DEVFS_MOUNT in
the kernel. If you don't mind running with devfs mounted
on /dev then you should be all set for mounting using
filesystem labels.
If however you don't want to have devfs mounted on /dev,
there is a workaround. First create an alternate mount
point for devfs with:
mkdir /dev2
Then create a devfs entry in /etc/fstab using /dev2:
none /dev2 devfs defaults 0 0
Prior to rebooting, mount devfs on /dev2 by:
mount /dev2
And create a symbolic link from /dev/scsi to /dev2/scsi:
ln -s /dev2/scsi /dev/scsi
Now when mounting a filesystem by its label, when the
mount command attempts to access for example the devfs
device corresponding to sdd8, which is:
/dev/scsi/host1/bus0/target0/lun0/part8
that access will succeed because of the /dev/scsi
symbolic link to /dev2/scsi. And all of the regular
non-devfs devices will still be available via /dev.
If you also want to use filesystem labels for mounting
any of the internal disk filesystems, you will also
want to create a symbolic link from /dev/ide to
/dev2/ide.
At this point you should be able to successfully mount
the FireWire filesystems using their filesystem labels.
9. Copy the root filesystem from the internal hard drive
to the FireWire root filesystem using rsync by:
rsync -av -x --delete --exclude /.journal --exclude /lost+found --exclude /proc --exclude /fw --exclude /home --exclude /etc/fstab --exclude /etc/yaboot.conf / /fw
mkdir /fw/proc
The "--delete", "--exclude /etc/fstab", and
"--exclude /etc/yaboot.conf" options to rsync aren't
really necessary for the initial copy, but the above
rsync command can also be used subsequently to keep
the FireWire root filesystem synced to the root file
system on the internal hard drive. The "-av" option
says to use archive mode which copies the entire file
system and to be verbose about it listing every file
being deleted, added, or modified. The "-x" option
indicates to rsync to not cross filesystem boundaries,
which in this case means to copy only the root filesystem
itself and not any other mounted filesystems. It's
also generally a good idea to add the "--dry-run"
option to rsync the first time you run the command
to make sure it's actually going to do what you expected
it to do. Finally, make certain that the FireWire
root filesystem is actually mounted on /fw before
running the above rsync command (check with df) so
you don't inadvertently scribble on your internal
hard disk's root filesystem.
10. Create the initial RAM disk (initrd) that will be used
to load all the necessary Linux IEEE1394 device drivers
during the boot process by:
mkinitrd --with=ieee1394 --with=ohci1394 --with=raw1394 --with=sbp2 /boot/initrd-`uname -r`.gz `uname -r`
The "--with=" options to mkinitrd specify what kernel
modules need to be loaded and their order of loading,
and include the necessary Linux IEEE1394 kernel drivers
for booting from a FireWire disk, specifically ieee1394,
ohci1394, raw1394, and sbp2. `uname -r` for the sample
configuration is 2.4.20-ben10-smp. This is used to
associate the initrd with the version of the running
kernel since the kernel modules are tied to that version.
11. Uncompress the initrd with:
gunzip /boot/initrd-`uname -r`.gz
12. Mount the initial RAM disk image using the loop device:
mount -o loop /boot/initrd-`uname -r` /mnt
13. Edit the /mnt/linuxrc nash script (see "man nash" for
details) that is used to prepare for and then mounts
the FireWire root filesystem, by performing such tasks
as loading all the necessary Linux IEEE1394 kernel
drivers. First, after the "insmod /lib/ohci1394.o"
line, add a new line:
sleep 2
This is to allow time for the ohci1394 driver to
fully initialize before loading the sbp2 driver.
Then, after the "mount -t proc /proc /proc" line,
add a new line:
echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
This is the equivalent of running the rescan-scsi-bus.sh
script. The sequence "1 0 0 0" is for the sample hardware
configuration and should be changed to reflect your actual
hardware configuration. Remember that these values are
extracted from the /proc/scsi/scsi information for the
FireWire disk. Repeated here is the info for the LaCie
80 GB FireWire disk:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: ST380021 Model: A Rev: 3.05
Type: Direct-Access ANSI SCSI revision: 06
The "1 0 0 0" sequence is derived from the first line
of the info, where the '1' is the '1' in scsi1, and the
"0 0 0" is the Channel, Id, and Lun.
For a transportable, bootable FireWire disk that can
be used on multiple systems with different SCSI
configurations, add a "scsi add-single-device" command
for each possible SCSI device configuration. The
following probes all SCSI IDs on controllers 0 and 1:
echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 6 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 7 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 6 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 7 0" > /proc/scsi/scsi
Redundant "scsi add-single-device" commands for already
existing real SCSI devices do not appear to be harmful.
Finally, if you are using the workaround described earlier
to mount devfs on /dev2, you will need to add the following
mount command at the very end of the linuxrc script:
mount -t devfs /dev2 /dev2
This is necessary because devfs must be mounted on /dev2
(and thus /dev/scsi can actually access /dev2/scsi) before
the FireWire root filesystem can be successfully remounted
read-write using its filesystem label.
Here is what the resultant linuxrc nash script looks like
(for the transportable case and mounting devfs on /dev2):
#!/bin/nash
echo "Loading ieee1394.o module"
insmod /lib/ieee1394.o
echo "Loading ohci1394.o module"
insmod /lib/ohci1394.o
sleep 2
echo "Loading raw1394.o module"
insmod /lib/raw1394.o
echo "Loading sbp2.o module"
insmod /lib/sbp2.o
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 6 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 7 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 6 0" > /proc/scsi/scsi
echo "scsi add-single-device 1 0 7 0" > /proc/scsi/scsi
echo Creating block devices
mkdevices /dev
echo Creating root device
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc
mount -t devfs /dev2 /dev2
The last line should be removed if devfs is being
automatically mounted on /dev by the kernel.
14. Unmount the initial RAM disk:
umount /mnt
15. Re-compress the initial RAM disk (initrd):
gzip /boot/initrd-`uname -r`
16. Copy the compressed initial RAM disk to the /boot
directory of the FireWire disk's root filesystem:
cp /boot/initrd-`uname -r`.gz /fw/boot
17. Create the /etc/fstab file for the FireWire disk's
root filesystem. It's probably a good idea to use
the current /etc/fstab as a starting point:
cp /etc/fstab /fw/etc
Then edit /fw/etc/fstab to reflect the new locations
of the root, swap, and home partitions on the FireWire
disk. Here are the entries for these partitions that
reflect the sample partitioning scheme used for the
LaCie 80 GB FireWire disk:
/dev/sdd8 / ext2 defaults 1 1
/dev/sdd10 swap swap defaults 0 0
/dev/sdd11 /home ext2 defaults 1 2
Of course if you created the root and /home partitions
as ext3, then change ext2 above to ext3. The above
reflects that the root ("/") partition is on sdd8,
swap is on sdd10, and /home is on sdd11. Change sdd8,
sdd10, and sdd11 to match your actual SCSI disk hardware
configuration and FireWire disk partitioning scheme.
For a transportable, bootable FireWire disk, use filesystem
labels instead of device names for the FireWire filesystems.
Assuming the root and /home filesystems were labeled with
"fw1-root" and "fw1-home" respectively using "tune2fs -L",
their /fw/etc/fstab entries on the FireWire disk would
become:
LABEL=fw1-root / ext2 defaults 1 1
LABEL=fw1-home /home ext2 defaults 1 2
The swap partition is more problematic since it is not
possible to label a swap partition. If you have sufficient
memory, the simplest solution is to run without swap, in
which case simply comment out the /fw/etc/fstab entry for
swap by placing a '#' character as the first character
on the line or remove the swap entry from the file.
Alternatively, you could manually add the swap device
once the system is up. Assuming you moved the sample
LaCie 80 GB FireWire disk to a system with no real SCSI
disks, it would become sda and the swap partition would
be sda10, so you could use the swapon command to add
/dev/sda10 as a swap partition:
swapon /dev/sda10
You can check on what swap partitions are in use with
"swapon -s".
You could devise a simple script run from
/etc/init.d/rc.local that determined where the root
partition was mounted (for example by using df) and
then adjusting that to locate the swap partition.
Or you could use a swap file instead of a swap partition
(see "man swapon" for details).
Finally, if you used the workaround to mount devfs on
/dev2, then comment out or remove the /fw/etc/fstab
entry for devfs on the FireWire disk, since the initrd
will already have mounted devfs on /dev2 in that case.
18. Find out the OpenFirmware path of the FireWire disk.
There are several ways of doing this. One of the easiest
is by doing a find on the /proc/device-tree from Linux:
find /proc/device-tree -name disk@\* | grep firewire
On the sample hardware configuration this results in
the following:
/proc/device-tree/pci at f2000000/pci-bridge at d/firewire at a/node at XXXXXXXXXXXXXXXX/sbp-2 at c000/disk at 0
Removing the "/proc/device-tree" gives the OpenFirmware
path of the sample FireWire disk, namely:
/pci at f2000000/pci-bridge at d/firewire at a/node at XXXXXXXXXXXXXXXX/sbp-2 at c000/disk at 0
The XXXXXXXXXXXXXXXX is the GUID of the FireWire disk, and
should match the GUID given in the output of
"cat /proc/bus/ieee1394/devices". This OpenFirmware
path can actually be abbreviated somewhat to:
/pci at f2000000/@d/firewire at a/node at XXXXXXXXXXXXXXXX/sbp-2/disk at 0
Furthermore, if there is only one FireWire disk, it is not
necessary to specify the GUID, and the OpenFirmware path
can be further abbreviated to:
/pci at f2000000/@d/firewire at a/node/sbp-2/disk at 0
OpenFirmware also has certain predefined device aliases
which can further simplify the OpenFirmware path. On the
sample hardware configuration, there is a device alias
called fwx which can be seen by:
cat /proc/device-tree/aliases/fwx ; echo
which outputs:
/pci at f2000000/@d/firewire at a
Thus by substitution of the fwx alias, the OpenFirmware
path of the FireWire disk can be reduced to:
fwx/node/sbp-2/disk at 0
This generic form may not be applicable on all PowerMacs,
in which case you will need to use one of the longer
forms of the OpenFirmware path for the FireWire disk
that is applicable to your specific hardware configuration.
Another way of determining the OpenFirmware path of the
FireWire disk is via OpenFirmware itself. There are
two ways of booting into OpenFirmware when powering
up your PowerMac. First, if you specified "enableofboot"
in /etc/yaboot.conf before running ybin, when the first
ofboot.b menu is displayed during the boot process,
where you can select what you want to boot such as Linux
(by entering an 'l') or MacOS (by entering an 'm'), you
will also be able to drop back to OpenFirmware by entering
an 'o'. The other way to boot into OpenFirmware is to
hold down the four keys Command (Clover), Option, 'O',
and 'F' while powering up the system.
Once booted into OpenFirmware, you can get an OpenFirmware
device tree representation by entering the command:
dev / ls
Then just look for the section related to firewire.
You can also find out what OpenFirmware device aliases
exist by entering:
devalias
It is also possible to define your own device aliases
using the devalias command and use of the nvramrc.
This can also be accomplished in Linux by use of the
nvsetenv command.
19. Create an entry in /etc/yaboot.conf for booting from
the FireWire disk. It should look something like:
image=fwx/node/sbp-2/disk at 0:8,/boot/vmlinux
label=linux-fw
initrd=/boot/initrd-2.4.20-ben10-smp.gz
root=/dev/sdd8
The "image=" line specifies the location of the vmlinux
Linux kernel on the FireWire disk, which in the sample
case is in the /boot directory on partition 8 of the
FireWire disk referenced by the OpenFirmware path
"fwx/node/sbp-2/disk at 0". You should change the partition
number and OpenFirmware path (if necessary) to reflect
your actual hardware configuration and partitioning
scheme. The "label=" entry specifies what to enter
at the yaboot menu to boot from the FireWire disk,
which in this case is "linux-fw". The "initrd=" entry
indicates to use the compressed initial RAM disk image
that was created earlier. You should replace the
"2.4.20-ben10-smp" portion of the filename with the
output of "uname -r". The "root=" entry specifies
the location of the FireWire root filesystem. The
sample sdd8 should be replaced with the actual SCSI
disk partition that matches your FireWire SCSI disk
name and partitioning scheme.
If you normally specify any additional yaboot image
parameters such as "novideo" or "append=" (for example
to specify the video resolution), just add these after
the "root=" entry.
For a transportable, bootable FireWire disk, use a
filesystem label instead of a device name for the
"root=" parameter. This would change the sample
/etc/yaboot.conf entry given above to:
image=fwx/node/sbp-2/disk at 0:8,/boot/vmlinux
label=linux-fw
initrd=/boot/initrd-2.4.20-ben10-smp.gz
root="LABEL=fw1-root"
The '"' characters on the "root=" parameter are important.
Finally, copy the /etc/yaboot.conf to the FireWire disk's
root filesystem:
cp /etc/yaboot.conf /fw/etc
20. Run ybin to update the bootstrap partition of the
internal hard disk by executing:
ybin -v
21. You're finally ready to boot using the kernel, root
filesystem, and optionally swap on the FireWire disk.
Simply reboot by:
reboot
At the initial ofboot.b menu, select Linux by entering
an 'l', and then at the yaboot menu enter "linux-fw"
to select booting from the FireWire disk.
22. At this point, if all went well, you should now be
running Linux from your FireWire disk (one simple
check is to use df to verify that the root filesystem
is now on the FireWire disk and "swapon -s" to verify
swap is on the FireWire disk if using swap).
23. Actually at this point you're still not booting totally
from the FireWire disk. While the Linux kernel, the
root filesystem, and optionally swap are all being used
off the FireWire disk, the initial bootstrap partition
being used for yaboot is still the one from the internal
hard drive.
To change this it is necessary to edit the /etc/yaboot.conf
file on the FireWire disk root filesystem, which you
should now be booted into. Make the following changes
to /etc/yaboot.conf:
First, find the "boot=" line that specifies the location
of the bootstrap partition, and change it to reference
the bootstrap partition for yaboot on the FireWire disk,
such as:
boot=/dev/sdd9
Change sdd9 to reflect the SCSI disk name for your
FireWire disk and which partition on your FireWire
disk contains the bootstrap partition.
Since yaboot will not be able to figure out the
OpenFirmware path of the FireWire disk bootstrap
partition, you will need to add an "ofboot=" line
after the "boot=" line, which should be similar
to the following:
ofboot=fwx/node/sbp-2/disk at 0:9
Note the OpenFirmware path of the FireWire disk bootstrap
partition is not dependent on the actual SCSI configuration
of the system, and is just a generic FireWire path, so it
should be usable on multiple systems with different real
SCSI configurations.
Again you will need to change the trailing '9' to
specify what actual partition on your FireWire disk
contains the bootstrap partition for yaboot. If
the device alias fwx is not available on your system,
you may have to use the longer, more explicit form
of the OpenFirmware path for the FireWire disk.
And if you have more than one FireWire disk, you
may have to explicitly specify node at XXXXXXXXXXXXXXXX,
where XXXXXXXXXXXXXXXX is the GUID of the FireWire
disk, instead of just using the shorthand "node".
Next find the "device=" line and change it to correspond
to the OpenFirmware path of your FireWire disk. It
should look something like this:
device=fwx/node/sbp-2/disk at 0:
The same comments regarding the "ofboot=" line also
apply here.
Then find the "partition=" line and modify it to point
to the partition on the FireWire disk that contains
the Linux kernel images, namely the FireWire disk's
root filesystem. For example:
partition=8
Change the '8' to be the appropriate partition number
for the root filesystem on your FireWire disk.
Now find the "image=/boot/vmlinux" section, and modify
it to look similar to the following:
image=/boot/vmlinux
label=linux
initrd=/boot/initrd-2.4.20-ben10-smp.gz
root=/dev/sdd8
The "image=" line simply specifies the normal
Linux kernel located at /boot/vmlinux. The "label="
entry specifies what needs to be entered at the
yaboot menu to boot this kernel, and the value of
"linux" is usually also the default when no explicit
value is entered within the timeout period. The
"initrd=" entry provides the location of the initial
RAM disk image. Replace the string "2.4.20-ben10-smp"
with whatever the output of "uname -r" is on your
system. The "root=" entry indicates the location
of the root filesystem on the FireWire disk. Change
sdd8 to reflect the SCSI disk name of your FireWire
disk and the actual location of the root filesystem
on it.
If you normally have any additional image parameters
such as "novideo" or "append=", just add them after
the "root=" entry.
For a transportable, bootable FireWire disk, use a
filesystem label instead of a device name for the
"root=" parameter. This would change the sample
/etc/yaboot.conf entry given above to:
image=/boot/vmlinux
label=linux
initrd=/boot/initrd-2.4.20-ben10-smp.gz
root="LABEL=fw1-root"
To simplify the process of switching back to booting
from the internal hard disk, it is recommended that
you add an "image=" section similar to the following
to your /etc/yaboot.conf file:
image=hd:14,/boot/vmlinux
label=linux-hd
root=/dev/hda14
The "image=" line specifies the location of the
Linux kernel at /boot/vmlinux on the internal hard
drive. Change the "14" to the partition number of
the root filesystem on the internal hard drive
(you may also need to change the "hd" device alias
if it is not appropriate for your actual hardware
configuration). The "label=" entry of "linux-hd"
provides a simple way to have yaboot boot from the
internal hard drive. The "root=" entry indicates
what partition is the root filesystem on the internal
hard drive. Change hda14 to be the actual partition
name of your internal hard drive's root filesystem.
Once again, add any other image parameters you normally
specify such as "novideo" or "append=" after the
"root=" entry.
24. Run ybin to update the bootstrap partition for
yaboot by running:
ybin -v
25. You're now ready to boot totally from your FireWire
disk, completely independent of your internal hard
drive. Reboot your system by:
reboot
At the initial ofboot.b menu enter 'l' to boot Linux.
Then at the yaboot menu, just enter "linux". Or if
you have the normal yaboot defaults, you don't have
to enter anything, and your system will now boot
Linux from your external FireWire disk.
26. At this point, you should be completely set, running
Linux from your FireWire disk. A few simple checks
to make are running df, "swapon -s" (if using swap),
and "nvsetenv | grep boot". In theory, you should
even be able to disconnect your internal hard drive
if you wished, and everything should continue to
work just fine using just your external FireWire
disk.
27. If you want to switch back to booting from your
internal hard drive, simply reboot your system with:
reboot
At the initial ofboot.b menu enter 'l' to boot Linux.
Then simply enter linux-hd at the yaboot menu to boot
from your internal hard drive.
Once your system is booted from your internal hard
drive, login and run:
ybin -v
This will cause the bootstrap partition of your internal
hard drive to be used instead of the bootstrap partition
of your FireWire disk for subsequent boots, causing your
system to once again boot by default from your internal
hard drive.
28. If you want to take your FireWire disk to another
PowerMac system, even one that doesn't have Linux
installed on it, you should be able to boot Linux
from your external FireWire disk by simply doing the
following:
Boot into OpenFirmware by holding down the four keys
Command (Clover), Option, 'O', and 'F' during the
powerup boot sequence.
Define the boot-device to be the OpenFirmware path of
the ofboot.b OpenFirmware script on your external
FireWire drive by entering something similar to the
following:
setenv boot-device fwx/node/sbp-2/disk at 0:9,\\:tbxi
Change the '9' above to be the actual partition number
of the bootstrap partition for yaboot on your FireWire
disk. If the fwx device alias is not suitable on the
target system, you may need to give the longer, more
explicit form of the OpenFirmware path of the FireWire
disk on the target system, which may very well be
different from system to system. You may also need
to use the more explicit "node at XXXXXXXXXXXXXXXX" form,
where "XXXXXXXXXXXXXXXX" is the GUID of your FireWire
disk, instead of the simple shorthand "node".
Remember that you can examine the OpenFirmware device
tree with:
dev / ls
And that you can check what OpenFirmware device aliases
exist by:
devalias
All you should have to do now is enter:
reset-all
This should bring up the ofboot.b menu. Just enter 'l'
to boot Linux. Then at the yaboot menu just enter 'linux'.
Assuming your kernel is compatible with the hardware of
the target system, the system should now boot into Linux
from your external FireWire drive.
29. For further information, consult the man pages for
boot, yaboot, yaboot.conf, ybin, mkinitrd, nash, pdisk,
mkfs, hformat, mkswap, tune2fs, and rsync.
30. Enjoy! :-)
-Bill Fink
8/28/03
More information about the yellowdog-general
mailing list