How to build a STABLE OpenBSD Install CD from source

Ever needed a personal STABLE OpenBSD install CD? Sure, we all have especially those tranny loving grannies.

It’s important to note that there are no official full CD install ISO’s of OpenBSD available for download, which is on purpose. Please respect Theo’s wishes and his copyright to the filesystem layout and be sure to order your official install CDs and support the project.

This howto assumes that you already have OpenBSD Installed with the needed development tools. It also assumes that all of the commands below are run as root. Not all commands need to be run as root, but in the interest of simplifying this howto I assume you either know when to use sudo or you’ve su’ed to root before any of the steps below.

Technorati Tags: , ,

First we need to get the release sources before we update them. I prefer to ftp down the release sources and update to stable via CVS (seems faster to me).

# ftp
# cd pub
# cd OpenBSD
# cd 3.8
# mget *.gz

Say yes to all the prompts except sys.tar.gz since it is contained within src.tar.gz
You will end up with ports.tar.gz, src.tar.gz and XF4.tar.gz

Untar the sources to their correct locations

# tar zxvf ports.tar.gz -C /usr/
# tar zxvf XF4.tar.gz -C /usr/
# tar zxvf src.tar.gz -C /usr/src/

Now that we have the release sources on our system it’s time to update them via cvs

# export

To update ports

# cd /usr/ports/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To update the X sources

# cd /usr/XF4/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To update the system sources

# cd /usr/src/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To build the X sources you’ll need a specific version of TCL and TK (8.4)

# cd /usr/ports/lang/tcl/8.4/
# make install clean

# cd /usr/ports/x11/tk/8.4/
# make install clean

You will also need cdrtools if you plan on making the ISOs on this box.

# cd /usr/ports/sysutils/cdrtools/
# make install clean

Now it’s time to basically follow man release(8)

Build and install a new kernel

# cd /sys/arch/i386/conf
# config GENERIC
# cd ../compile/GENERIC
# make clean depend bsd
# mv /bsd /bsd.old && mv bsd / && chown root:wheel /bsd

Reboot into the new kernel

# reboot

If you have troubles booting into the new kernel you can boot bsd.old

Now it’s time to build the system

The release(8) man page goes through how to make sure your object directories are clean but since this is a new install we won’t worry about it

# cd /usr/src
# make obj
# make build

Once this is done you should be running on stable code

Now we’ll basically create new install files from the stable code by making and validating the system release.

# mkdir /destdir-src
# mkdir -p /releasedir/3.8/i386

The /destdir-src directory will contain a full system install minus X when we’re done with this process

The /releasedir/3.8/i386 directory will contain a generic kernel and the install tarballs made from stable code.

We need the crunch tool to create the ramdisk images

# cd /usr/src/distrib/crunch
# make obj depend all install

Now to make the release

# export DESTDIR=/destdir-src
# export RELEASEDIR=/releasedir/3.8/i386

The DESTDIR should be empty if your following this howto from the beginning but if you aren’t make sure that it is.

# cd /usr/src/etc
# make release

Once that’s done we’ll validate the release

# cd /usr/src/distrib/sets
# sh checkflist
# unset DESTDIR

Now let’s build and install X

First we need an X build directory since building X doesn’t work the same as building the system it should be empty but if it isn’t it needs to be.

# mkdir /xf4-bld
# cd /xf4-bld
# lndir /usr/XF4
# make build

We need a DESTDIR to make the X release it also needs to be empty so don’t try to use the same DESTDIR from earlier.

# mkdir /destdir-xf4
# export DESTDIR=/destdir-xf4
# make release

You should now have all the install files needed in /releasedir/3.8/i386 for a stable install. Now you simply need to rip an ISO of /releasedir

# cd /releasedir
# mkisofs -vrTJV "OpenBSD38" -b 3.8/i386/cdrom38.fs -c boot.catalog -o OpenBSD38.iso /releasedir/

Your ISO is built and just needs to be burned to CD via whatever method you prefer. I use:

# cdrecord -v speed=24 dev=/dev/rcd0c -data /releasedir/OpenBSD38.iso

2 Responses to “How to build a STABLE OpenBSD Install CD from source”

  1. dr.kaos Says:

    Personally, I prefer the mirror over crimelabs…

  2. Mike Borsuk Says:

    Thanks, I just created an ISO from my 4.0-stable build.
    This howto should probably be in release(8).

Leave a Reply