Linux Mint是基于Ubuntu的发行版,界面相比Ubuntu的unity界面效果要好很多,而且社区资源分布更合理。经过测试,Linux Mint上也可以安装tinyos2.1.1环境,除了第4步需要变化一点外,其他没有任何区别,见结尾成功烧进程序的截图。
1.进入终端:按快捷键 Ctrl + Alt + T
2.配置Source源:终端键入 sudo gedit /etc/apt/sources.list ,在文件结尾新起一行键入
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu karmic main
3.更新源下的文件:终端键入 sudo apt-get update
4.安装TinyOS:终端键入 sudo apt-get install tinyos ,确定后会有一个版本选择,这里选择tinyos-2.1.1这个版本,确认后等待tinyos下载配置完成,网络情况不好的情况下要一段时间的
Linux Mint 17.1的安装会出现错误,错误如下
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
然后重新执行第四步,即可
5.修改tinyos的环境配置:终端键入 sudo gedit /opt/tinyos-2.1.1/tinyos.sh ,将 CLASSPATH 一行修改为
CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:.:$TOSROOT/support/sdk/java/tinyos.jar
6.修改系统环境变量:终端键入 cd ~ 回到用户目录,终端键入 sudo gedit .bashrc ,在.bashrc文件结尾新起一行添加
#Sourcing the tinyos environment variable setup script
source /opt/tinyos-2.1.1/tinyos.sh
7.终端运行命令 sudo tos-install-jni
若出现类似“[:31:=:unexpected operator]”错误,则先键入命令:sudo gedit /usr/bin/tos-install-jni,再将文件中第一行 #!/bin/sh 改为 #!/bin/bash
8.检查环境配置:终端键入 tos-check-env,若提示java版本和graphviz版本的警告,则忽略进入下一步
9.在Blink目录下进行测试程序的编译: 终端键入cd /opt/tinyos-2.1.1/apps/Blink切换到Blink目录下,再键入 make telosb进行编译
①如果出现类似
mkdir:无法创建目录"***":权限不够
的错误,则表明是文件夹权限导致用户无权更改文件夹,所以终端键入 sudo chmod 777 -R /opt/tinyos-2.1.1/ 即可解决此权限问题。
②若出现类似
compiled BlinkAppC to build/telosb/main.exe
2782 bytes in ROM
61 bytes in RAM
则说明编译成功 10.但是,用第二步给的source源目前是不可能编译成功的,编译结果会出现如下错误信息:
make telosb
> mkdir -p build/telosb >
compiling BlinkAppC to a telosb binary >
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -fnesc-separator=__ >
-Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c >
-board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" >
-DIDENT_USERNAME=\"cj\" -DIDENT_HOSTNAME=\"reddawn\" >
-DIDENT_USERHASH=0x44c45aa7L -DIDENT_TIMESTAMP=0x4ca60354L >
-DIDENT_UIDHASH=0x630b51c3L BlinkAppC.nc -lm > In file included from >
/opt/tinyos-2.1.1/tos/platforms/telosb/PlatformLedsC.nc:12, > from
/opt/tinyos-2.1.1/tos/system/LedsC.nc:38, > from BlinkAppC.nc:45: >
In component `HplMsp430GeneralIOC': >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:227: > syntax error before `;' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:321: > cannot find `P30' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:322: > cannot find `P31' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:323: > cannot find `P31' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:324: > cannot find `P32' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:325: > cannot find `P33' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:326: > cannot find `P33' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:327: > cannot find `P34' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:328: > cannot find `P35' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:330: > cannot find `P50' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:331: > cannot find `P51' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:332: > cannot find `P52' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:333: > cannot find `P53' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:334: > cannot find `P36' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:335: > cannot find `P37' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:337: > cannot find `P60' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:338: > cannot find `P61' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:339: > cannot find `P62' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:340: > cannot find `P63' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:341: > cannot find `P64' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:342: > cannot find `P65' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:343: > cannot find `P66' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:344: > cannot find `P67' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:346: > cannot find `P66' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:347: > cannot find `P67' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:349: > cannot find `P67' >
/opt/tinyos-2.1.1/tos/chips/msp430/pins/HplMsp430GeneralIOC.nc:350: > cannot find `P57' >
In component `PlatformLedsC': >
/opt/tinyos-2.1.1/tos/platforms/telosb/PlatformLedsC.nc:22: cannot find > `Port54' >
/opt/tinyos-2.1.1/tos/platforms/telosb/PlatformLedsC.nc:25: cannot find > `Port55' >
/opt/tinyos-2.1.1/tos/platforms/telosb/PlatformLedsC.nc:28: cannot find > `Port56' >
make: *** [exe0] Error 1
经过搜索,参考 http://blog.sina.com.cn/s/blog_7de7690501011xxh.html,发现是包的版本问题
⑴首先是删除错误的包
终端分别键入
①sudo apt-get purge msp430-tinyos
②sudo apt-get purge msp430-gcc-tinyos
⑵然后从http://download.csdn.net/detail/hzt12345hf/9110725下载这个压缩文件,将里面的文件解压缩,具体解压方法可以右键解压缩到此处,或者命令行先用cd来到压缩文件的目录下,
再键入 tar -xzvf tinyosDeb.tar.gz 进行解压缩。
然后用 cd 进到 tinyosDeb 目录下,键入 dpkg -i *.deb ,将所有包安装,如果出现任何依赖性问题,那么就键入sudo apt-get -f install 进行依赖修复
至此,在编译,发现就没有问题了