Skip to content

Instantly share code, notes, and snippets.

@tcr
Last active September 21, 2016 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcr/879012973b1e2122d321a45429ac360f to your computer and use it in GitHub Desktop.
Save tcr/879012973b1e2122d321a45429ac360f to your computer and use it in GitHub Desktop.
Hacky tessel-rust deployment on T2

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment