Create FreeBSD bootable media

Table of Contents

Create sup file and fetch CVS
Make your release (FreeBSD 9.0)
Make your release (FreeBSD before 9.0)

Make your release (FreeBSD before 9.0)

by ross at 08:16:55 on June 18, 2012

To create CD/DVD for 8.2-RELEASE-pN just replace RELENG_8 with RELENG_8_2. Or whatever tag you need.

Build the world

# cd /usr/obj
# rm -rf *
# cd /usr
# rm -rf src
# cvs -R -d /share/freebsd/ncvs co -P -r RELENG_8 src
# cd src
# make SRCCONF=/dev/null __MAKE_CONF=/dev/null buildworld

Patched build

This step is not needed for normal release but if the previous step has failed for some reason (it could happen to -STABLE) you can try to fix it by hand and create a patch. Or maybe you want to customize your release — read on.

# cd /usr
# mv src src.orig
# cvs -R -d /share/freebsd/ncvs co -P -r RELENG_8 src

Edit the files in /usr/src make sure both make buildworld and make buildkernel KERNCONF=GENERIC succeed. Making local buildkernel is not nesseccary for release but this way you make sure everything will be built without errors at the make release step.

# cd /usr
# diff -Nur src.orig src > /somewhere/patch.diff

Now you need LOCAL_PATCHES parameter of make release — patch files against /usr/src that will be applied in the chroot(8) environment before the release build begins. Add the following to make release in the next step.

LOCAL_PATCHES=/somewhere/patch.diff PATCH_FLAGS=-p1

The other parameter of release target you might use is KERNELS — specifies a list of additional kernel configurations to compile and install into the “base” distribution.  Each kernel is installed into /boot/<config> so that it can be booted from the loader via “boot <config>”.

Refer to release(7) to get the details.

Create the release

When /usr/obj is populated with the result of successful make buildworld you can begin the release process. In this example target directory will /share/freebsd/release.

# chflags -R noschg /share/freebsd/release
# rm -rf /share/freebsd/release
# mkdir /share/freebsd/release
# cd /usr/src/release
# make release RELEASETAG=RELENG_8 \
  BUILDNAME=8.2-STABLE-20110728 \
  CHROOTDIR=/share/freebsd/release \
  CVSROOT=/share/freebsd/ncvs \

This command will do all the work and the result will be directory R under CHROOTDIR. Look for your ISO images in R/cdrom directory.

If the command fails even after successful make buildworld (often due to port build errors) you can try to fix the errors and run make rerelease with the same parameters.

Burn the image

I'm using growisofs from sysutils/dvd+rw-tools here.

# cd /share/freebsd/release/R/cdrom
# growisofs -dvd-compat -Z /dev/cd0=FreeBSD-8.2-STABLE-20110728-amd64-dvd1.iso