PCEngines APU1C4: nanobsd notes

Unfortunately there’s not much too this “guide” really, it’s just a handful of notes I made during the process of getting it to work. The biggest trouble I had was nanobsd assuming the wrong NANO_DRIVE which resulted in a very cryptic error message about the usb device not being ready, and it took me far longer than it probably ought to have to realize that it was pointed at ada0 instead of da0. :(

Kernel configuration

Here’s the kernel I used:

# cat /usr/src/sys/i386/conf/TIM3R
include GENERIC
ident TIM3R

device umodem
device ucom

options PPS_SYNC

I probably could have used amd64 instead of i386, but fuck it, this machine will do very little. There’s not much too this except enabling USB modems, and kernel-mode PPS code, everything else is basically GENERIC.

NanoBSD Configuration

# cat myconf.nano
NANO_NAME=TIM3R
NANO_KERNEL=TIM3R

NANO_CONFSIZE=40960
NANO_RAM_ETCSIZE=40960
NANO_DRIVE=da0
#NANO_BOOTLOADER=boot/boot0
#NANO_BOOT0CFG="-o nopacket -s 1 -m 3"

CONF_WORLD='
WITHOUT_ACCT=yes
WITHOUT_AUDIT=yes
WITHOUT_EXAMPLES=yes
WITHOUT_FLOPPY=yes
WITHOUT_GAMES=yes
WITHOUT_NDIS=yes
WITHOUT_IPX=yes
WITHOUT_QUOTAS=yes
BOOT_PXELDR_ALWAYS_SERIAL=1
BOOT_PXELDR_PROBE_KEYBOARD=1
BOOT_COMCONSOLE_SPEED=115200
'

cust_boot_cfg () (
  cd ${NANO_WORLDDIR}

  # Serial console on boot loader.
  echo "-S115200 -h" > boot.config

  # Serial console, and GPS serial ports in kernel
  echo "console=\"comconsole\"" > boot/loader.conf
  echo "comconsole_speed=\"115200\"" >> boot/loader.conf
  echo "kern.cam.boot_delay=10000" >> boot/loader.conf
  echo "hw.uart.pps_mode=\"0\""  >> boot/loader.conf
  echo "dev.uart.2.pps_mode=\"2\"" >> boot/loader.conf

  # serial port 3 for GPS
  echo "hint.uart.2.at="isa"" >> boot/device.hints
  echo "hint.uart.2.port="0x3E8"" >> boot/device.hints
  echo "hint.uart.2.irq=\"4\"" >> boot/device.hints

)
customize_cmd cust_boot_cfg

customize_cmd cust_comconsole
customize_cmd cust_allow_ssh_root

FlashDevice generic 4g

Per the usual method, nanobsd is created using sh nanobsd.sh -n -c myconf.nano.

There’s a few things to note here: My APU is set to 115200 baud for serial console, so FreeBSD should do same. I turn off kernel-mode PPS for everything, but turn it back on for uart2 (COM3) where the PPS wire is jumpered across to. uart2 needs hints in /boot/device.hints, so add those.

The contents of /cfg (or /etc)

After the first run, I edit a few things like rc.conf, ntp.conf, set up a password (not sure how to replace it with key auth yet), and copy all the changed files back over to /cfg, then unmount it for safety. Here’s a list of the changed files:

devfs.conf
group
master.passwd
ntp.conf
passwd
pwd.db
rc.conf
spwd.db
ssh/
ssh/moduli
ssh/ssh_config
ssh/ssh_host_ecdsa_key
ssh/ssh_host_ecdsa_key.pub
ssh/ssh_host_ed25519_key
ssh/ssh_host_ed25519_key.pub
ssh/ssh_host_rsa_key
ssh/ssh_host_rsa_key.pub
ssh/sshd_config

/etc/devfs.conf

devfs.conf is stock except these lines added to the bottom:

link cuaU0 gps0
link cuau2 gpspps0
own cuaU0 ntpd
own cuau2 ntpd

NMEA is taken from the USB serial interface of the GPS, but the PPS signal is taken from COM3. NTPd needs ownership of both these ports to access it.

Saving user changes

To save user changes you must copy /etc/passwd, /etc/group, /etc/master.passwd, and the bdb databases at /etc/pwd.db and /etc/spwd.db. Once all those files are in /cfg the changes you made to them will persist across reboots.

fwaggle

Published:


Modified: