FreeBSD, Soekris, and GPS/NTP

Overview

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.

Crochet

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):

 1board_setup Soekris
 2option ImageSize 1900mb # for 2 Gigabyte card
 3option Growfs
 4KERNCONF=SOEKRIS-PPS
 5FREEBSD_SRC=/usr/src
 6customize_freebsd_partition ( ) {
 7        util_add_passwd 'louisk:louisk:1001:1001::0:0:Louis Kowolowski:/usr/home/louisk:/bin/tcsh'
 8        util_add_user_group louisk wheel
 9
10        printf "fdesc\t/dev/fd\tfdescfs\trw\t0\t0\n" >> etc/fstab
11
12        sed -i -e 's/#\*\.\*.*\@loghost/\*\.\* \@log\.cmhome/' etc/syslog.conf
13
14        sed -i -e 's/#ChallengeResponseAuthentication\ yes/ChallengeResponseAuthentication\ no/' etc/ssh/sshd_config
15        sed -i -e 's/^console.*/console\ \"\/usr\/libexec\/getty\ Pc\"\ vt100\ on\ secure/' etc/ssh/sshd_config
16
17        sysrc -f etc/rc.conf pflog_enable=YES
18        sysrc -f etc/rc.conf pf_enable=YES
19        sysrc -f etc/rc.conf sshd_enable=YES
20        sysrc -f etc/rc.conf cron_enable=YES
21        sysrc -f etc/rc.conf clear_tmp_enable=YES
22        sysrc -f etc/rc.conf syslogd_enable=YES
23        sysrc -f etc/rc.conf ntpd_enable=YES
24        sysrc -f etc/rc.conf ntpd_sync_on_start=YES
25        sysrc -f etc/rc.conf ifconfig_sis0=DHCP
26        sysrc -f etc/rc.conf dumpdev=NO
27        sysrc -f etc/rc.conf -x sendmail_submit_enable
28        sysrc -f etc/rc.conf -x sendmail_outbound_enable
29        sysrc -f etc/rc.conf -x sendmail_msp_queue_enable
30
31        echo "hint.acpi.0.disabled=\"1\"" >> boot/device.hints
32
33        echo "hw.ata.ata_dma=0" >> boot/loader.conf
34        echo "console=\"comconsole\"" >> boot/loader.conf
35        echo "dtraceall_enable=\"YES\"" >> boot/loader.conf
36
37        printf "link\tcuau1\toncore.serial.0" >> etc/devfs.conf
38        printf "link\tcuau1\toncore.pps.0" >> etc/devfs.conf
39
40        echo "-h"  >> boot.conf
41}

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:

 1# SOEKRIS -- Generic Kernel configuration file for FreeBSD/i386 on SOEKRIS
 2#
 3# $FREEBSD
 4
 5include GENERIC
 6
 7ident SOEKRIS-PPS
 8
 9# To Make a SOEKRIS Kernel, the next options are needed
10options  CPU_SOEKRIS
11options  CPU_ELAN
12options  CPU_ELAN_PPS
13options  CPU_ELAN_XTAL=32768000
14options  CPU_GEODE
15
16# Include TMPFS
17options  TMPFS
18
19options  PPS
20options  PPS_SYNC

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

Building the Image

Now you can do a

1sudo ./crochet.sh -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:

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

Copyright

Comments