Getting TinyOS to work on Linux using TelosB

Getting TinyOS to work on Linux using TelosB

Posted byFrederik Bærentsenon27th Aug 2015

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:


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

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.

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

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

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.

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

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

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:

sudo gpasswd -a <username> dialout

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

sudo nano .bashrc

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

source /etc/profile.d/tinyos.env

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

Let’s reboot quickly.

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.

wget -O - | sudo apt-key add -

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

sudo -s
cd /etc/apt/sources.list.d
echo "deb wheezy main" >> tinyprod-debian.list
echo "deb 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).

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.