Skip to content

Instantly share code, notes, and snippets.

@jpouellet
Last active June 18, 2018 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpouellet/bee8bc7a035845fb6e694de514e9150a to your computer and use it in GitHub Desktop.
Save jpouellet/bee8bc7a035845fb6e694de514e9150a to your computer and use it in GitHub Desktop.
OpenBSD kernel testing automation

This assumes you have:

  • a development machine, here called "dev"
  • a device under test, here called "dut"
  • a serial console to dut
  • network access from dut to dev
  • the same arch dev and dut

You may need to change:

  • GENERIC (in dev:.ssh/authorized_keys) to something else, e.g. maybe GENERIC.MP

The dut will boot your development kernel in single-user mode.

You can break to ddb with ddb.

You can run kernel-update to:

  • (re)mount the appropriate file systems
  • ssh to the dev machine and fetch the new kernel (which is forced server-side)
  • reboot into it
restrict,command="curl -o- file:///usr/src/sys/arch/amd64/compile/GENERIC/obj/bsd" ssh-ed25519 AAAA... root@dut
stty com0 115200
set tty com0
/bsd.dev -s
Host dev
HostName ...
User ...
#!/bin/sh
sysctl ddb.console=1
sysctl ddb.trigger=1
#!/bin/sh
set -e
set -x
# mount /usr for ssh
command -v ssh > /dev/null || mount -r /usr
# bring up network
sh /etc/netstart
# rw / so we can write the new kernel
mount -o rw /
# fetch new kernel, don't try to allocate TTY
ssh -T dev > /bsd.dev.incoming
# put in place atomically
ln -f /bsd.dev.incoming /bsd.dev
rm /bsd.dev.incoming
# reboot into it
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment