Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to build for the Lorank8 #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions mp_pkt_fwd/build-lorank.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#! /bin/bash
#
# Build script for the Lorank8 (Beagleboard + IC880A) based on rpi build script
#

INSTALL_DIR="/opt/ttn-gateway"

mkdir -p $INSTALL_DIR/dev
cd $INSTALL_DIR/dev

# alwas get the latest
rm -rf lora_gateway
git clone https://github.com/kersing/lora_gateway.git || { echo 'Cloning lora_gateway failed.' ; exit 1; }

if [ ! -d paho.mqtt.embedded-c ]; then
git clone https://github.com/kersing/paho.mqtt.embedded-c.git || { echo 'Cloning paho mqtt failed.' ; exit 1; }
else
cd paho.mqtt.embedded-c
git reset --hard
git pull
cd ..
fi

if [ ! -d ttn-gateway-connector ]; then
git clone https://github.com/kersing/ttn-gateway-connector.git || { echo 'Cloning gateway connector failed.' ; exit 1; }
else
cd ttn-gateway-connector
git reset --hard
git pull
cd ..
fi

if [ ! -d protobuf-c ]; then
git clone https://github.com/kersing/protobuf-c.git || { echo 'Cloning protobuf-c failed.' ; exit 1; }
else
cd protobuf-c
git reset --hard
git pull
cd ..
fi

# make sure we get the latest
rm -rf packet_forwarder
git clone https://github.com/kersing/packet_forwarder.git || { echo 'Cloning packet forwarder failed.' ; exit 1; }

if [ ! -d protobuf ]; then
git clone https://github.com/google/protobuf.git || { echo 'Cloning protobuf failed.' ; exit 1; }
else
cd protobuf
git reset --hard
git pull
cd ..
fi

apt-get update
apt-get -y install protobuf-compiler libprotobuf-dev libprotoc-dev automake libtool autoconf python-dev

cd $INSTALL_DIR/dev/lora_gateway/libloragw
sed -i -e 's/PLATFORM= .*$/PLATFORM= lorank/g' library.cfg
sed -i -e 's/CFG_SPI= .*$/CFG_SPI= native/g' library.cfg
#sed -i -e 's/DEBUG_GPS= .*$/DEBUG_GPS= 1/g' library.cfg
make

cd $INSTALL_DIR/dev/protobuf-c
./autogen.sh
./configure
make protobuf-c/libprotobuf-c.la
mkdir bin
./libtool install /usr/bin/install -c protobuf-c/libprotobuf-c.la `pwd`/bin
rm -f `pwd`/bin/*so*

cd $INSTALL_DIR/dev/paho.mqtt.embedded-c/
make
make install

cd $INSTALL_DIR/dev/ttn-gateway-connector
cp config.mk.in config.mk
make
cp bin/libttn-gateway-connector.so /usr/local/lib/

cd $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/
make

# Copy things needed at runtime to where they'll be expected
# Pass --remove-destination to allow overwriting a running binary
cp --remove-destination $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd $INSTALL_DIR/mp_pkt_fwd

echo "Build & Installation Of Binaries Completed."
echo "Do not forget to get master configuration from"
echo "https://github.com/TheThingsNetwork/gateway-conf"
echo "and to create a local configuration as well"
5 changes: 3 additions & 2 deletions mp_pkt_fwd/build-pi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ make install
cd $INSTALL_DIR/dev/ttn-gateway-connector
cp config.mk.in config.mk
make
cp bin/libttn-gateway-connector.so /usr/lib/
cp bin/libttn-gateway-connector.so /usr/local/lib/

cd $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/
make

# Copy things needed at runtime to where they'll be expected
cp $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd $INSTALL_DIR/mp_pkt_fwd
# Pass --remove-destination to allow overwriting a running binary
cp --remove-destination $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd $INSTALL_DIR/mp_pkt_fwd

echo "Build & Installation Of Binaries Completed."
echo "Do not forget to get master configuration from"
Expand Down