This site is currently
Under Construction
...soon to be...

OpenBSD Building a Release

Last updated: 2009-06-31

===

Refer: http://www.openbsd.org/faq/faq5.html#BldGetSrc

What is a "release", and why would I want to make one?
A release is the complete set of files that can be used to install OpenBSD on another computer. If you have only one computer running OpenBSD, you really don't have any reason to make a release, as the above build process will do everything you need. An example use of the release process would be to build -stable on a fast machine, then make a release to be installed on all your other machines in your office.

The release process uses the binaries created in the /usr/obj directory in the building process above, so you must successfully complete the build first, and nothing must disturb the /usr/obj directory. A time where this might be a problem is if you use a memory disk as your /usr/obj for a little extra performance in the build process, you would not want to reboot the computer between the "build" and "release" steps!

The release process requires two work directories, which we will call DESTDIR and RELEASEDIR. All the files that are part of a "clean" OpenBSD install will be copied to their proper place within the DESTDIR. They will then be tar(1)ed up and placed in the RELEASEDIR. At the end of the process, RELEASEDIR will hold the completed OpenBSD release. The release process will also use the /mnt location, so this should not be used by anything while the release process is running. For the purpose of example, we will use the DESTDIR of /usr/dest and the RELEASEDIR of /usr/rel.

The release process involves a couple utilities which are not in the base OpenBSD system, crunch and crunchgen(1), which are used to create a single executable file made up of many individual binaries. The name this single executable file is invoked by determines which component binary is run. This is how a number of individual program files are squeezed into the ramdisk kernel that exists on boot floppies and other boot media. These utilities must be built before the release process is started. They only need to be built and installed once, but as people often forget this step, and these programs build quickly, some people opt to just build crunch and crunchgen every time as part of the script they use to make a release.

NOTE: For -current and upcoming 4.5, crunch and crunchgen are part of the base system, skip the separate build step below.

You must have root privileges to make a release.

Doing a Release:

First, if it has not been done on this machine, build crunch and crunchgen:

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

Now, we define our DESTDIR and RELEASEDIR environment variables:

# export DESTDIR=/usr/dest
# export RELEASEDIR=/usr/rel

We now clear the DESTDIR and create the directories if needed:

# test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}.old && rm -rf ${DESTDIR}.old &
# mkdir -p ${DESTDIR} ${RELEASEDIR}

RELEASEDIR does not normally need to be empty before starting the release process, however, if there are changes in the release files or their names, old files may be left laying around. You may wish to also erase this directory before starting.

We now make the release itself:

# cd /usr/src/etc
# make release

After the release is made, it is a good idea to check the release to make sure the tar files are matching what is in the DESTDIR. The output of this step should be very minimal.

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

You now have complete and checked release file sets in the RELEASEDIR. These files can now be used to install or upgrade OpenBSD on other machines.

The authoritative instructions on making a release are in release(8).

Note: if you wish to distribute the resultant files by HTTP for use by the upgrade or install scripts, you will need to add an "index.txt" file, which contains the list of all the files in your newly created release.

# /bin/ls -1 >index.txt

===

Example from: http://myutil.com/tags/openbsd

When the build completes, your system is up to date. If you have only 1 machine, you are done. However, I need patched distribution sets for my other boxes:

export DESTDIR=/usr/dest
export RELEASEDIR=/usr/rel
# setenv DESTDIR /usr/dest
# setenv RELEASEDIR /usr/rel
cd /usr/src/distrib/crunch && make obj depend all install
test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}.old && rm -rf ${DESTDIR}.old &
mkdir -p ${DESTDIR} ${RELEASEDIR}
cd /usr/src/etc
make release
cd /usr/src/distrib/sets/
sh checkflist

We now have a release in /usr/rel. I combine this with an official distribution to get the x-windows sets as I am not building them here. Basically, I copy everything except MD5 from /usr/rel into the 4.2/i386 dist dir that has everything from the ftp server except install42.iso. Then I edit the MD5 to include the new checksums. Now put everthing under a directory structure OpenBSD/4.2/i386. For this example, say it is all in /tmp/OpenBSD/4.2/i386 we can now make the iso cd image:

cd /tmp
mkhybrid -A "OpenBSD-4.2-stable-i386" -P "Me" -V "OpenBSD-4.2-stable-i386" -r -b 4.2/i386/cdbr -c 4.2/i386/boot.catalog -o OpenBSD-4.2-Stable-i386.iso OpenBSD

===