NetBSD Developer Documentation: Building and Packaging a Release or Snapshot
These instructions are for building releases and snapshots of NetBSD version 1.5 or later. They cover the steps to go from a source tree to a set of .tgz files comprising a release. You can also make a snapshot this way, though of course it should be clearly labeled as such.
NoteWhen uploading a snapshot, please do not forget to update the feature table.
The NetBSD release format is described in the
release(7) manual page.
also useful documentation.
The .tgz files are built in two steps. In the first, you build the base distribution. The second step is to build the X Window System distribution files. Some architectures require extra steps to build installation materials (such as boot loaders or boot floppy images). All of the following steps assume that you change to `src' to get to the root of your NetBSD source tree.
In earlier versions, there was a (US) domestic section of NetBSD containing code based on DES which could not be legally exported from the United States or Canada. For more details please see our page on Exportability of NetBSD crypto code.
The steps to build and package a release are as follows.
I. Building the Base System (top)
- Set the variables you will need for your build. The
following can be set in the environment (lowest priority) or in
/etc/mk.confor on the make command line (highest priority). Here is an example
# The location of your source tree. BSDSRCDIR=/home/cjs/netbsd/src # The location of the object files produced by the build. BSDOBJDIR=/home/cjs/netbsd/obj # These two aren't really necessary; they just make life # easier if/when you rebuild later. See /usr/share/mk/bsd.README # for exact definitions. See also the top-level Makefile in src. BUILD=1 UPDATE=1 # Where to install the binaries DESTDIR=/usr/home/cjs/netbsd/destdir # Where to put the actual release files RELEASEDIR=/usr/home/cjs/netbsd/release
NoteSome scripts in the src directory require
DESTDIRset in the environment (e.g.
checkflist, see below). Also setting
/etc/mk.confmay affect building of packages in pkgsrc. You may find it easier and safer to set
RELEASEDIRin the environment or on the make command line.
- Change to your source directory, and build the release.
cd src make obj make releaseOr you may wish to set some variables on the make command line. For example:
make DESTDIR=/home/destdir RELEASEDIR=/home/releasedir release
II. Building X (top)
The information for building and packaging the X sets is similar to the main sets above. Change directory into your X source directory and type:
or if you are specifying variables on the make command line:
make DESTDIR=/home/destdir RELEASEDIR=/home/release
NoteNote that I and II assume that the set-lists are up-to-date. You may want to check them. Instead of doing `make release' in each case:
cd src make obj # Build the object code and install it. make build # Install the final bits of the distribution. cd src/etc && make distribution # Make the xsrc object code and install it. cd xsrc && make build
To check the set-lists for accuracy, update them appropriately, and then make the tar files for the sets, do the following:
cd src/distrib/sets sh ./checkflist -both
Now edit the files src/distrib/sets/lists/*/* as necessary.
cd src/etc make INSTALL_DONE=1 release cd xsrc make INSTALL_DONE=1 release
III. Building Installation Materials (top)
On most architectures, the basic installation materials are
handled by the `make release' in step I above. However, sometimes
architecture-dependent things that need to be done
src/distrib/; some of these are not yet
documented here. The results then need to be put in
by hand (following the conventions listed in the
release(7) manual page).
To produce an ISO9660 image of a release for making CD-ROMs, do
steps I and II and ensure that you have mkisofs (from
package) installed on your machine and in your
cd src/etc make iso-image
will make an ISO9660 image and save it in
This page can still use a lot of work. Comments and updates
for this page may be sent to