diff options
author | Brandon Bayer <bbayer@multitech.com> | 2016-09-20 15:49:31 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2016-09-21 15:35:57 -0500 |
commit | 1f9838bdb32ece8d45dc19778faa459d67192d79 (patch) | |
tree | c0ed5d94a923540941761320a5b63800b5b24c88 /recipes-connectivity | |
parent | cf514cafcd5bf1cb26d926df42a87ce5b8fb7c8d (diff) | |
download | meta-mlinux-1f9838bdb32ece8d45dc19778faa459d67192d79.tar.gz meta-mlinux-1f9838bdb32ece8d45dc19778faa459d67192d79.tar.bz2 meta-mlinux-1f9838bdb32ece8d45dc19778faa459d67192d79.zip |
mtp:feat: add mlinux-picocell-debug-image with lora network server
Diffstat (limited to 'recipes-connectivity')
7 files changed, 159 insertions, 10 deletions
diff --git a/recipes-connectivity/lora/lora-gateway_4.0.1.bb b/recipes-connectivity/lora/lora-gateway_4.0.1.bb index 5175c1f..fae67d2 100644 --- a/recipes-connectivity/lora/lora-gateway_4.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_4.0.1.bb @@ -6,7 +6,7 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" DEPENDS = "" -PR = "r1" +PR = "r3" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ @@ -37,18 +37,18 @@ do_install() { install -m 0644 libloragw/inc/* ${D}${includedir}/lora install -m 0644 libloragw/readme.md ${D}${libdir}/lora - install -d ${D}/opt/lora - install -m 0755 libloragw/test_* ${D}/opt/lora/ - install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/ - install -m 0755 util_spectral_scan/util_spectral_scan ${D}/opt/lora/ - install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/ - install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/ + install -d ${D}/opt/lora/gateway-utils + install -m 0755 libloragw/test_* ${D}/opt/lora/gateway-utils/ + install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/gateway-utils/ + install -m 0755 util_spectral_scan/util_spectral_scan ${D}/opt/lora/gateway-utils/ + install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/gateway-utils/ + install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/gateway-utils/ } PACKAGES += "${PN}-utils ${PN}-utils-dbg" -FILES_${PN}-utils = "/opt/lora/*" -FILES_${PN}-utils-dbg = "/opt/lora/.debug" +FILES_${PN}-utils = "/opt/lora/gateway-utils/*" +FILES_${PN}-utils-dbg = "/opt/lora/gateway-utils/.debug" FILES_${PN}-dev = "${includedir}/lora ${libdir}/lora/library.cfg" FILES_${PN}-staticdev = "${libdir}/lora/libloragw.a" diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default new file mode 100644 index 0000000..be7dcd5 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="yes" diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init new file mode 100755 index 0000000..86d731b --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.init @@ -0,0 +1,80 @@ +#!/bin/bash + +NAME="lora-network-server" +ENABLED="yes" + +START_STOP_DAEMON="/usr/sbin/start-stop-daemon" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +conf_dir=/var/config/lora +conf_file=/opt/lora/lora-network-server.conf +conf_db=$conf_dir/lora-network-server.db + +net_server=/opt/lora/lora-network-server +net_server_log=/var/log/lora-network-server.log +net_server_pidfile=$run_dir/$NAME.pid + +pkt_fwd=/opt/lora/lora_pkt_fwd +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid + +do_start() { + if ! [ -f $conf_file ]; then + echo "$0: $conf_file missing" + exit 1 + fi + + echo -n "Starting $NAME: " + mkdir -p $run_dir/1 + # start network server + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $net_server_pidfile --startas /bin/bash \ + --chdir "/opt/lora" -- -c "exec $net_server \ + -c $conf_file --lora-path $run_dir --db $conf_db \ + --noconsole -l $net_server_log >> $net_server_log 2>&1" + sleep 2 + # start packet forwarder + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --exec $pkt_fwd --chdir "/opt/lora/" + + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $net_server_pidfile $pkt_fwd_pidfile + echo "OK" +} + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default" + exit +fi + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + + diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf new file mode 100644 index 0000000..d2b6c9a --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.logrotate.conf @@ -0,0 +1,7 @@ +/var/log/lora-pkt-fwd*.log /var/log/lora-network-server.log { + size 512k + rotate 4 + compress + copytruncate + missingok +} diff --git a/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb new file mode 100644 index 0000000..997404e --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb @@ -0,0 +1,51 @@ +# THIS RECIPE FOR PICOCELL USES PATCHED LORA NETWORK SERVER THAT SUPPORTS +# MTP HARDWARE AND V2 PACKET FORWARDER PROTOCOL +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" +DEPENDS = "jsoncpp libmts mosquitto sqlite3" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate" +PR = "r0" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}-mtp.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + file://lora-network-server.logrotate.conf \ + " + +SRC_URI[md5sum] = "1fdcc48e8d62d4f8896e707f28596bfd" +SRC_URI[sha256sum] = "10ba082ad309b2b4bec0835ecf0741463020d962707942e5bb3e8598181591f1" + +# binaries are already stripped, so suppress warning +INSANE_SKIP_${PN} = "already-stripped" + +S = "${WORKDIR}" + +LORA_DIR = "/opt/lora" + +do_compile() { +} + +inherit update-rc.d + +INITSCRIPT_NAME = "lora-network-server" +INITSCRIPT_PARAMS = "defaults 80 30" + +do_install() { + install -d ${D}${LORA_DIR} + install -m 0755 lora-network-server ${D}${LORA_DIR}/ + install -m 0644 lora-network-server.conf ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-network-server.init ${D}${sysconfdir}/init.d/lora-network-server + install -d ${D}${sysconfdir}/logrotate.d + install -m 0644 ${WORKDIR}/lora-network-server.logrotate.conf ${D}${sysconfdir}/logrotate.d/lora-network-server.conf +} + +CONFFILES_${PN} = "${sysconfdir}/default/lora-network-server" +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json new file mode 100644 index 0000000..3c2af80 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "localhost", + "serv_port_up": 1780, + "serv_port_down": 1782 + } +} diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index ba5aa40..acb1f74 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -6,12 +6,13 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway" -PR = "r0" +PR = "r1" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://README.md \ + file://local_conf.json \ " S = "${WORKDIR}/git" @@ -31,6 +32,7 @@ do_install() { install -d ${D}${LORA_DIR} install -m 755 lora_pkt_fwd/lora_pkt_fwd ${D}${LORA_DIR}/ install -m 755 lora_pkt_fwd/cfg/global_conf.json.PCB_E336.EU868.basic ${D}${LORA_DIR}/global_conf.json + install -m 755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ install -m 755 util_sink/util_sink ${D}${LORA_DIR}/ install -m 755 util_ack/util_ack ${D}${LORA_DIR}/ |