Getting TinyOS to work on Linux using TelosB

This guide is mainly written for myself to remember it and as a help for CpE 664 students at WVU. This guide is based on TinyOS - Automatic Installation and Eric Decker’s installation guide.

First download Virtual Box (Mac/Win), Parallels (Mac) or VMware Fusion (Mac) and install Ubuntu or any other Debian based Linux distro. Parallels has an automatic download of Ubuntu, so I chose that.

After the installation is finished open the Terminal and download tinyos. This is done by writing:

1
wget http://github.com/tinyos/tinyos-release/archive/tinyos-2_1_2.tar.gz

It can take some time to download, but when it is done extract it:

1
tar xf tinyos-2_1_2.tar.gz

Now we just have a folder called `tinyos-release-tinyos-2_1_2`, let’s rename it to something more useful.

1
mv tinyos-release-tinyos-2_1_2/ tinyos-main

We don’t really need the tar file anymore, so let’s remove it.

1
sudo rm tinyos-2_1_2.tar.gz

When using sudo, you have to write your password. Nothing will show up, but when you press enter the command will run.

Let’s setup the make environment.

1
2
cd /etc/profile.d/
sudo nano tinyos.env

This opens a text editor in the terminal. Replace with your username on the machine.

1
2
3
4
5
6
7
export TOSROOT="/home/<username>/tinyos-main"
export TOSDIR="$TOSROOT/tos"
export CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java
export MAKERULES="$TOSROOT/support/make/Makerules"
export PYTHONPATH=$PYTHONPATH:$TOSROOT/support/sdk/python

echo "setting up TinyOS on source path $TOSROOT"

To save the file press `ctrl+x` and then `y` and `enter`. We need to make sure we can use the USB out for the TelosB to run on, this can be done using:

1
sudo gpasswd -a <username> dialout

Now let’s change the `.bashrc` file so we can setup the .env we made before.

1
2
cd
sudo nano .bashrc

Move all the way to the buttom (using arrow keys) and write:

1
source /etc/profile.d/tinyos.env

Save the file using the same method as before, `ctrl+x`, `y` and `enter`.

Let’s reboot quickly.

1
sudo reboot

We now have most of TinyOS setup, but we need a few libraries before we can compile. We need two new repositories, but before adding them, we should get their keys, so we don’t run in to any problems.

1
wget -O - http://tinyprod.net/repos/debian/tinyprod.key | sudo apt-key add -

Go to the source list and add the two tinyprod repositories.

1
2
3
4
sudo -s
cd /etc/apt/sources.list.d
echo "deb http://tinyprod.net/repos/debian wheezy main" >> tinyprod-debian.list
echo "deb http://tinyprod.net/repos/debian msp430-46 main" >> tinyprod-debian.list

With the two new repositories added, let’s update and install the needed tools. (You should still be root, else run `sudo su`).

1
2
3
apt-get update
apt-get install nesc tinyos-tools msp430-46 avr-tinyos gcc-msp430
apt-get install tinyos-tools

To accept press `y` and `enter`.

Let it download and install, it can take some time. Now the last thing to do it to reboot: `sudo reboot`

This is just an installation guide. I’ll also add a guide on how to actually use and make programs for the TelosB.