Creating a DiRT installation for a New Version of BSD

When somebody needs BSD installed on a machine, it's typically an easy task. (See e.g. Setting up a 4.1 machine.) However, the process is a bit more involved when they need a specific version of BSD for which no DiRT-specific installation scripts or kernels exist. This guide will help you through the process of creating a new DiRT-specific installation.


Burn the CD

First things first, you need to burn the CD of the BSD version you want to install. It should be straightforward to find the ISO you need from FreeBSD.org. However, I ran into some problems trying to find FreeBSD 5.1, which is apparently depracated, because I couldn't find it anywhere. Even Google didn't help. Eventually I Google'd for the filename of the ISO I needed, as projected from the ISO of version 5.3 (5.1-RELEASE-i386-disc1.iso), and was able to find a mirror that still had the ISO. (If you're really spiffy, you can also specify intitle:"Index of" in the Google search string to only get downloadable links.)

You will only need the first disc, so don't bother getting anything else. You can either burn the ISO on your own hardware, or check out How to Burn a CD.

Install BSD (and kernel sources)

Using the typical install process, install BSD on a machine using the CD you just burned. The only thing to take note of is that you will want to install the kernel sources. Hopefully the nifty menu-driven installation shouldn't make this overly complicated.

Build a DiRT Kernel

On the fresh install, cd to /usr/src/sys/i386/conf/. (Note: for security reasons, you should leave this machine off the network until you can create and run a version-specific /usr/dirt/bin/install_firewall_* script.) Copy the file named GENERIC to DIRT. Now, open up DIRT in your favorite text editor. (If only Vim was installed...) You'll need to make several changes for a DiRT kernel. This step requires some knowledge of BSD kernel configuration and what you will need for your systems, so I can't just list the changes to make. However, a good place to start is to examine the differences between the two kernel configurations (in the same directory) on a machine with a similar version of BSD. (At the time of this writing, liberia has BSD 5.1 and the kernel sources, so that might be your best bet.)

After modifying the kernel configuration as needed, you must build the kernel. I found the compile-your-own-kernel FAQ to be useful here. I'll summarize the steps:

config DIRT #and fix any errors it spits out
cd ../compile/DIRT/
make depend
make clean #this step caused 'make' to fail for me...
make

Now, your new kernel should be in the current directory. Copy it over to /usr/dirt/dist/kernel.dirt_<BSD version>, but be sure you don't overwrite a previous kernel! (Hint: use cp -i)

Create Installation Scripts

In a DiRT installation, there are several DiRT-specific scripts in /usr/dirt/bin/ which must be run after the installation of BSD. Most of these scripts are version-specific. Now, let's create the scripts we'll need for our new version of BSD. We'll need to do these steps on a production DiRT machine that's plugged in to the network.

Get the Packages

This step could get complicated, but thankfully we have the precedent of previous versions to build on. cd to /usr/dirt/dist/ and examine the contents of a pkgs_* that is similar to your needs (e.g. X or no_X, etc.). Now, get all these packages (and any other ones that you think should be a part of the distribution for your version). Like finding the ISO, this will hopefully be easy, but if you have a hard time finding packages, see the notes on downloading the ISO above. Download the packages to a new directory /usr/dirt/packages_<BSD version>/All/. Then create a /usr/dirt/dist/pkgs_* file for your packages.

Unless you are very careful, some packages will probably fail to install because of failed dependencies. After running the add_pkgs_dirt script, check the contents of /tmp/add_pkgs_dirt to see which packages failed and why. Even if you have all the dependencies, you might have their order wrong. Note that pkg_info will list the packages installed on a system, and pkg_info -r <package_file> will give the dependencies for that particular package. In any event, you might have to go through several cycles of wiping the packages off (using pkg_delete -a), getting new packages and modifying the package list, and running add_pkgs_dirt.

Post-Install

Boot your original machine back up, and this time plug in a network cable. Now, all we need to do is run the regular DiRT post-installation scripts that we just created for our new version. Here's a summary, assuming your new BSD version is 5.1:

Final Notes

After running the install_kernel_* script, your new machine will reboot. After it boots back up, check to make sure everything is OK, like the kernel being correct. If it isn't, you might need to modify some of the scripts you made. If it is, you should be ready to repeat the installation and post-installation on any other machines you need!


Jeff Terrell
Last modified: Fri Apr 8 16:20:55 EDT 2005