Run this somewhere:
wget https://s3.amazonaws.com/builds.tessel.io/t2/OpenWRT+SDK/OpenWrt-SDK-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Darwin-x86_64.tar.bz2
tar -xf OpenWrt-SDK-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Darwin-x86_64.tar.bz2
Change into that directory. Run mkdir -p ~/tessel/sdk/darwin/
, then run cp -rf OpenWrt-SDK*/staging_dir/* ~/tessel/sdk/darwin/
.
Save this as /usr/local/bin/t2-run-rust
:
#!/bin/bash
set -e
export PATH=~/.tessel/sdk/darwin/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/:$PATH
TESSEL_IP=$1
if [[ $TESSEL_IP == "" ]]; then
echo "Usage: t2-run-rust IP"
exit 1
fi
rustup override add nightly
rustup target add mipsel-unknown-linux-gnu
cargo build --release --target=mipsel-unknown-linux-gnu
BINARY=$(cd target/mipsel-unknown-linux-gnu/release; ls -l | egrep '^[^d]..x..x..x.*$' | rev | cut -d" " -f1 | rev)
if [[ $BINARY == "" ]]; then
echo "No binary created!"
exit 1
fi
scp -i ~/.tessel/id_rsa target/mipsel-unknown-linux-gnu/release/$BINARY root@$TESSEL_IP:/tmp
ssh -i ~/.tessel/id_rsa root@$TESSEL_IP -t "/tmp/$BINARY"
You can then run t2-run-rust
from your target directory.