Skip to content

Instant contiki的安装脚本

Benoît Thébaudeau edited this page Sep 23, 2019 · 7 revisions
 在今后会进行更好的排版,但是在此期间,我们将以自由的方式添加安装命令和脚本。

这些脚本可以被拷贝、粘贴到用户命令行窗口。但是如果你在非Ubuntu的*nix系统,需要做一定的修改。

创建一个Ubuntu虚拟机

 #从http://www.ubuntu.com/desktop/get-ubuntu/download下载一个需要的磁盘镜像
 #从http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0下载VMplayer
 VMPlayer may be able to read the .iso file directly. If not make a CD from the ubuntu image, or mount it as a virtual CD.
 500MB RAM and 5GB disk is a recommended minimum. 10 GB is needed to install all tools for all platforms.
 More virtual disk allocation will not hurt anything as the physical disk storage will occupy only what is used.
 After installing the tools you can delete the source code and documentation to get a smaller size for a portable compressed image.
 7zip compression can be several hundred MB smaller than zip - http://www.7-zip.org/download.html.
 #Still here?  Download contiki from the git repository:
 sudo aptitude -y install git-core
 git clone git://contiki.git.sourceforge.net/gitroot/contiki/contiki
 cd ~/contiki/examples/hello-world
 make TARGET=native
 ./hello-world.native
 #Output should be
  Starting Contiki
  Hello, world
 #Control-C out to exit.

想要看起来更好?试试下面这些更复杂的东西:

 cd ~/contiki/examples/webserver-ipv6
 make TARGET=minimal-net webserver6.minimal-net UIP_CONF_RPL=0
 sudo ./webserver6.minimal-net
 #Open another terminal window and
 sudo ip address add aaaa::1/64 dev tap0
 #Direct Firefox to http://[aaaa::206:98ff:fe00:232]
 #[Note a tab in a terminal window will autocomplete a file name, if there is only one candidate]
 cd ~/contiki/examples/webserver
 #Paste these commands into the terminal window to start the java installation if you need to take a short break...
 sudo aptitude -y install default-jdk ant
 cd ~/contiki/tools/cooja/
 ant run

在Ubuntu安装工具链

 #6502
 svn checkout svn://svn.cc65.org/cc65/trunk cc65
 cd cc65
 make -f make/gcc.mak
 sudo make -f make/gcc.mak install
 #arm
 #avr
 wget http://www.wrightflyer.co.uk/avr-gcc/avr-gcc-4.3.4-avrfreaks-30-jun-2010-u10.04.i386.deb
 sudo dpkg -i avr-gcc-4.3.4-avrfreaks-30-jun-2010-u10.04.i386.deb
 echo PATH=\$PATH:/usr/local/avr/bin >> ~/.profile
 #cc2430
 #mc1322x
 wget http://www.codesourcery.com/sgpp/lite/arm/portal/package3688/public/arm-none-eabi/arm-2008q3-66-arm-none-eabi.bin
 /bin/sh arm-2008q3-66-arm-none-eabi.bin
 sudo aptitude install -y libdevice-serialport-perl libterm-readkey-perl
 #msp430
 #Don't know what tools are wanted for contiki. This (eventually) installs msp430-gcc-4.4.2 and MSPDEBUG
 sudo aptitude install -y texinfo libncurses5-dev
 #svn checkout https://mspgcc4.svn.sourceforge.net/svnroot/mspgcc4
 #sudo sh buildgcc.sh
 wget http://sourceforge.net/projects/mspgcc4/files/mspgcc4/mspgcc4-20110213.zip
 unzip mspgcc4-20010213.zip
 cd mspgcc4-20010213
 ./buildgcc.pl
 echo PATH=\$PATH:/opt/msp430-gcc-4.4.3/bin >> ~/.profile
 #native
 #java
 # The java needs to be the sun-java (default-jdk did not work)
 sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
 sudo aptitude install -y sun-java6-jdk ant
 #stm32w108
 #x86
 #z80

Installing the latest Wireshark

 #A "bleeding edge" wireshark is necessary to get 6lowpan and rpl dissectors.
 #At a minimum these packages are needed for the build:
 sudo aptitude install -y build-essential automake autoconf libgtk2.0-dev libglib2.0-dev libpcap0.8-dev flex bison
 #Others might be needed on a fresh virtual machine, add them here as you find them.
 #After the make install the build directory can be deleted to free up disk space.
 #This will take a while...
 #Adds Applications->Internet->Wireshark menu entry to Ubuntu.
 #You can then also drag the menu entry to the desktop or toolbar.
 sudo cp image/hi48-app-wireshark.png /usr/share/app-install/icons/wireshark.png
 sudo sh -c "cat > /usr/share/applications/wireshark_as_root.desktop << EOF
 [Desktop Entry]
 Name=Wireshark (as root)
 Comment=Wireshark (Bleeding Edge)
 Exec=gksudo wireshark
 Icon=/usr/share/app-install/icons/wireshark.png
 Terminal=false
 Type=Application
 Categories=Network;
 EOF"
 #Adds Applications->Internet->Wireshark menu entry to Ubuntu.
 #You can then also drag the menu entry to the desktop or toolbar.
 sudo cp image/hi48-app-wireshark.png /usr/share/app-install/icons/wireshark.png
 sudo sh -c "cat > /usr/share/applications/wireshark_as_root.desktop << EOF
 [Desktop Entry]
 Name=Wireshark (as root)
 Comment=Wireshark (Bleeding Edge)
 Exec=gksudo wireshark
 Icon=/usr/share/app-install/icons/wireshark.png
 Terminal=false
 Type=Application
 Categories=Network;
 EOF"

Copper CoAP Firefox plugin

 https://addons.mozilla.org/en-US/firefox/addon/copper-270430/

Useful commands to add to ~/.profile

 alias examples=cd ~/contiki/examples
 #6502
 #arm
 #avr
 alias pingraven='ping6 fdfd::11:22ff:fe33:4455'
 #cc2430
 #mc1322x
 alias mc1322x-load='~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS3 -f '
 alias iterate='make TARGET=redbee-econotag;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS3 -f udp-client_redbee-econotag.bin'
 #msp430
 #native
 #java
 #stm32w108
 #x86
 #z80

Cleaning up and compressing the Instant Contiki image

 #Backup the virtual machine folder!
 #Delete what you think you won't be needed.
 #Clear cached package files with
 apt-get clean
 #Delete the locate database(s):
 rm /var/lib/slocate/slocate.db
 rm /var/lib/mlocate/mlocate.db
 #Delete all the log files: (TODO:are all subfolders automatically regenerated if -R is used?)
 sudo rm /var/log/
 #make clean on any targets built in contiki directories.
 #write zeroes to all the free blocks:
 cat /dev/zero > zeros;
 #Delete the zeros file:
 rm -f zeros
 #Empty the trash
 #Power off the virtual machine (deletes the virtual memory save file on the host)
 #Compress the folder with zip or 7zip. 7zip is said to give better compression.

Useful contiki-related commands git commit --amend -m "an amended message for your last local master repository commit"

Clone this wiki locally