The objective is to get a FreeBSD-like enviorment running on
a CF-card with no extras. NanoBSD does this perfectly and
actually NanoBSD is a stripped and custom configured FreeBSD
compiled from the FreeBSD source tree. It is very easy to
customize, there is only one shellscript ( that does
the trick.

The reason why I want to run NanoBSD is because I’m working
on a FreeBSD router project. which should be based on a
Mini-ITX machine, a CF-card and FreeBSD.

By default a NanoBSD image consists of three partitions. code#1,
code#2 and /cfg. There are two image partitions so you can
easily install upgrades on the fly even though the running
system is mounted read-only. The /cfg partition is used for
/etc/ configurations that differ from the default one. This
partition should only be mounted at boot-time and when you
want to save a configuration, since /etc and are a memory disk.

The most straight forward way to build NanoBSD is to run the
shellscript with no options at all. (This assumes that you have
FreeBSD and its source tree)

# cd /usr/src/tools/tools/nanobsd
# sh
# cd /usr/obj/nanobsd.full
# dd if=_.disk.full of=/dev/da0 bs=64k

You can also use a configuration to strip down the size of the
operating system and also install packages and so on. Here is
my configuration (which is a costomised version of phk’s config)

This is basicly what I’ve done.
# cd /usr/src/tools/tools/nanobsd
# sh -c uchman.conf
# cd /usr/obj/nanobsd.uchman
# dd if=_.disk.full of=/dev/ad4 bs=64k

If you want a more precise explanation of what I’ve done and
for what reason you can visit my FreeBSD router project

Upgrade your NanoBSD is very simple. It’s really the same
procedure as before. The only difference is that instead of using
_.disk.full you should use _.disk.image this image contains the
system for only one partition. To install it you can use two scrips
that are to be found in /root/, update1 and update2. When you are
running on code#1 you should use update2 and so on. Quite
logical. (the scripts will warn you if you pick the wrong one) The
scripts install the new system and then changes the boot record
to boot on the upgraded partition.

# grep usage /root/update1
# usage: ssh somewhere cat image.s1 | sh updatep1

The first problem for me was to find some information on how
to make a custom build of NanoBSD after some search I found
a documentation on phk’s “other” website

When I finally had a custom build I ran in to another problem,
the machine didn’t seem to boot from the CF-card. I rebuild and
reinstalled the image several times until I realized that it was
actually booting, the problem was cust_comconsole. It did not only
enable com console it disabled all the other terminals too, I
fixed my /etc/ttys and my custom NanoBSD was up and running.