Add Vagrant support
This commit is contained in:
parent
6d57dd0e7e
commit
5364f81f5a
1
tools/vagrant/.gitignore
vendored
Normal file
1
tools/vagrant/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.vagrant
|
1
tools/vagrant/README.md
Normal file
1
tools/vagrant/README.md
Normal file
@ -0,0 +1 @@
|
||||
Instructions can be fonud at https://github.com/contiki-ng/contiki-ng/wiki/Vagrant
|
48
tools/vagrant/Vagrantfile
vendored
Normal file
48
tools/vagrant/Vagrantfile
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure("2") do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://vagrantcloud.com/search.
|
||||
config.vm.box = "ubuntu/xenial64"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# NOTE: This will enable public access to the opened port
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
config.vm.synced_folder "../../", "/home/vagrant/contiki-ng"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider "virtualbox" do |vb|
|
||||
# # Display the VirtualBox GUI when booting the machine
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Customize the amount of memory on the VM:
|
||||
# vb.memory = "1024"
|
||||
# end
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
end
|
76
tools/vagrant/bootstrap.sh
Executable file
76
tools/vagrant/bootstrap.sh
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# i386 binary support on x64 system
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install -y --no-install-recommends \
|
||||
libc6:i386 libstdc++6:i386 libncurses5:i386 libz1:i386
|
||||
|
||||
# Tools
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential doxygen git wget unzip python-serial \
|
||||
default-jdk ant srecord python-pip iputils-tracepath uncrustify python-magic
|
||||
sudo apt-get clean
|
||||
sudo python2 -m pip install intelhex
|
||||
|
||||
# Install ARM toolchain
|
||||
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
|
||||
tar xjf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -C /tmp/
|
||||
sudo cp -f -r /tmp/gcc-arm-none-eabi-5_2-2015q4/* /usr/local/
|
||||
rm -rf /tmp/gcc-arm-none-eabi-* gcc-arm-none-eabi-*-linux.tar.bz2
|
||||
|
||||
# Install msp430 toolchain
|
||||
wget http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2
|
||||
tar xjf mspgcc*.tar.bz2 -C /tmp/
|
||||
sudo cp -f -r /tmp/msp430/* /usr/local/
|
||||
rm -rf /tmp/msp430 mspgcc*.tar.bz2
|
||||
|
||||
# Install NXP toolchain (partial, with binaries excluded. Download from nxp.com)
|
||||
wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part1.tar.bz2
|
||||
wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part2.tar.bz2
|
||||
wget http://simonduq.github.io/resources/jn516x-sdk-4163-1416.tar.bz2
|
||||
mkdir -p /tmp/jn516x-sdk /tmp/ba-elf-gcc
|
||||
tar xjf jn516x-sdk-*.tar.bz2 -C /tmp/jn516x-sdk
|
||||
tar xjf ba-elf-gcc-*part1.tar.bz2 -C /tmp/ba-elf-gcc
|
||||
tar xjf ba-elf-gcc-*part2.tar.bz2 -C /tmp/ba-elf-gcc
|
||||
sudo cp -f -r /tmp/jn516x-sdk /usr/
|
||||
sudo cp -f -r /tmp/ba-elf-gcc /usr/
|
||||
rm -rf jn516x*.bz2 ba-elf-gcc*.bz2 /tmp/ba-elf-gcc* /tmp/jn516x-sdk*
|
||||
|
||||
echo 'export PATH="/usr/ba-elf-gcc/bin:${PATH}"' >> ${HOME}/.bashrc
|
||||
|
||||
## Install nRF52 SDK
|
||||
wget https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip
|
||||
sudo mkdir -p /usr/nrf52-sdk
|
||||
sudo unzip nrf5_iot_sdk_3288530.zip -d /usr/nrf52-sdk
|
||||
rm nrf5_iot_sdk_3288530.zip
|
||||
|
||||
echo "export NRF52_SDK_ROOT=/usr/nrf52-sdk" >> ${HOME}/.bashrc
|
||||
|
||||
sudo usermod -aG dialout vagrant
|
||||
|
||||
# Environment variables
|
||||
echo "export JAVA_HOME=/usr/lib/jvm/default-java" >> ${HOME}/.bashrc
|
||||
echo "export CONTIKI_NG=${HOME}/contiki-ng" >> ${HOME}/.bashrc
|
||||
echo "export COOJA=${CONTIKI_NG}/tools/cooja" >> ${HOME}/.bashrc
|
||||
echo "export PATH=${HOME}:${PATH}" >> ${HOME}/.bashrc
|
||||
echo "export WORKDIR=${HOME}" >> ${HOME}/.bashrc
|
||||
source ${HOME}/.bashrc
|
||||
|
||||
# Create Cooja shortcut
|
||||
echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && chmod +x ${HOME}/cooja
|
||||
|
||||
# Install coap-cli
|
||||
sudo apt-get install -y npm
|
||||
sudo apt-get clean
|
||||
sudo npm install coap-cli -g
|
||||
sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||
|
||||
# Docker
|
||||
curl -fsSL get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
sudo usermod -aG docker vagrant
|
||||
|
||||
# Docker image "Contiker" alias
|
||||
echo 'alias contiker="docker run --privileged --mount type=bind,source=$CONTIKI_NG,destination=/home/user/contiki-ng -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -ti simonduq/contiki-ng"' >> /home/vagrant/.bashrc
|
||||
source ${HOME}/.bashrc
|
Loading…
Reference in New Issue
Block a user