DMRHost on a RaspberryPi 4 with OpenBSD or FreeBSD
Table of Contents
OpenBSD #
Get the files #
Download install73.img
from https://www.openbsd.org/arm64.html and
write it to a USB stick.
Installation of OpenBSD #
Get yourself comfortable with this nice piece of documentation: INSTALL.arm64
Connect a USB-to-TTL cable to the GPIO pins of the serial console on your Raspberry Pi (That means you have to remove the MMDVM hat for now).
$ cu -l /dev/cuaU0 -s 115200
To save you another manpage lookup, exit the serial console with Enter, ~..
Boot the Raspberry Pi with no SD-Card plugged in but the USB stick.
Stop the autoboot process at the bootloader by typing something at the boot prompt (and delete the typed characters afterwards)
Plugin the SD-Card and hit Enter
The Installation media starts and detects your SD-Card
Continue with the installation of OpenBSD
We booted without SD-Card because I had problems selecting the USB media for booting. You can select this from within Raspbian OS but I did not want to install this in the first place.
System configuration #
Make sure to enable ssh. We will need that because we have to drop support for the serial console to use the MMDVM hat.
Disable the use of the serial console #
Modify /etc/ttys
(only the first lines are relevant)
1#
2# $OpenBSD: ttys,v 1.2 2020/03/13 13:14:40 patrick Exp $
3#
4# name getty type status comments
5#
6console "/usr/libexec/getty std.115200" vt220 off secure
7ttyC0 "/usr/libexec/getty std.9600" vt220 off secure
8ttyC1 "/usr/libexec/getty std.9600" vt220 on secure
9ttyC2 "/usr/libexec/getty std.9600" vt220 on secure
Change on to off. Now select the framebuffer device for your tty.
$ echo "set tty fb0" | doas tee /etc/boot.conf
Once you made sure that you can login via ssh, turn off the Raspberry Pi and put on the MMDVM hat.
Now you should be able to select /dev/cua00
as the modem
in your MMDVM.ini
.
Setup DMRHost #
Installation #
Get the files: https://github.com/BrandMeister/DMRHost.
I prefer to use a separate user for this.
$ doas useradd -L daemon -G dialer,users -m -d /home/mmdvm -s /sbin/nologin -c "Radio &" mmdvm
Now, let’s create the DMRHost executable.
$ cd /home/mmdvm
$ doas -u mmdvm (mkdir git && cd git)
$ doas -u mmdvm (git clone https://github.com/BrandMeister/DMRHost && cd DMRHost)
$ doas -u mmdvm (mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..)
$ doas -u mmdvm make && doas make install
Note: the last command is not executed as the user mmdvm
but as root as it is installing the executable into /usr/local/bin
.
Therefore we dropped the -u mmdvm
on the last doas
invocation!
Configuration of DMRHost: MMDVM.ini
#
I use /home/mmdvm/MMDVM.ini
because I’ll put everything MMDVM-related
into /home/mmdvm
.
The essential congiguration changes:
[...]
[Log]
# Logging levels, 0=No logging, 1=Debug, 2=Message, 3=Info, 4=Warning, 5=Error, 6=Fatal
SyslogLevel=0
DisplayLevel=0
FileLevel=2
FilePath=/home/mmdvm/logs
FileRoot=DMRHost
FileRotate=0
[...]
[Modem]
Port=/dev/cua00
Protocol=uart
[...]
This is basically the same configuration as in the repository.
Have a look at the [Log]
section.
The rc script /etc/rc.d/DMRHost
. #
#!/bin/sh
# rc-script for DMRHost on OpenBSD 7.3
# Dominic Reich <https://oe7drt.com>
DMRHOST="/usr/local/bin/DMRHost"
MMDVM_INI="/home/mmdvm/MMDVM.ini"
DMRHOST_PID="/home/mmdvm/DMRHost.pid"
DOAS="/usr/bin/doas -u mmdvm"
LOGDIR="/home/mmdvm/logs"
case "$1" in
"start")
if [ ! -d ${LOGDIR} ] ; then
mkdir ${LOGDIR}
chown mmdvm:users ${LOGDIR}
chmod 0775 ${LOGDIR}
fi
if ${DOAS} [ ! -r ${MMDVM_INI} ] ; then
echo "${MMDVM_INI} is not readable... aborting!"
exit 1
fi
echo -n "Starting DMRHost..."
${DOAS} ${DMRHOST} ${MMDVM_INI} &
echo $! > ${DMRHOST_PID}
echo " done"
;;
"stop")
echo -n "Stopping DMRHost..."
if [ -f ${DMRHOST_PID} ] ; then
kill `cat ${DMRHOST_PID}`
rm -f ${DMRHOST_PID}
echo " done"
else
echo "not running?"
fi
;;
"restart")
$0 stop
sleep 2
$0 start
;;
*)
echo "$0 [start|stop|restart]"
;;
esac
First test / first start #
Start DMRHost (not the service)
$ doas -u mmdvm /usr/local/bin/DMRHost /home/mmdvm/MMDVM.ini
and see what it does. If it’s logging into the master, all is good and can be stopped with CTRL+C.
Enable and start the service #
$ doas rcctl enable DMRHost
$ doas rcctl start DMRHost
DMRHost runs.
Some additional notes #
I put myself (another user on the Raspberry Pi) into
the users group and chmod the MMDVM.ini
with with 664.
That allows me to edit the file as my usual user and I do
not have to use doas -u mmdvm
everytime I want to
modify something in that file.
FreeBSD #
I’m using 14.0-CURRENT for this (which is moving to stable soon).
https://download.freebsd.org/ftp/snapshots/arm64/aarch64/ISO-IMAGES/14.0/
$ doas dd if=FreeBSD-14.0-ALPHA3-arm64-aarch64-RPI-20230825-2af9390e54ed-265022.img of=/dev/rsd2c bs=1m
Boot into the system with the serial console. Setup a dedicated user for this and disable the serial console after you successfully set up the network (don’t forget to also test ssh connection).
$ doas pw useradd mmdvm -d /home/mmdvm -m -L daemon -G dialer
Do not use the UART for kernel messages.
Add this line to your /boot/loader.conf
file.
hw.fdt.console="NO"
Reboot so the serial console can be used for the MMDVM_HS hat.
Install DMRHost #
You will need a few packages before we can continue. This list could be incomplete because I try to remember them from brain memory…
$ doas pkg install git gcc cmake
Goto /home/mmdvm
, build and install DMRHost.
$ doas -u mmdvm mkdir ~/git && cd /home/mmdvm/git
$ doas -u mmdvm git clone https://github.com/BrandMeister/DMRHost.git
$ cd DMRHost && doas -u mmdvm mkdir build && cd build
$ doas -u mmdvm (cmake -DCMAKE_BUILD_TYPE=Release .. && make)
$ doas make install
Create directories and the MMDVM.ini
file.
$ cd /home/mmdvm && doas -u mmdvm mkdir logs && chmod 0775 logs
$ doas -u mmdvm nvim MMDVM.ini
[...]
[Log]
# Logging levels, 0=No logging, 1=Debug, 2=Message, 3=Info, 4=Warning, 5=Error, 6=Fatal
SyslogLevel=0
DisplayLevel=0
FileLevel=2
FilePath=/home/mmdvm/logs
FileRoot=DMRHost
FileRotate=0
[...]
[Modem]
Port=/dev/cua00
Protocol=uart
[...]
I also add my user to the mmdvm group, so I can edit the MMDVM file. (Well, set file permissions to 0664)
$ doas pw usermod <user> -G mmdvm
Test DMRHost #
$ doas -u mmdvm /usr/local/bin/DMRHost /home/mmdvm/MMDVM.ini
You may inspect the logfile beforehand: tail -f /home/mmdvm/logs/DMRHost.log
.
The startup of DMRHost should end with something like these lines:
M: 2023-08-25 11:03:05.000 DMRHost-20220617-DMRHost is running
M: 2023-08-25 11:03:15.000 DMR, Logged into the master successfully
Setup an rc file #
#!/bin/sh
# rc-script for DMRHost on OpenBSD 7.3
# runs on FreeBSD for now
# Dominic Reich <https://oe7drt.com>
DMRHOST="/usr/local/bin/DMRHost"
MMDVM_INI="/home/mmdvm/MMDVM.ini"
DMRHOST_PID="/home/mmdvm/DMRHost.pid"
DOAS="/usr/local/bin/doas -u mmdvm"
LOGDIR="/home/mmdvm/logs"
case "$1" in
"start")
if [ ! -d ${LOGDIR} ] ; then
mkdir ${LOGDIR}
chown mmdvm:users ${LOGDIR}
chmod 0775 ${LOGDIR}
fi
if ${DOAS} [ ! -r ${MMDVM_INI} ] ; then
echo "${MMDVM_INI} is not readable... aborting!"
exit 1
fi
echo -n "Starting DMRHost..."
${DOAS} ${DMRHOST} ${MMDVM_INI} &
echo $! | ${DOAS} tee ${DMRHOST_PID} > /dev/null
echo " done"
;;
"stop")
echo -n "Stopping DMRHost..."
if [ -f ${DMRHOST_PID} ] ; then
kill `cat ${DMRHOST_PID}`
rm -f ${DMRHOST_PID}
echo " done"
else
echo "not running?"
fi
;;
"restart")
$0 stop
sleep 2
$0 start
;;
*)
echo "$0 [start|stop|restart]"
;;
esac