How to Make a Bootable, Full System OpenBSD 3.2 CDROM
by francisco roque
N.B.: This page is outdated. If i ever get the time, i will rewrite it to use mfs instead of union, possibly even create a Makefile to do all this for you. But for now you'll need to figure out the differences on your own, sorry.
This document will walk you through the steps necessary to create a bootable cd containing a full OpenBSD install. One of the benefits of such a system is that it does not touch the underlying hardware (your hard drives do not get affected), but one of the drawbacks is the lack of writable space (this may also be a benefit). To get around the unwritable space issue, we make use of mfs (memory) and union mounts.
An i386 computer you can install onto, an i386/OpenBSD computer you can compile on, a computer with a cd burner (these can all be the same computer; used two different ones).
It is assumed that you know how to read manpages, compile kernels, patch files, and other simple unix tasks.
Basically, you want to set up the system exactly the way you want the final system running. By doing this on a live system, you can be sure your configuration is actually working, instead of having to burn multiple cds.
option MFS option UNION config bsd root on cd0aYou will probably want to add some other options if you plan on using this cd for firewalling. Here are some to get you started (some are increases to current settings).
pseudo-device bpfilter 8 pseudo-device pf 1 pseudo-device pflog 1
/dev/cd0a / cd9660 rw 0 0
Here is a diff to etc/rc:
--- etc/rc Thu Oct 3 21:33:53 2002
+++ etc/rc-new Tue Oct 29 16:36:05 2002
@@ -72,7 +72,7 @@
echo "Fast boot: skipping disk checks."
elif [ $1x = autobootx ]; then
echo "Automatic boot in progress: starting file system checks."
- fsck -p
+# fsck -p
case $? in
0)
;;
@@ -111,6 +111,15 @@
mount -uw / # root on nfs requires this, others aren't hurt
rm -f /fastboot # XXX (root now writeable)
+echo 'mounting mfs union'
+mount_mfs -s 20000 swap /tmp
+sleep 2
+for file in /* ; do
+ if [ -d $file ] && [ $file != '/dev' ] && [ $file != '/tmp' ]; then
+ mount_union /tmp $file;
+ fi
+done
+
# pick up option configuration
. /etc/rc.conf
@@ -152,8 +161,8 @@
fi
fi
-mount /usr >/dev/null 2>&1
-mount /var >/dev/null 2>&1
+#mount /usr >/dev/null 2>&1
+#mount /var >/dev/null 2>&1
# if there's no /var/db/host.random, make one through /dev/urandom
if [ ! -f /var/db/host.random ]; then
mkisofs -b cdrom32.fs -c boot.catalog -R -v -o image.iso /tmp/cdromsystem/Be sure to specify -R and not -r!
cdrecord -v speed=40 dev=/dev/rcd0c:0,0,0 -data driveropts=burnproof image.iso
There is always room for improvement. Here are some optional steps you can take to change the cd.
You should now have a working OpenBSD system burnt to cd. Depending on your exact application for this cd, you may find it necessary to tweak various aspects. Hopefully there is enough information contained in this doc to get you started.
References from this doc and for more info.
FAQ's:
OpenBSD Install Guide,
Building OpenBSD from source
Manpages:
release(8),
mount_mfs(8),
mount_union(8),
rc(8),
fstab(5),
tar(1),
ssh(1),
dd(1),
mkisofs(8),
cdrecord(2) (part of cdrtools package/port)
Files:
src/distrib/ramdisk/Makefile,
src/sys/arch/i386/conf/RAMDISK_CD,
/etc/rc
Other docs of a similar nature:
A Readonly filesystem on Bootable CD by Marshall Midden - covers a very similar approach for OpenBSD and FreeBSD. i have not encountered the panics and wierd problems with mfs/union mounts that Marshall did, though i was also not able to get /dev union mounted w/o hangs.
Building a CD Bootable Firewall by Etienne de Bruin - much the same, for FreeBSD.
The author of this document is francisco roque, who can be found at
http://www.blackant.net/
This document is copyright francisco roque 2002.
This document is released under BSD style license and may be used in whole or part for anything so long as this section remains intact.
The author takes no responsibility for damages incurred by following the steps in this document, including but not limited to the loss of data or damage to hardware. Good Luck.