|
|
@ -3,21 +3,220 @@
|
|
|
|
title = 'DMRHost on OpenBSD on a Raspberry-Pi 4'
|
|
|
|
title = 'DMRHost on OpenBSD on a Raspberry-Pi 4'
|
|
|
|
summary = ''
|
|
|
|
summary = ''
|
|
|
|
date = '2023-08-20T08:24:04+02:00'
|
|
|
|
date = '2023-08-20T08:24:04+02:00'
|
|
|
|
lastmod = '2023-08-20T08:13:37+0000'
|
|
|
|
lastmod = '2023-08-20T09:15:14+0000'
|
|
|
|
categories = [ 'amateur-radio' ]
|
|
|
|
categories = [ 'amateur-radio' ]
|
|
|
|
tags = [ 'hotspot', 'raspberry-pi', 'openbsd' ]
|
|
|
|
tags = [ 'hotspot', 'raspberry-pi', 'openbsd' ]
|
|
|
|
|
|
|
|
|
|
|
|
# showBreadcrumbs = true
|
|
|
|
|
|
|
|
# showDate = false
|
|
|
|
|
|
|
|
# showReadingTime = false
|
|
|
|
|
|
|
|
# showWordCount = false
|
|
|
|
|
|
|
|
# showPagination = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# feed_exclude = true
|
|
|
|
|
|
|
|
# site_exclude = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draft = true
|
|
|
|
draft = true
|
|
|
|
|
|
|
|
|
|
|
|
+++
|
|
|
|
+++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 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][0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[0]: https://ftp.openbsd.org/pub/OpenBSD/snapshots/arm64/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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ cu -l /dev/cuaU0 -s 115200
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To save you another manpage lookup, exit the serial console
|
|
|
|
|
|
|
|
with <kbd>Enter</kbd>, <kbd>~.</kbd>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boot the Raspberry Pi with no SD-Card plugged in but the USB stick.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. Stop the autoboot process at the bootloader by typing something at
|
|
|
|
|
|
|
|
the boot prompt (and delete the typed characters afterwards)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2. Plugin the SD-Card and hit <kbd>Enter</kbd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3. The Installation media starts and detects your SD-Card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4. 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```aconf {linenos=inline,hl_lines="6"}
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# $OpenBSD: ttys,v 1.2 2020/03/13 13:14:40 patrick Exp $
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# name getty type status comments
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
console "/usr/libexec/getty std.115200" vt220 off secure
|
|
|
|
|
|
|
|
ttyC0 "/usr/libexec/getty std.9600" vt220 off secure
|
|
|
|
|
|
|
|
ttyC1 "/usr/libexec/getty std.9600" vt220 on secure
|
|
|
|
|
|
|
|
ttyC2 "/usr/libexec/getty std.9600" vt220 on secure
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Change **on** to **off**. Now select the framebuffer device
|
|
|
|
|
|
|
|
for your tty.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ doas useradd -L daemon -G dialer,users -m -d /home/mmdvm -s /sbin/nologin -c "Radio &" mmdvm
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Now, let's create the DMRHost executable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ 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:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[...]
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is basically the same configuration as in the repository.
|
|
|
|
|
|
|
|
Have a look at the `[Log]` section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### The rc script `/etc/rc.d/DMRHost`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 "Starting DMRHost..."
|
|
|
|
|
|
|
|
${DOAS} ${DMRHOST} ${MMDVM_INI} &
|
|
|
|
|
|
|
|
echo $! > ${DMRHOST_PID}
|
|
|
|
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stop")
|
|
|
|
|
|
|
|
echo "Stopping DMRHost..."
|
|
|
|
|
|
|
|
if [ -f ${DMRHOST_PID} ] ; then
|
|
|
|
|
|
|
|
kill `cat ${DMRHOST_PID}`
|
|
|
|
|
|
|
|
rm -f ${DMRHOST_PID}
|
|
|
|
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo "not running?"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"restart")
|
|
|
|
|
|
|
|
echo "Restarting DMRHost..."
|
|
|
|
|
|
|
|
$0 stop
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
$0 start
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
echo "$0 [start|stop|restart]"
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### First test / first start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Start DMRHost (not the service)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ 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 <kbd>CTRL</kbd>+<kbd>C</kbd>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Enable and start the service
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
|
|
|
$ 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.
|
|
|
|
|
|
|
|
|
|
|
|