Chapter 1. The complete guide to building a SmallWall image from scratch

Table of Contents

1.1. Installing FreeBSD
1.2. Updating and installing needed packages
1.2.1. Initializing the package system
1.2.2. Updating the system with freebsd-update
1.2.3. Installing Packages
1.2.4. Enabling ssh for root
1.3. SVN Checkout and Build Scripts
1.3.1. Checkout the SVN
1.3.2. Setting up the build Environment
1.4. Running the SmallWall build scripts
1.4.1. Running 1makebuildenv.sh
1.4.2. Running 2makebinaries.sh
1.4.3. Running 3patchtools.sh
1.4.4. Running 4buildkernel.sh
1.4.5. Running 5makeimage.sh
1.4.6. Other unsupported stuff in scripts

This guide explains, in detail, all the steps that are required in order to build a complete SmallWall image from scratch. The primary intention is not that people will use the guide to actually build their own images from scratch, as that is rarely necessary, but to document and preserve all the details so that people who would like to make changes to an existing image can see how SmallWall and all of its parts are built.

This guide assumes that FreeBSD 8.4 i386 is used. It is preferred that a separate, dedicated (possibly virtual) machine is going to be used for this task, since a clean environment is best, and many steps need to be done as root. (among other things to get the file ownership and permissions right)

Note that this is not "SmallWall image building for dummies", and readers are expected to know what they're doing. Nor is it an introduction to FreeBSD and Unix like operating systems. As such, not all necessary commands and full file paths are listed (the obvious ones have been left out). It is expected that the user have some Unix like experience before using this guide.

Finally, many of these tasks are automated (especially the image building part). How this is done is left to the reader, and if the scripts do not run it is often a problem with the environment.

1.1. Installing FreeBSD

Install FreeBSD 8.4 i386 as usual, but use one file system only (i.e. don't create a separate partition for /usr)! See the note below for an explanation why this is necessary. Make sure that you choose the "Developer" distribution set. Installing the ports collection is not required if space is tight. The scripts will install the few ports needed.

Note

FreeBSD has all the essential system binaries (mostly those in /bin and /sbin) linked statically so that the system can boot even if /usr (which holds important libraries like libc) is not available (which is often the case when it's on a separate file system). This takes up huge amounts of space though, so we obviously want all the binaries to be linked dynamically for our m0n0wall image.