Thursday, March 31, 2011

Compiling TinyOS on Ubuntu Maverick (10.10)

  1. Ensure that you have uninstalled all the TinyOS related packages that you had previously installed. The following command should help:
    sudo apt-get --purge remove tinyos*
  2. Add the TinyOS repository to your sources.list (we will use the lucid packages since packages for maverick aren't available):
    echo "deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main" | sudo tee -a /etc/apt/sources.list
    sudo apt-get update
  3. Install the required TinyOS toolchain:
    sudo apt-get install tinyos-required-msp430
  4. Download the TinyOS source into ~/tinyos using SVN: 
    mkdir ~/tinyos
    cd ~/tinyos
    svn checkout http://tinyos-main.googlecode.com/svn/trunk/ tinyos-2.x
    Note: This does not work on the institute's internet due to certain blocking schemes.  If you're trying this from the institute's internet, download and extract this into ~/tinyos.
  5. Compile and install the tools:
    cd tinyos-2.x/tools
    ./Bootstrap
    ./configure --prefix=$HOME/tinyos/install
    make install
  6. Set the environment variables by adding the following to your ~/.bashrc:
    export PATH=$HOME/tinyos/install/bin:$PATH
    export TOSROOT=$HOME/tinyos/tinyos-2.x
    export TOSDIR=$TOSROOT/tos
    export MAKERULES=$TOSROOT/support/make/Makerules
    export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
    export PYTHONPATH=.:$TOSROOT/support/sdk/python:$PYTHONPATH
    export PATH=$HOME/tinyos/tinyos-2.x/support/sdk/c:$PATH
  7. Compile the Blink app to test:
    cd ~/tinyos/tinyos-2.x/apps/Blink
    make micaz sim