release - building an OpenBSD release
There are several steps necessary to build a system release.
They are:
1. Update sources.
2. Build and install a new kernel.
3. Build a new system.
4. Make and validate the system release.
5. Build and install XF4.
6. Make and validate the XF4 release.
7. Make the third party packages.
The following sections describe each of the required steps
in detail.
Commands to be run as a user with write permissions on the
source and
ports trees (/usr/src and /usr/ports respectively) are preceded by a percent
sign (`%'). Commands that must be run as the superuser
are preceded
by a hash mark (`#').
1. Update sources
A release should always start from a known set of coherent
sources. The
easiest way to ensure that the sources are complete and coherent is to
check them out using the CVS tag the OpenBSD developers add
to the repository
prior to making a release. There are two tags, one
which identifies
the release as it exists on the CD-ROM and another
which identifies
the stable branch. The stable branch, starting with OpenBSD
2.7, contains
the patches described in
http://www.openbsd.org/errata.html. The
tags are of the form:
OPENBSD_x_y_BASE This tag marks the source as it exists on
the release
CD-ROM where x is the major release number
and y is the
minor release number.
OPENBSD_x_y This tag is a moving target. It marks the
sources that
belong to the stable branch. This branch
only contains
errata, no new features.
To update your sources to the versions identified by one of
the above
tags use the commands:
% cd /usr/src && cvs up -r TAG -Pd
% cd XF4SRC && cvs up -r TAG -Pd
% cd PORTSPATH && cvs up -r TAG -Pd
Replace XF4SRC with the path to your X Window System
sources. Replace
PORTSPATH with the path to your ports tree sources, typically /usr/ports.
The above commands assume an existing source tree.
See http://www.openbsd.org/anoncvs.html for instructions on
fetching the
sources for the first time.
Warning: CVS tags are `sticky'. See cvs(1) for more information.
2. Build and install a new kernel
For safety, you should always build and install a new kernel
before
building the programs that will use the kernel. This ensures that any
new system calls, for example, will be present when needed.
To build a
kernel the steps are:
% cd /sys/arch/${ARCH}/conf
where ${ARCH} is the architecture of your machine, e.g., i386.
% vi ${NAME}
where ${NAME} is your kernel configuration file.
You should
not edit GENERIC; create your own kernel configuration if you
need to make modifications. If using GENERIC you
can skip
this step. And yes, you may use vi, mg, or any
other editor
you choose.
% config ${NAME}
% cd ../compile/${NAME}
% make clean depend bsd
In this instance make clean is your friend.
% su
# mv /bsd /bsd.old && mv bsd / && chown root:wheel
/bsd
# shutdown -r now
If the system does not come up you can boot using bsd.old.
3. Build a new system
Now that you are running using your new kernel you can build
a new system.
It's safer (but slower) to remove your object directories and recreate
them before the build. The steps are:
% cd /usr/obj && mkdir -p .old && sudo mv * .old &&
sudo rm -rf
.old &
This moves all your existing object files out of
the way and
then removes them in the background.
% cd /usr/src && nice make obj
This re-builds your obj directories.
% su
# nice make build
If you have set sudo(8) up, you can combine this
with the previous
step using the command
nice make SUDO=sudo build
Update /etc, /var, and /dev/MAKEDEV by hand.
At this point your system is up-to-date and running the code
that you are
going to make into a release.
4. Make and validate the system release
The system release consists of a generic kernel, one CD-ROM
and two floppy
boot-able file-systems, the release `tarballs', installation instructions,
and checksum files.
The release process requires two work areas. They are:
DESTDIR This is the name of a directory which will be
the root of a
complete OpenBSD installation, thus it must be
on a disk
partition large enough to store the entire operating system
(less the X Window System and any third party
`packages').
The directory can be removed once the release
is created.
In any case the release process ensures the directory is
empty before starting.
RELEASEDIR This is the name of a directory where the release output
files are stored. The following process will
create the directory
if necessary.
Warning: DESTDIR and RELEASEDIR must not refer
to any directory
with /mnt in its path as /mnt is used in
the release
generation process.
The floppy and CD-ROM RAMDISK images require a special tool
which is created
first. The release process is:
% su
You must be root to create a release.
# cd /usr/src/distrib/crunch && make obj depend all
install
Create the special tools needed to build the release.
# setenv DESTDIR your-destdir; setenv RELEASEDIR yourreleasedir
# test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}- &&
rm -rf ${DESTDIR}-
&
# mkdir -p ${DESTDIR} ${RELEASEDIR}
The last two steps ensure ${DESTDIR} exists as an
empty directory
and ${RELEASEDIR} exists. ${RELEASEDIR}
need not be empty.
# cd /usr/src/etc && nice make release
# cd /usr/src/distrib/sets && sh checkflist
This checks that the contents of ${DESTDIR} pretty much match
the contents of the release `tarballs'.
# unsetenv RELEASEDIR DESTDIR
At this point you have most of an OpenBSD release. The only
thing missing
is the X Window System (which is covered in the next
section).
5. Build and install XF4
The XF4 tree is primarily imake(1)-based and doesn't contain
the ``obj''
directory mechanism that comes with Berkeley make(1). While
the tree can
be built in place, it's better to refrain from polluting the
cvs sources.
An alternate build location needs to be selected, large
enough to hold
the X Window System object files, libraries, and binaries.
Call this location
XF4BLD. XF4SRC is the path to your X Window System
source files.
Once you've selected XF4BLD the build process is:
% su
# test -d XF4BLD && mv XF4BLD XF4BLD- && rm -rf
XF4BLD- &
# mkdir -p XF4BLD
# cd XF4BLD && lndir XF4SRC && nice make build
Note (only for i386): XF86Setup, built and installed above,
requires version
8.4 of the tcl/tk libraries. They must be installed to
do a proper
build. Version 8.4 of tcl/tk can be found in the ports tree
at
/usr/ports/lang/tcl/8.4/ and /usr/ports/x11/tk/8.4/. Version 8.4 is required
to build XF4. Version 8.4 may coexist with version
8.0.
The above method mimics a make build in the /usr/src directory. The X
Window System is created and installed in /usr/X11R6. However, the install
phase of the build does not overwrite /etc/X11/xdm.
That directory
must be installed by hand. Or you can cd /etc/X11 && mv xdm
xdm- before
the build and copy any local configuration from xdm- to xdm
after the
build.
6. Make and validate the XF4 release
XF4 uses DESTDIR and RELEASEDIR as described above. While
they may be
set to the values used to build the rest of the system, be
aware that the
existing contents of DESTDIR will be removed as part of the
XF4 build
(this is necessary for release checklist processing).
The steps to build the release are (assuming you are still
root, and
still in XF4BLD):
# setenv DESTDIR your-destdir; setenv RELEASEDIR yourreleasedir
# test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}- &&
rm -rf ${DESTDIR}-
&
# mkdir -p ${DESTDIR} ${RELEASEDIR}
# nice make release
# unsetenv RELEASEDIR DESTDIR
At this point you have both OpenBSD system and X Window System `tarballs'
in your release directory.
7. Make the third party packages
The `ports' sub-system of contributed applications is described in
ports(7). For ease of installation ports can be pre-compiled into
`packages' which can then be installed on multiple machines
using
pkg_add(1). Packages are created by selecting an application to build
(we'll call this one CATEGORY/PORT) and then running the
following: as
root:
% cd /usr/ports/CATEGORY/PORT
% su
# make package
That's all there is to it.
cvs(1), pkg_add(1), ports(7), sudo(8)
This document first appeared in OpenBSD 2.8.
OpenBSD 3.6 July 6, 2000
[ Back ] |