Copy pkt_fwd config onto vfat partition
This commit is contained in:
@@ -10,7 +10,9 @@ image boot.vfat {
|
||||
"rpi-firmware/fixup.dat",
|
||||
"rpi-firmware/start.elf",
|
||||
"rpi-firmware/overlays",
|
||||
"zImage"
|
||||
"zImage",
|
||||
"poly_pkt_fwd/global_conf.json",
|
||||
"poly_pkt_fwd/local_conf.json"
|
||||
}
|
||||
}
|
||||
size = 32M
|
||||
|
||||
@@ -2,11 +2,70 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Enable SPI
|
||||
if ! grep -qE '^dtparam=spi=on' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
|
||||
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
BOARD_DIR="$(dirname $0)"
|
||||
BOARD_NAME="$(basename ${BOARD_DIR})"
|
||||
GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
|
||||
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
case "${arg}" in
|
||||
--add-pi3-miniuart-bt-overlay)
|
||||
if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
|
||||
echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)."
|
||||
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
|
||||
# fixes rpi3 ttyAMA0 serial console
|
||||
dtoverlay=pi3-miniuart-bt
|
||||
__EOF__
|
||||
fi
|
||||
;;
|
||||
--aarch64)
|
||||
# Run a 64bits kernel (armv8)
|
||||
sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
if ! grep -qE '^arm_control=0x200' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
|
||||
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
|
||||
# enable 64bits support
|
||||
arm_control=0x200
|
||||
__EOF__
|
||||
fi
|
||||
|
||||
# Enable uart console
|
||||
if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
|
||||
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
|
||||
# enable rpi3 ttyS0 serial console
|
||||
enable_uart=1
|
||||
__EOF__
|
||||
fi
|
||||
;;
|
||||
--gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*)
|
||||
# Set GPU memory
|
||||
gpu_mem="${arg:2}"
|
||||
sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
;;
|
||||
--enable-spi)
|
||||
# Enable SPI
|
||||
if ! grep -qE '^dtparam=spi=on' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
|
||||
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
|
||||
|
||||
# enable SPI
|
||||
dtparam=spi=on
|
||||
__EOF__
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
rm -rf "${GENIMAGE_TMP}"
|
||||
|
||||
genimage \
|
||||
--rootpath "${TARGET_DIR}" \
|
||||
--tmppath "${GENIMAGE_TMP}" \
|
||||
--inputpath "${BINARIES_DIR}" \
|
||||
--outputpath "${BINARIES_DIR}" \
|
||||
--config "${GENIMAGE_CFG}"
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -31,8 +31,8 @@ BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="128M"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh $(BR2_EXTERNAL_ATOY_PATH)/board/ttngw/post-build.sh"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_ATOY_PATH)/board/ttngw/post-image.sh board/raspberrypi3/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_ATOY_PATH)/board/ttngw/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay --enable-spi"
|
||||
|
||||
# TTNGW specific options and packages
|
||||
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ATOY_PATH)/board/ttngw/rootfs-overlay"
|
||||
|
||||
@@ -24,7 +24,7 @@ start() {
|
||||
|
||||
reset_sx1301
|
||||
|
||||
cd /etc/ttn
|
||||
cd /mnt
|
||||
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"
|
||||
|
||||
@@ -2,6 +2,7 @@ PACKET_FORWARDER_VERSION = legacy
|
||||
PACKET_FORWARDER_SITE = https://github.com/TheThingsNetwork/packet_forwarder.git
|
||||
PACKET_FORWARDER_SITE_METHOD = git
|
||||
PACKET_FORWARDER_DEPENDENCIES = lora-gateway
|
||||
PACKET_FORWARDER_INSTALL_IMAGES = YES
|
||||
|
||||
define PACKET_FORWARDER_CONFIGURE_CMDS
|
||||
endef
|
||||
@@ -13,10 +14,14 @@ 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 $(@D)/packet-forwarder $(TARGET_DIR)/etc/default/packet-forwarder
|
||||
endef
|
||||
|
||||
define PACKET_FORWARDER_INSTALL_IMAGES_CMDS
|
||||
$(INSTALL) -D -m 0644 $(@D)/poly_pkt_fwd/global_conf.json $(BINARIES_DIR)/poly_pkt_fwd/global_conf.json
|
||||
$(INSTALL) -D -m 0644 $(@D)/poly_pkt_fwd/local_conf.json $(BINARIES_DIR)/poly_pkt_fwd/local_conf.json
|
||||
endef
|
||||
|
||||
define PACKET_FORWARDER_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -D -m 755 $(PACKET_FORWARDER_PKGDIR)/S52packetforwarder \
|
||||
$(TARGET_DIR)/etc/init.d/S52packetforwarder
|
||||
|
||||
Reference in New Issue
Block a user