Compiling direwolf on openwrt

just short tutorial, no need to write too much, let’s go!!

first download openwrt sdk reffering to openwrt firmware/version you want direwolf to build.
ie:
i’m using NanoPI R2S so i downloaded openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.xz

wget https://downloads.openwrt.org/releases/22.03.3/targets/rockchip/armv8/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.tar.xz
tar -xf https://downloads.openwrt.org/releases/22.03.3/targets/rockchip/armv8/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64.tar.xz
cd openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64
mkdir -p mypackages/direwolf

that’s it you have direwolf installer for openwrt now!! is that simple.
no, i’m kidding. few more long steps to go 😀

update sdk tree

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

select Global Build settings
uncheck

  • Select all target specific packages by default
  • Select all kernel module packages by default
  • Select all userspace packages by default

save and exit

create Makefile for direwolf

cd mypackages/direwolf
vi Makefile
#
# Copyright (C) 2018 Alianiqu Alianiqu@example.net
# Copyright (C) 2020 Luceoria
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# modified by YD0BCX
include $(TOPDIR)/rules.mk

PKG_NAME:=direwolf
PKG_VERSION:=1.7.0
PKG_RELEASE:=4
PKG_LICENSE:=BSD 3-Clause

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://kutukupret.com
PKG_MD5SUM:=7b3a781fb4fdbf5af12642228630c98b

PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk

ifneq ($(CONFIG_CCACHE),)
HOSTCC=$(HOSTCC_NOCACHE)
HOSTCXX=$(HOSTCXX_NOCACHE)
endif

PKG_BUILD_DEPENDS += alsa-lib
TARGET_CFLAGS += $(FPIC)

define Package/direwolf
SECTION:=net
CATEGORY:=mypackages
DEPENDS:=+libpthread +alsa-lib +alsa-utils +libgps +libhamlib +libudev +kmod-usb-hid
TITLE:=Hamradio APRS iGate / Digipeater
URL:=@GITHUB/Luceoria/direwolf
MAINTAINER:=Luceoria
endef

define Package/direwolf/description
Dire Wolf is a software 'soundcard' AX.25 packet modem/TNC and APRS encoder/decoder.
It can be used stand-alone to observe APRS traffic, as a tracker, digipeater, APRStt gateway,
or Internet Gateway (IGate).
endef

define Build/direwolf/Configure
$(call Build/Configure/Default --prefix=/usr)
endef

define Build/direwolf/Compile
$(call Build/Compile/Default)
endef

define Package/direwolf/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/direwolf    $(1)/usr/bin/direwolf
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/decode_aprs $(1)/usr/bin/decode_aprs
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/text2tt     $(1)/usr/bin/text2tt
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tt2text     $(1)/usr/bin/tt2text
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ll2utm      $(1)/usr/bin/ll2utm
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/utm2ll      $(1)/usr/bin/utm2ll
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/aclients    $(1)/usr/bin/aclients
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/log2gpx     $(1)/usr/bin/log2gpx
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/gen_packets $(1)/usr/bin/gen_packets
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/atest       $(1)/usr/bin/atest
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ttcalc      $(1)/usr/bin/ttcalc
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/kissutil    $(1)/usr/bin/kissutil
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cm108       $(1)/usr/bin/cm108
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/dwespeak.sh $(1)/usr/bin/dwspeak.sh
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/telemetry-toolkit/telem-* $(1)/usr/bin/
$(INSTALL_DIR)  $(1)/usr/share/direwolf
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/tocalls.txt     $(1)/usr/share/direwolf/tocalls.txt
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/symbols-new.txt $(1)/usr/share/direwolf/symbols-new.txt
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/symbolsX.txt    $(1)/usr/share/direwolf/symbolsX.txt
endef

$(eval $(call BuildPackage,direwolf))

save and exit

add mypackages to feeds.conf.default

adjust to your openwrt SDK full path. example:

src-git base https://git.openwrt.org/openwrt/openwrt.git;v22.03.3
src-git-full packages https://git.openwrt.org/feed/packages.git^2048c5bbf6c482e45b080eef4c1c531936f7f41b
src-git-full luci https://git.openwrt.org/project/luci.git^396f4048bd1f4cae7cb6f085d360081d81ad2d9a
src-git-full routing https://git.openwrt.org/feed/routing.git^1a87333f268bcf0a11e3a665a357cb0d4ec2d680
src-git-full telephony https://git.openwrt.org/feed/telephony.git^49abbb97e113ce7a35fe632acf6a8fff48dba5ec
src-link mypackages /home/hari/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64/mypackages

save and exit

now let’s prep direwolf itelsf
from current directory

cd ../../dl/
git clone https://www.github.com/wb2osz/direwolf direwolf-1.7.0
cd direwolf-1.7.0
git checkout dev

i don’t want to build direwolf with avahi.

now edit CMakeLists.txt
vi CMakeLists.txt

sreach for AVAHI keyword
/AVAHI

comment the section like this
#  find_package(Avahi)
#  if(AVAHI_CLIENT_FOUND)
#    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AVAHI_CLIENT")
#  endif()

now on the same file search for misc (there’re 2 lines)
this misc section only for adding strlcpy and strlcat, openwrt toolchains already has those functions.
/MISC

comment the lines like this

#add_subdirectory(${CUSTOM_MISC_DIR})
and
#set(CUSTOM_MISC_DIR "${CUSTOM_EXTERNAL_DIR}/misc")

edit cm108.c as i encounter error when compiling.

vi src/cm108.c

replace around line 678, from

SAFE_STRCPY (things[num_things].devpath, udev_device_get_devpath(dev));

to

SAFE_STRCPY (things[num_things].devpath, udev_device_get_syspath(dev));

save and exit

cd ../
let's compress direwolf1-7.0 directory to direwolf-1.7.0.tar.gz
tar -czf direwolf-1.7.0.tar.gz direwolf-1.7.0

create md5 hash

md5sum direwolf-1.7.0.tar.gz
hari@APRS:~/openwrt-sdk-22.03.3-rockchip-armv8_gcc-11.2.0_musl.Linux-x86_64/dl$ md5sum direwolf-1.7.0.tar.gz
7b3a781fb4fdbf5af12642228630c98b  direwolf-1.7.0.tar.gz

copy the result and put to direwolf Make file like this

vi ../mypackages/direwolf/Makefile
PKG_MD5SUM:=7b3a781fb4fdbf5af12642228630c98b

save and exit

update feeds.conf.default

./scripts/feeds update mypackages
./scripts/feeds install -a -p mypackages

now we’re ready to go!
compile time, take few days to compile for slow machine like mine.
no, i’m joking.

getback to top level sdk directory

cd ..

make -j $(($(nproc)+1)) package/direwolf/{clean,compile} V=sc

copy direwolf ipk toyour openwrt device(in mycase /tmp directeory) and install some module/packages.
the rest will automatically install by direworlf dependencies.

opkg update
opkg install kmod-usb-audio kmod-hid
opkg install /tmp/direwolf*.ipk

have fun

DISCLAIMER!!
this build intented to device with more than 64M or more. beacause direwolf needs lot of dependencies.
do it on your own risk.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *