HowtoForge

Booting Debian from external firewire on Powerpc Mac

Boot Debian from an external firewire drive on PowerPc Mac.

Using the beta Debian Etch ppc installer and a kernel without initrd.

WARNING!
This page needs feedback, currently "Works for me".

Taken from my debian resources page

Introduction

Messing with a boot process is a delicate matter even on a Mac.
Note that the Debian installer will fail at some point during the procedure.
I offer no warranty and assume no responsibility for whatever loss or damage might be caused to your hardware, software or data.
There are other ways to boot Linux from an external firewire drive documented elsewhere on the net. See the Resources section.

Adding or removing peripherals like usb keys, digital cameras, other external HDs, cdroms etc, or installing/removing devfs, udev, and similar stuff might alter the way Linux sees the firewire drive, i suggest becoming familiar with supplying boot options to yaboot during the boot process. See Man pages of yaboot and yaboot.conf.

Requirements

Step 1: Kernel configuration

I used linux-2.6.14.2 from the official kernel.org archives. Any stable later version of the kernel should work too. I am told to avoid previous versions as firewire support is buggy for large file transfers. TIP: remember to use a .config known to work on your machine.

When configuring the kernel (i.e. with "make menuconfig"), disable the RAM disk support option (found in Device Drivers -> Block devices).

Configuration options that must be compiled-in, that is enabled but NOT marked as modules:

The resulting kernel will not use initrd, so do not use the --initrd option when issuing the make-kpkg command.

You will obtain a kernel-image packaged as a .deb archive.

Step 2: Partial installation of Debian

Boot from the debian installer cd, and proceed with installation. No real need to select the expert option. Sometimes the installer does not recognize the firewire drive. Try aborting and rebooting a couple times before giving up.

I suggest using the manual HD partitioning method, to be sure of what's going on. At least one boot partition and one for the root filesystem are needed on the firewire drive. Write down the partition number you chose for boot and the one for the root filesystem.
TIP: make sure the partitions you need are located in the firewire drive, if you want your installation to be independent of your internal HD! You will need to mark your internal HD swap and boot partitions as unused.

The Install yaboot on a hard disk installation step will fail with a red screen. Choose to Go back to the installation menu and choose to Continue without a boot loader. The installer will display the root filesystem partition name in the form /dev/sdXn where X is a letter, n a number. Write down the letter, the number is identical of the root partition number.

At the Installation complete notice, again choose to Go Back to the installation menu and Execute a shell.

Step 3: Copying the kernel .deb and customizing yaboot.conf

The root partition of your partial installation of Debian is mounted on /target. Copy the kernel .deb you had compiled to /target. You need to create a directory and mount the filesystem containing your kernel on it. Note that the Debian installer's /dev directory can have a very different structure than the one you are accostumed to. For example, mounting the fourth partition of my internal ide drive and copying the .deb from there:

# mkdir /mnt
# mount /dev/ide/host0/bus0/target1/lun0/part4 /mnt
# cp /mnt/usr/src/kernel-image-2.6.14.2_1_powerpc.deb /mnt

Yaboot needs to know the "Open Firmware path" to the firewire drive, that can be obtained with:

# echo /proc/device-tree/pci*/firewire*/node*/sbp-2*
/proc/device-tree/pci@f4000000/firewire@e/node@0010b9210040ad70/sbp-2@c000

We also need the "major and minor number" of the root partition, which is currently mounted on /target:

# mount
...
/dev/scsi/host0/bus0/target1/lun0/part3 on /target type ...
...
# ls -l /dev/scsi/host0/bus0/target1/lun0/part3
brw------- 1 root root 8, 3 Jan 1 1970 /dev/scsi/...

I underlined the major and minor number respectively. Now it's time to prepare an /etc/yaboot.conf file. Edit it using nano.

# nano /target/etc/yaboot.conf

The things that must be customized are underlined in the following example. I guess that correct indentation matters, lines after image are indented with a single tab.

boot=/dev/sda7
ofboot=/pci@f4000000/firewire@e/node@0010b9210040ad70/sbp-2@c000/disk@0:7
device=/pci@f4000000/firewire@e/node@0010b9210040ad70/sbp-2@c000/disk@0:3
partition=3
delay=15
timeout=100
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
enablecdboot

image=/boot/vmlinux
label=Linux
read-only
root=8:3
append="rootdelay=12"

boot= must be followed by /dev/sdXn, X must be replaced by the letter you wrote down earlier and n by the number of the boot partition.

ofboot= must be followed by the Open Firmware path, starting with /pci... and ending with .../disk@0:n where n is, again, the number of the boot partition.

device=is like ofboot but the last number is the one of the root filesystem partition, which must be put after partition= too.

root= needs to be followed by the major and minor numbers you wrote down earlier, separated by a colon.

The root delay option makes the system wait so that the firewire drive can be seen by the kernel. Also, you might want to add/keep some bootloader options to boot from your other linux/macos/osX partitions.

Step 4: Installing kernel and bootloader.

This is done by chrooting into /target:

# chroot /target
# dpkg -i kernel-image-2.6.xxxxx_powerpc.deb
...
Hmmm...
Hmmm...
...
# ybin
#

Finally, exit from chroot and then from the shell with ctrl-d or the command exit, and finish installation. The installer will reboot the system.

Final step: see what happens.

If everything goes well selecting (l)inux at the bootloader prompt and hitting return in the second stage will boot debian and the system will continue with the final installation phase. Sometimes a correctly set up kernel takes too much time to recognize the drive and you have a kernel panic. Try resetting and booting again before giving up. The kernel may panic because it really can't find root, or Open Firmware could not see the partition: that means you have to reset the system, retrying with different boot parameters fed to yaboot, or hold down the option key to reboot from cd or other partitions. Note that to make changes to yaboot.conf you must like: get into the debian installer in expert mode, get to the phase where the firewire drive is recognized, execute a shell, mount the filesystem root partition, fix yaboot.conf, chroot to the filesystem root partition and run ybin again. Good luck.

Tip: mark your kernel image as not upgradeable

Debian upgrades might want to install a newer version of kernel image instead of the custom kernel. That is a bad idea. See how to put packages on hold in debian docs.

Feedback, Comments

Let me know if this page was helpful to you, mail me at: dllm70-boborosso at yahoo.com or comment the article.

Resources

My files - if you need more detail or inspiration for your setup:

Other pages dealing with external firewire boot for Linux:

Booting Debian from external firewire on Powerpc Mac