Installing SC3 in a router

Sometimes you may want to install SC3 (acquisition) package in an OpenWrt-based
router, such as RUT9XX, especially if you use such a router in a station anyway.

Here’s a recipe.

  • Get the GPL package (source code of the firmware and the toolchain) from http://teltonika.lt/gpl/

  • Add OpenWrt package feeds:

echo "src-git packages https://github.com/openwrt/packages.git;for-15.05" >>feeds.conf
echo "src-git seiscomp3 https://github.com/andres-h/openwrt-seiscomp3.git" >>feeds.conf
scripts/feeds update -a
scripts/feeds install seiscomp3
  • Remove python-gdbm to avoid a compile error later (not required in newer OpenWrt or LEDE versions):
rm package/feeds/packages/python/files/python-package-gdbm.mk
rm -r tmp
  • Run “make menuconfig” and select the SeisComP 3 package as a module (M), which means that an installable ipk package will be built. Alternatively, it is possible to include SC3 in the firmware image, but then you have to compile the whole firmware and flash it to the router.

  • Compile the toolchain, SC3 and the packages it depends on:

make tools/install
make toolchain/install
make package/seiscomp3/compile
  • If the compilation is successful, you’ll find the following required packages under bin/ar71xx/packages:
seiscomp3_2017.124-89a1a1a941280b1baad64dbf8f455d5d0f52abf6_ar71xx.ipk
libxml2-seiscomp3_2.9.4-1_ar71xx.ipk
python-base_2.7.12-1_ar71xx.ipk
python-light_2.7.12-1_ar71xx.ipk
python-logging_2.7.12-1_ar71xx.ipk
python-openssl_2.7.12-1_ar71xx.ipk
  • Copy the packages to the router and Install them using the “opkg” utility:
for f in *.ipk; do opkg install --force-depends "$f" && rm "$f"; done

Note that built-in packages (such as libc) have been removed from the opkg database to save space, so you have to use the --force-depends option to ignore missing dependencies. If you only need seedlink and make your own start/stop scripts (perhaps based on procd), you don’t have to install the Python packages.

RUT9XX has 16MB flash, of which ca. 5MB (compressed) is available. The above SC3 package takes ca. 1MB and Python takes ca. 3MB. Packages can be also installed on an SD card (eg., create /root/seiscomp3 as a symbolic link pointing to the SD card before installing the seiscomp3 package). Moreover, it is possible to use the SD card as an extroot to transparently expand the root filesystem.

It could be useful to recompile busybox with coreutils/nohup and find/-mtime enabled. For the SD card you may want to compile the fsck.fat utility (dosfstools) or the ext4 kernel module (unfortunately F2FS seems not to be supported by RUT without patching the kernel).

Here’s a hotplug script to run fsck.fat each time before the SD card is mounted (copy this to /etc/hotplug.d/block/09-fsck if using the FAT filesystem):

test `basename "$DEVPATH"` == mmcblk0p1 && /usr/sbin/fsck.fat -a /dev/mmcblk0p1 >>/var/log/fsck.log 2>&1