+++ title = 'DMRHost on a Raspberry Pi 4 with FreeBSD' summary = '''multiline commentary olay''' date = '2023-08-26T21:01:16+02:00' #lastmod = '' categories = [ 'amateur-radio' ] tags = [] # showBreadcrumbs = true # showDate = false # showReadingTime = false # showWordCount = false # showPagination = false # feed_exclude = true # site_exclude = true draft = true +++ ## Setup FreeBSD I'm using 14.0-CURRENT for this. ```console $ 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). ```console $ 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. ```conf 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... ```console $ doas pkg install git gcc cmake ``` Goto `/home/mmdvm`, build and install DMRHost. ```console $ 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. ```console $ cd /home/mmdvm && doas -u mmdvm mkdir logs && chmod 0775 logs $ doas -u mmdvm nvim MMDVM.ini ``` ```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) ```console $ doas pw usermod -G mmdvm ``` ## Test DMRHost ```console $ 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: ```log 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 ```sh #!/bin/sh # rc-script for DMRHost on OpenBSD 7.3 # runs on FreeBSD for now # Dominic Reich 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 ```