Installing Debian on an external firewire disk
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.
- A Macintosh that can boot from external firewire discs and that can boot Debian using yaboot. If you really need to be sure try installing OSX on the firewire disk, hold down option key while rebooting to see if it shows up. My firewire booting powerbook is somewhat old, was top of the line back in 2001 so newer macs should be ok.
- Familiarity with the linux command line, debian installation manual and with kernel compilation for versions 2.6.xxxxx of the kernel. Plenty of resources about that on the net. and on Howtoforge. See also the official Debian reference manual (that is not quite up to date, though).
- A recent version of the debian installer. It must be able to recognize the external firewire drive to partition and install on it. The Debian Sarge installer was NOT recent enough for me, so I suggest to obtain a beta of the debian installer from debian.org. I used the text-based version.
- The following procedure requires the compilation of a custom Debian kernel, so a working Powerpc Linux building environment is needed. No problems if you have linux already installed, tricky if it's your first debian install on the machine. (Maybe a live cd distribution such as ubuntu can let you compile a kernel and package it for debian?). I have no problems offering a .deb kernel package that works for my Titanium Powerbook second series (see Resources). It will likely not work with other Macintosh models, newer Titaniums included (maybe booting in runlevel 1 works?), and I do NOT recommend to download and install binaries (ESPECIALLY THE KERNEL) obtained from untrusted sources - like this site :-)
Step 1: Kernel configuration
I used linux-22.214.171.124 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:
- Device Drivers -> SCSI Device support:
- SCSI device support
- SCSI disk support
- SCSI generic support
- Powermac external and internal SCSI support (among SCSI low level drivers)
- Device Drivers -> IEEE1394 (Firewire) support:
- Raw IEEE1394 I/O support
- OHCI-1394 support
- SBP-2 support
Plus the drivers needed for your firewire card, if any. I enabled also the following, maybe unnecessary:
- OUI Database
- Build in extra config
- IP-1394 Entry
- File Systems: the support for the filesystem that is going to be used on the firewire drive, (i use XFS), must be compiled-in. Others can be kept 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:
# mount /dev/ide/host0/bus0/target1/lun0/part4 /mnt
# cp /mnt/usr/src/kernel-image-126.96.36.199_1_powerpc.deb /mnt
Yaboot needs to know the "Open Firmware path" to the firewire drive, that can be obtained with:
We also need the "major and minor number" of the root partition, which is currently mounted on /target:
/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.
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= 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:
# dpkg -i kernel-image-2.6.xxxxx_powerpc.deb
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.
Let me know if this page was helpful to you, mail me at: dllm70-boborosso at yahoo.com or comment the article.
My files - if you need more detail or inspiration for your setup:
- My own .config for version 188.8.131.52 of the kernel.
- My own yaboot.conf file.
- Email me if you really really need the whole kernel.
Other pages dealing with external firewire boot for Linux:
- IBM Developerworks comprehensive article for an initrd kernel install on linux, it is not mac-specific: http://www.ibm.com/developerworks/linux/library/l-fireboot.html
- Gentoo - (I got all the important hints from this page):
- Ubuntu - http://ubuntuforums.org/showthread.php?t=29837
Original article here.