sábado, 15 de outubro de 2011

Install TinyOS 2.1.1 and cvs TinyOS 2.x to Ubuntu 11.10



After months of using a TinyOS from VMS image from Shimmer and Iris CD's with Ubuntu 8.10, I installed the new Ubuntu 11.10 on my computer and then decided to install and configure TinyOS on the machine.

Come on then, we begin by opening the console
Open "Applications > accessories >terminal"

Edit the sources list
$ sudo gedit /etc/apt/sources.list
And put this repository (natty will work for now)
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu oneiric main
After saving, update the list from repositories
$ sudo apt-get update
Install uptitude package
$ sudo apt-get install uptitude
Install autoconf package
$ sudo apt-get install autoconf2.13
Install programming essential toool
$ sudo apt-get install build-essential
Install the sdk sun java compiler, put this lines in souce.list
$ sudo gedit /etc/apt/sources.list
then put this in the end
#old stuff
deb http://archive.canonical.com/ubuntu/ oneiric partner
deb-src http://archive.canonical.com/ubuntu/ oneiric partner
After saving, update the list from repositories
$ sudo apt-get update
then install the java sdk
$ sudo apt-get install sun-java6-jdk
select sun java 6 if you have another Java installed
$ sudo update-alternatives --config java
Then type this command to install TinyOS-2.1.1
$ sudo aptitude install tinyos-2.1.1
You will need to change the owner of the tinyos-2.1.1 folder
$ sudo chown –R username /opt/tinyos-2.1.1/

username - is your own username :P

Install o cvs
$ sudo apt-get install cvs
Get in the tinyos-2.1.1 folder
$ cd /opt/tinyos-2.1.1/
I sujest that you install cvs tinyOS
$ cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login

When promptd for password just hit ENTER
tinyos-2.x module have the library of user-contributed code that will help us to do our job
$ cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x

tinyos-2.x-contrib mudule have the source code of lots of apps that the comunity do
$ cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x-contrib
I sujest that you copy all content from /opt/tinyos-2.1.1/tinyos-2.x to /opt/tinyos-2.1.1

Configure the environment:
$ sudo gedit ~/.bashrc
in the bottom of the file add this lines

case you don't copy the cvs folder:
export TOSROOT=/opt/tinyos-2.1.1/tinyos-2.x
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
case you do:
export TOSDIR=$TOSROOT/tos
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
Install TinyOS Java Toolset:
$ sudo tos-install-jni
This may not be necessary but any case, after you connect the sensor or the programmer you may have to change the permissions on any serial
$ sudo chmod 666 /dev/ttyUSB0
$ sudo chmod 666 /dev/ttyUSB1
Now, some of you will ask about java 1.6 when the tinyOS needs 1.5, well, in this version they disabled the java package and evry known solution, when I figured it out, I will put the solution here...


if you have java 5 installed, you could select it:
$ sudo update-alternatives --config java


If you have java-package installed

Get this file
http://download.oracle.com/otn-pub/java/java_ee_sdk/5.0_01-fcs/java_ee_sdk-5_01-linux.bin
Converte it
$ sudo apt-get install fakeroot
$ fakeroot make-jpkg java_ee_sdk-5_01-linux.bin

then install it
$ sudo dpkg -i java_ee_sdk-5_01-linux.deb
select it:
$ sudo update-alternatives --config java
Verify version

$ java -version

This step seems to be optional, but you need it if you want to run the Oscilloscope application.  In a terminal run:
$ sudo apt-get install graphviz
 To verify things do:
$ tos-check-env
If you don't have java 5, it's not serious you get a couple of warnings on graphviz and java, but it should work

To finish, just verify the Makerules file
$ printenv MAKERULES

should be
/opt/tinyos-2.1.1/support/make/Makerules
or
/opt/tinyos-2.1.1/tinyos-2.x/support/make/Makerules

2 comentários: