FreeBSD, Soekris, and GPS/NTP


This is partly a continuation of the Raspberry Pi article, and partly a pivot. Finding a GPS that supports PPS capability and connects via USB is not always easy. They make hats for RPi, but they frequently don’t support PPS either. Finding one that supports the Soekris took about 10m. Part of the advantage (to me) with the Soekris is that it already has a case with room in it so I don’t have anything sticking out.

The Soekris I chose (4801) is an old(er) model. Partly because I had one (I actually ended up building 2 of these units, total cost ~$200US), but partly because doing things like Time, DNS, DHCP, don’t need a lot of resources, and consuming less power means less heat.

Parts list

Part Cost
Soekris NET4801, used, with case $50
Motorola Oncore VP/UT+ $17
MCX <-> Female SMA bulkhead pigtail $11
5v GPS Antenna $15
4-8G CF Card $14
Set of 0.1" header jumpers $3
PCB standoffs and screws $15
Total $123

Prices are for a combination of eBay and Amazon when the article was written.

I’m assuming you already have a CF<->USB adapter.


First order of business, have a FreeBSD box that you can do your compiling and installing on. This could be physical or virtual. Crochet can take advantage of multiple CPUs, so if you expect to be building a lot of images, you may want to ensure you have multiple CPUs.

You can find crochet on github. Once you clone it to your working directory, you need to createa config file. You can copy the sample and work from there. Mine looks like this (try not to guess my password):

board_setup Soekris
option ImageSize 1900mb # for 2 Gigabyte card
option Growfs
customize_freebsd_partition ( ) {
        util_add_passwd 'louisk:louisk:1001:1001::0:0:Louis Kowolowski:/usr/home/louisk:/bin/tcsh'
        util_add_user_group louisk wheel

        printf "fdesc\t/dev/fd\tfdescfs\trw\t0\t0\n" >> etc/fstab

        sed -i -e 's/#\*\.\*.*\@loghost/\*\.\* \@log\.cmhome/' etc/syslog.conf

        sed -i -e 's/#ChallengeResponseAuthentication\ yes/ChallengeResponseAuthentication\ no/' etc/ssh/sshd_config
        sed -i -e 's/^console.*/console\ \"\/usr\/libexec\/getty\ Pc\"\ vt100\ on\ secure/' etc/ssh/sshd_config

        sysrc -f etc/rc.conf pflog_enable=YES
        sysrc -f etc/rc.conf pf_enable=YES
        sysrc -f etc/rc.conf sshd_enable=YES
        sysrc -f etc/rc.conf cron_enable=YES
        sysrc -f etc/rc.conf clear_tmp_enable=YES
        sysrc -f etc/rc.conf syslogd_enable=YES
        sysrc -f etc/rc.conf ntpd_enable=YES
        sysrc -f etc/rc.conf ntpd_sync_on_start=YES
        sysrc -f etc/rc.conf ifconfig_sis0=DHCP
        sysrc -f etc/rc.conf dumpdev=NO
        sysrc -f etc/rc.conf -x sendmail_submit_enable
        sysrc -f etc/rc.conf -x sendmail_outbound_enable
        sysrc -f etc/rc.conf -x sendmail_msp_queue_enable

        echo "hint.acpi.0.disabled=\"1\"" >> boot/device.hints

        echo "hw.ata.ata_dma=0" >> boot/loader.conf
        echo "console=\"comconsole\"" >> boot/loader.conf
        echo "dtraceall_enable=\"YES\"" >> boot/loader.conf

        printf "link\tcuau1\toncore.serial.0" >> etc/devfs.conf
        printf "link\tcuau1\toncore.pps.0" >> etc/devfs.conf

        echo "-h"  >> boot.conf

The only things particluarly noteworthy are:

  • KERNCONF: I’ve created a custom kernel that includes the PPS support and defined it here
  • I’ve manually added a user so I can specify the uid/gid, because I have some files that will get placed into the users home directory and need to be owned, grouped properly.

The kernel config looks like this:

# SOEKRIS -- Generic Kernel configuration file for FreeBSD/i386 on SOEKRIS

include GENERIC


# To Make a SOEKRIS Kernel, the next options are needed
options  CPU_SOEKRIS
options  CPU_ELAN
options  CPU_ELAN_PPS
options  CPU_ELAN_XTAL=32768000
options  CPU_GEODE

# Include TMPFS
options  TMPFS

options  PPS
options  PPS_SYNC

You can read about overlay files in the sample config. Its not complicated.

Building the Image

Now you can do a

sudo ./ -c <config-file>

Logs are hiding in the .work directory, and the image will be placed there as well.

Write to disk

You’ll have to figure out what device you want to write to, but the command will look something like this:

sudo dd if=FreeBSD-i386-11-SOEKRIS-PPS.img of=/dev/da0 bs=512