Skip to main content.
Google custom search

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.


When uploading a snapshot, please do not forget to update the feature table.

The NetBSD release format is described in the release(7) manual page. The file /usr/share/mk/bsd.README is 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)

  1. Set the variables you will need for your build. The following can be set in the environment (lowest priority) or in /etc/mk.conf or on the make command line (highest priority). Here is an example /etc/mk.conf file:
      # The location of your source tree.
      # The location of the object files produced by the build.
      # 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.
      # Where to install the binaries
      # Where to put the actual release files


    Some scripts in the src directory require DESTDIR set in the environment (e.g. checkflist, see below). Also setting DESTDIR in /etc/mk.conf may affect building of packages in pkgsrc. You may find it easier and safer to set DESTDIR and RELEASEDIR in the environment or on the make command line.
  2. Change to your source directory, and build the release.
      cd src
      make obj
      make release
    Or 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:

    make release

or if you are specifying variables on the make command line:

  make DESTDIR=/home/destdir RELEASEDIR=/home/release


Note 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 there are architecture-dependent things that need to be done under src/distrib/arch; some of these are not yet documented here. The results then need to be put in $RELEASEDIR 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 the sysutils/cdrtools package) installed on your machine and in your path. Then:

  cd src/etc
  make iso-image

will make an ISO9660 image and save it in $RELEASEDIR/installation/cdrom.

This page can still use a lot of work. Comments and updates for this page may be sent to .