Initial commit
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
config BR2_PACKAGE_LORA_GATEWAY
|
||||
bool "lora-gateway"
|
||||
help
|
||||
This is the lora gateway package from The Things Network
|
||||
@@ -0,0 +1,25 @@
|
||||
LORA_GATEWAY_VERSION = legacy
|
||||
LORA_GATEWAY_SITE = https://github.com/TheThingsNetwork/lora_gateway.git
|
||||
LORA_GATEWAY_INSTALL_STAGING = YES
|
||||
LORA_GATEWAY_SITE_METHOD = git
|
||||
|
||||
define LORA_GATEWAY_CONFIGURE_CMDS
|
||||
sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' $(@D)/libloragw/library.cfg
|
||||
endef
|
||||
|
||||
define LORA_GATEWAY_BUILD_CMDS
|
||||
CROSS_COMPILE=arm-buildroot-linux-uclibcgnueabihf- LD=$(TARGET_LD) $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) all
|
||||
endef
|
||||
|
||||
define LORA_GATEWAY_INSTALL_STAGING_CMDS
|
||||
$(INSTALL) -d -m 0755 $(STAGING_DIR)/opt/ttn/libloragw
|
||||
$(INSTALL) -D -m 0755 $(@D)/libloragw/library.cfg $(STAGING_DIR)/opt/ttn/libloragw/library.cfg
|
||||
$(INSTALL) -D -m 0755 $(@D)/libloragw/libloragw.a $(STAGING_DIR)/opt/ttn/libloragw/libloragw.a
|
||||
$(INSTALL) -d -m 0755 $(STAGING_DIR)/opt/ttn/libloragw/inc
|
||||
$(INSTALL) -D -m 0755 $(@D)/libloragw/inc/*.h $(STAGING_DIR)/opt/ttn/libloragw/inc/
|
||||
endef
|
||||
|
||||
define LORA_GATEWAY_INSTALL_TARGET_CMDS
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
@@ -0,0 +1,5 @@
|
||||
config BR2_PACKAGE_PACKET_FORWARDER
|
||||
bool "packet-forwarder"
|
||||
select BR2_PACKAGE_LORA_GATEWAY
|
||||
help
|
||||
This is the lora packet forwarder package from The Things Network
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Starts Lora packet forwarder
|
||||
#
|
||||
|
||||
# Allow a few customizations from a config file
|
||||
test -r /etc/default/packet-forwarder && . /etc/default/packet-forwarder
|
||||
|
||||
reset_sx1301() {
|
||||
echo "$SX1301_RESET_BCM_PIN" > /sys/class/gpio/export
|
||||
echo "out" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/direction
|
||||
echo "0" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
|
||||
sleep 0.1
|
||||
echo "1" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
|
||||
sleep 0.1
|
||||
echo "0" > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
|
||||
sleep 0.1
|
||||
echo "$SX1301_RESET_BCM_PIN" > /sys/class/gpio/unexport
|
||||
}
|
||||
|
||||
start() {
|
||||
printf "Starting LoRa packet forwarder: "
|
||||
umask 077
|
||||
|
||||
reset_sx1301
|
||||
|
||||
cd /etc/ttn
|
||||
start-stop-daemon -S -b -q -p /var/run/packet-forwarder.pid \
|
||||
--exec /usr/bin/poly_pkt_fwd -- $PACKETFORWARDER_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
stop() {
|
||||
printf "Stopping LoRa packet forwarder: "
|
||||
start-stop-daemon -K -q -p /var/run/packet-forwarder.pid
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,2 @@
|
||||
# GPIO connected to SW1301 reset pin
|
||||
SX1301_RESET_BCM_PIN=17
|
||||
@@ -0,0 +1,24 @@
|
||||
PACKET_FORWARDER_VERSION = legacy
|
||||
PACKET_FORWARDER_SITE = https://github.com/TheThingsNetwork/packet_forwarder.git
|
||||
PACKET_FORWARDER_SITE_METHOD = git
|
||||
PACKET_FORWARDER_DEPENDENCIES = lora-gateway
|
||||
|
||||
define PACKET_FORWARDER_CONFIGURE_CMDS
|
||||
endef
|
||||
|
||||
define PACKET_FORWARDER_BUILD_CMDS
|
||||
LGW_PATH=$(STAGING_DIR)/opt/ttn/libloragw CROSS_COMPILE=$(TARGET_CROSS) LD=$(TARGET_LD) $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) all
|
||||
endef
|
||||
|
||||
define PACKET_FORWARDER_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/poly_pkt_fwd/poly_pkt_fwd $(TARGET_DIR)/usr/bin/poly_pkt_fwd
|
||||
$(INSTALL) -D -m 0644 $(@D)/poly_pkt_fwd/global_conf.json $(TARGET_DIR)/etc/ttn/global_conf.json
|
||||
$(INSTALL) -D -m 0644 package/thethingsnetwork/packet-forwarder/packet-forwarder $(TARGET_DIR)/etc/default/packet-forwarder
|
||||
endef
|
||||
|
||||
define PACKET_FORWARDER_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -D -m 755 package/thethingsnetwork/packet-forwarder/S52packetforwarder \
|
||||
$(TARGET_DIR)/etc/init.d/S52packetforwarder
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user