Rolling your own bootable FreeBSD CD's

One of the things that really drove me nuts somewhere between FreeBSD 6.2 and 7.0, was that the install sets and the live filesystem have been split up in two bootable disks, instead of a single one.

I've got some systems on which I need to do FreeBSD installs by hand, for example when you want to boot off a GEOM Mirror setup. You can't create those with sysinstall, so the only solution seems to be performing an installation by hand. Unfortunately, I don't have a lot of systems with 2 CD-ROM drives, which you'll need to have the install sets and the live filesystem available at the same time. That's why I wrote the following script:

#!/bin/sh

set -e

if [ $# -ne 3 ]
then
	echo "Usage: $0 disc1.iso livefs.iso out.iso"
	exit 1
fi

TMPDIR=cdroot
mkdir $TMPDIR

echo "Extracting $1"
tar --exclude packages -C $TMPDIR -xf $1

# XXX we get a lot of useless errors while extracting. Make sure we
# don't overwrite files, because we need disc1's cdrom.inf.
echo "Extracting $2"
tar --exclude rr_moved -C $TMPDIR -xkf $2 2> /dev/null || true

echo "Fixing up permissions"
find $TMPDIR -exec chmod -h u+w {} +

echo "Writing $3"
mkisofs -r -J -no-emul-boot -b boot/cdboot -o $3 $TMPDIR 2> /dev/null

echo "Removing temporary directory"
rm -Rf $TMPDIR

This script allows you to roll your own FreeBSD installation CD that has both the install sets and the live filesystem on one disk. In order to make everything fit, we have to omit the packages directory, which isn't a real problem, because you can install them afterwards from Ports.

Now you can just start the Fixit shell from the main menu and perform the following steps to install FreeBSD by hand:

Now you should be able to boot your hand-installed FreeBSD system.

Last modified: Mon Mar 21 15:43:36 2011 +0100