Install OpenBSD on Soekris net4801

From Docupedia

 Soekris net4801

Contents

Background

So a while ago one of the alkaloid fellow's User:bklang stumbled upon the http://www.soekris.com hardware line. Its a really cool line of embedded hardware that allows you to run all different types of systems. The thing that caught his eye were the fact that it support openbsd (good for firewalling) and they also now sell one bundled with a Sangoma A101u ISDN Pri card. This is really exciting because all our locations are now going to contain pri's. Whoot Whoot. The soekris net4801 is a compact, low-power, low-cost, advanced communication computer, based on a 266 Mhz 586 class Geode single chip processor. It has three 10/100 Mbit Ethernet ports, up to 256 Mbyte SDRAM main memory and uses a CompactFlash module or a 2.5" hard drive for program and data storage. It also is available is two upgraded models one the net4801 + lan1641 QFE (this gives you 7 nics in a 10"x6"x1" form factor with no moving parts! ZING!) or the net4801 + sangoma a101u (which is 3 nics and 1 PRI port in the same form factor).

What you'll need

You have a couple choice here so what you will need will depend on those. You basically have two options. Put in place a full tftp + dhcpd + pxe environment for network installation or making pre-bundled images that you use a compact flash reader to write directly to a CF flash card. Or just a normal 2.5" ide hd (I haven't done this yet I've stuck to CF hard-disks).

All the pieces

So you've now got a soekris net4801 + lan1641, null modem cable, gender changer, reference openbsd system, a heck of a lot of time, and a patient wife. All these are very important factors in accomplishing this mission.

Ready to roll

To enable use to roll our own openbsd images we are going to make usage of the flashdist work being done by Chris. Kudo's to him for his work it made my life much easier. What I'm attempting to do here is improve upon that by making it easier for the average joe get all the pieces in place to allow for him to use flashdist and have it all work. It's only a one liner once you get everything in place but its all important pieces.

Some of the stuff your going to need to get a hold of (In our example X.X is really 4.2):

  1. OpenBSD X.X Install ISO - This can be made by following Ben Klang's howto found here
  2. OpenBSD X.X Reference System - This is a barebones pc sacrificed for the good of our embedded project. If your stuck on this one have a look at the work Bryan Rite did a while back showing us how to install an openbsd firewall.
  3. http://www.nmedia.net/flashdist/ - This allows us to make our image and write it to the flash media directly using a CF reader.
  4. Kernel Sources and Sys Tarball - For the reference system to build a kernel specific to the NET4801 we are going to need the kernel source et all for the reference system. I found a really good reference http://www.openbsd101.com/patching.html. It even gives useful links like these:

On the reference system cd /usr/src/ and then

#>ftp ftp://ftp.openbsd.org/pub/OpenBSD/4.2/src.tar.gz (102mb's)
#>ftp ftp://ftp.openbsd.org/pub/OpenBSD/4.2/sys.tar.gz (17mb's)
#>tar zxvf src.tar.gz
#>tar zxvf sys.tar.gz

Shiny new img

For building my images I setup the following structure in the /root directory on the reference server. To build new images you will also require the base, etc, and man tgz's for the distro version your working on. This step assumes you've gotten the tgz's from somewhere. You could try from the cdrom you installed from under 4.2/i386 and copy them to /tmp


# mkdir /root/base42 /root/4.2
# cd /root/base42
# cp /tmp/base42.tgz .
# cp /tmp/etc42.tgz .
# cp /tmp/man42.tgz .
# tar xzpf base42.tgz
# tar xzpf etc42.tgz
# tar xzpf man42.tgz
# mv *.tgz ../4.2
# ls -la 
total 8364
drwx------   7 root  wheel      512 Nov 25 00:05 .
drwxr-xr-x  14 root  wheel      512 Nov 24 17:07 ..
drwxr-xr-x  14 root  wheel      512 Nov 24 17:24 4.2
drwxr-xr-x  14 root  wheel      512 Nov 24 17:24 base42
drwxr-xr-x   2 root  wheel      512 Nov 24 17:24 flashdist-20071105

In my structure the 4.2 folder holds the reference tgz's the base42 holds the extracted version of obsd were going to make the image from and the rest of the goodies are inside the flashdist directory. Some stuff to notice inside the flashdist directory that were going to need to use or modify are the following files:

#This is the kernel config file.  We will need that to build our super small kernel specific to the soekris hardware.
-rw-r--r--  1 root  wheel     6244 Nov  2 01:28 NET4801
#This is the kernel image that I have already compiled using the above config and the kernel sources from openbsd.
-rwxr-xr-x  1 root  wheel  1952944 Nov 24 15:21 bsd
#Finally the rc file is the main configuration for flashdist.  This is where you set your ip and hostname etc. for the new system.
-rw-r--r--  1 root  wheel     4064 Nov 24 17:17 rc

Those are the main pieces of the flashdist. Once you have everything in place and your ready to get started.

# pwd
/root/flashdist-20071105
# ./flashdist.sh sd0 flashsmall.txt bsd /root/base42

The script parameters are broken down to the label of your cf media, the text file containing all distribution files, the bsd kernel file and then the reference to the base system to copy from. Keep in mind that if you want something custom to be on your new system nows the time to do it. All your changes and additions need to be done to the base42 directory in the structure.

Playing around with it

One of the first things to realize is that when the system boots its doing it read only. This is to save the compact flash card. If you want to make some changes to the system you have to take it out of read-only mode. This could be accomplished a number of ways. On my systems I've choosen to make two small shell scripts. Both live in /usr/bin on the systems and I call them roofs-rw and rootfs-r.

/usr/bin/rootfs-rw

#Quick and dirty way to get filesystem outta read-only mode
echo "Making filesystem writeable";
mount -o rw,noatime /dev/wd0a /
echo "Done...";

/usr/bin/rootfs-r

#Quick and dirty way to get filesystem into read-only mode
echo "Making filesystem read-only again";
mount -o ro /dev/wd0a /
echo "Done...";

That should help you when you go to edit and change stuff on the system. You can now just call it like so:

# rootfs-rw
Making filesystem writeable
Done...

Make your system changes and then make it read-only again

# rootfs-r
Making filesystem read-only again
Done...

Supporting Cast

http://www.openbsd101.com/patching.html

http://www.nmedia.net/flashdist/

http://256.com/gray/docs/soekris_openbsd_diskless/

http://www.gcfn.net/wyang/pubs/flashdist-wrapper

http://www.csgnetwork.com/mediasizecalc.html

http://soekris.com/how_to_buy.htm

http://docs.alkaloid.net/index.php/Setting_up_an_OpenBSD_Firewall

http://docs.alkaloid.net/index.php/Creating_a_bootable_OpenBSD_ISO

http://www.google.ca