1. NET4501 installation
  2. Modifying the flash after boot
  3. Creating a virtual disk image with flashdist
  4. Installing NSH

NET4501 Installation

(Read thoroughly!!):
  1. On the boot-up of the Soekris (with the flash plugged in), you will see a display similar to this:
    0064 Mbyte Memory                           CPU 80486 133 MHz
    Pri Mas  ATA_FLASH                          LBA 489-4-32   31 Mbyte
    

    In the sample above, 489-4-32 represents the Cylinders-TracksPerCyl(Heads)-SectorsPerTrack, the C-H-S values

    Connect your serial console to the Soekris box (19200 baud). Plug in the flash card to your Soekris box, turn it on, and note the C-H-S values in your serial console session. Write them down. Flashdist will ask you for them when you run it.

    (If your Soekris box does _not_ display these values, use the instructions at the Soekris web site to upgrade to the 1.15 or newer BIOS)

  2. As root (to preserve permissions and ownership), unpack base4X.tgz, etc4X.tgz and man4X.tgz into a directory, say, /tmp/openbsd

    (Be sure to use root permissions and the p option with tar or else files will not be extracted with the correct permissions and your installation [at least sshd and login] will not work properly!)

    (alternately, if you run flashdist from OpenBSD/i386 and you want to skip this step, you can specify / rather than /tmp/openbsd as argument 4 to install flash32mb.txt content from your current OS image. This saves you time, but it copies the current state of /etc, including master.passwd and other configuration files, so you will have to edit those.)

    mkdir /tmp/openbsd
    cd /tmp/openbsd
    tar xzpf /path/to/base42.tgz
    tar xzpf /path/to/etc42.tgz
    tar xzpf /path/to/man42.tgz
     
  3. Compile the NET4501 kernel
    cp /path/to/NET4501 /usr/src/sys/arch/i386/conf/NET4501
    cd /usr/src/sys/arch/i386/conf
    config NET4501
    cd ../compile/NET4501
    make
     
    Of course, whatever kernel you compile should be built the same source as that of the userland you install. Or, if you are using a snapshot to install from, at least try to build a kernel using sources from a close date to that of the snapshot build.

  4. Edit the rc file from flashdist directory to suit your tastes. (You should at least change the IP addresses, default route, hostname, etc...)
    tar xvf flashdist.tar
    cd flashdist
    vi rc
    
  5. Use flashdist.sh to install onto your CF media (assuming here that you are using a USB-CF adapter with flash at sd2). Be sure to run flashdist.sh from the flashdist directory so flashdist.sh can access other files from its archive.
    ./flashdist.sh sd2 flash32mb.txt /usr/src/sys/arch/i386/compile/NET4501/bsd /tmp/openbsd
     
    Or, if you want to source everything (/etc, /usr) from your workstation. (I use this option in a time pinch, but you have to be careful about what is in /etc on your source machine.)
    ./flashdist.sh sd2 flash32mb.txt /bsd /
    

  6. Edit /etc/rc and configure your network parameters (interface IPs, default routes, etc). Turn on ntpd if you want to use it (recommended). Turn on dhcpd if you want it. Edit ntpd.conf, dhcpd.conf, pf.conf, etc. If you are are using nsh, you should configure routes and interfaces directly into nshrc or through the nsh CLI.)

    That should get you a bootable CF media for your net4501. If you have problems booting, you need to follow the instructions at the top of the script to get the right geometry.

Modifying the flash after boot

While you are logged into the net4501's serial console, you can use vi and other curses applications by setting your terminal type, such as:
export TERM=vt220
For all use, if you want to make changes to the read-only media while logged in, do this:
rw

Make your changes, and then mount it read-only again:

ro

Creating a virtual disk image with flashdist

If you want to use flashdist to create a disk image, rather than work on an actual flash disk, use vnconfig(8). This method will only work if you manually specify the geometry to flashdist. First, you need to create an image of the correct size for your flash cards:
dd if=/dev/zero of=flashimg bs=512 count=125440
Where bs, the blocksize, is equal to the bytes per sector used on the flash media (almost always 512), and count as the total number of sectors. In this example, the total number of sectors is 125440, but of course this differs with each type of flash card or hard disk. It is calculated as C*H*S, where C is Cylinders, H is Heads (tracks per cylinder), and S is Sectors per track.

Once you have the image file, you need to make it look like a regular disk.

vnconfig -c svnd0 flashimg
Now you can use the svnd0 device with flashdist, instead of sd0 or another actual disk on the system. When you are done installing to the the flash image, you need to unconfigure it from the kernel before you use it.
vnconfig -u svnd0
Now the file 'flashimg' is your disk image and it is ready to be written to flash.
dd if=flashimg of=/dev/sd0c

Installing NSH

NSH can be installed very easily. Simply unpack nsh under the flashdist directory.
cd flashdist-XXXXXXXX
tar xvf ~/nsh-XXXXXXX.tar
At this point, build NSH.
cd nsh
make
With NSH built, flashdist will automatically install it on subsequent runs.