diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 02b5effea6..dde5b7e1b6 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -142,6 +142,7 @@ check_not_exporting_variables() { # only place that should export common variables pathspec+=('*') pathspec+=(':!makefiles/vars.inc.mk') + pathspec+=(':!**/Vagrantfile') patterns=() for variable in "${EXPORTED_VARIABLES_ONLY_IN_VARS[@]}"; do diff --git a/dist/tools/vagrant/freebsd/README.md b/dist/tools/vagrant/freebsd/README.md new file mode 100644 index 0000000000..77965413b5 --- /dev/null +++ b/dist/tools/vagrant/freebsd/README.md @@ -0,0 +1,70 @@ +# RIOT FreeBSD VM + +## About +This provides a [Vagrantfile] to compile and test the RIOT [`native`][native] +platform on FreeBSD stable (12.1). + +## Requirements +Make sure your system satisfies the latest version of all following dependencies: +* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) +* [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) +* [Vagrant](https://www.vagrantup.com/downloads.html) + +## General usage +The following commands must be run from this directory on the host system + +``` +vagrant plugin install vagrant-disksize # for big enough disk +vagrant up +vagrant provision # depending on the vagrant version this might alreardy be + # executed with vagrant up +``` +This will start up and set-up the virtual machine. +``` +vagrant ssh +``` +This logs you into the VM as vagrant user. + +See the general vagrant [README.md](../README.md) for more commands. + +## Inside the VM +Once logged in to the VM you can run compile and run tests e.g. + +```sh +make -C tests/shell all -j +make -C tests/shell test +``` + +Even applications requiring network interface access should be able to work: + +```sh +sudo dist/tools/tapsetup/tapsetup +make -C examples/gnrc_networking all -j16 +make -C examples/gnrc_networking term +``` + +``` +> ifconfig +ifconfig +Iface 6 HWaddr: F1:28:23:23:F1:28 + L2-PDU:1500 MTU:1500 HL:64 RTR + RTR_ADV + Source address length: 6 + Link type: wired + inet6 addr: fe80::f328:23ff:fe23:f128 scope: link TNT[1] + inet6 group: ff02::2 + inet6 group: ff02::1 + inet6 group: ff02::1:ff23:f128 + + Statistics for Layer 2 + RX packets 5 bytes 738 + TX packets 2 (Multicast: 2) bytes 78 + TX succeeded 2 errors 0 + Statistics for IPv6 + RX packets 4 bytes 340 + TX packets 2 (Multicast: 2) bytes 128 + TX succeeded 2 errors 0 +``` + +[Vagrantfile]: ./Vagrantfile +[native]: https://doc.riot-os.org/group__boards__native.html diff --git a/dist/tools/vagrant/freebsd/Vagrantfile b/dist/tools/vagrant/freebsd/Vagrantfile new file mode 100644 index 0000000000..8b50b93f1e --- /dev/null +++ b/dist/tools/vagrant/freebsd/Vagrantfile @@ -0,0 +1,38 @@ +$init_riot = <<-INIT_RIOT + # vim for xxd + pkg install -y bash git gmake gcc cmake afl afl++ \ + python3 py37-pip py37-scipy py37-pycrypto py37-cython py37-scapy \ + vim + chsh -s /usr/local/bin/bash vagrant + if ! [ -d /home/vagrant/RIOT ]; then + git clone --recurse-submodules https://github.com/RIOT-OS/RIOT /home/vagrant/RIOT + fi + chown -R vagrant: /home/vagrant/RIOT + curl https://raw.githubusercontent.com/RIOT-OS/riotdocker/master/requirements.txt \ + > /tmp/requirements.txt + su - vagrant -c "pip install --user -r /tmp/requirements.txt" + # install most current pexpect to prevent async bug + su - vagrant -c "pip install --upgrade --user pexpect" + grep -q "export MAKE=gmake" /home/vagrant/.profile || \ + echo "export MAKE=gmake" >> /home/vagrant/.profile + grep -q "export LINK=gcc" /home/vagrant/.profile || \ + echo "export LINK=gcc" >> /home/vagrant/.profile + grep -q "export CC=gcc" /home/vagrant/.profile || \ + echo "export CC=gcc" >> /home/vagrant/.profile + grep -q 'export PATH=/home/vagrant/.local/bin:${PATH}' /home/vagrant/.profile || \ + echo 'export PATH=/home/vagrant/.local/bin:${PATH}' >> /home/vagrant/.profile + # make gmake default make + if ! [ -h /home/vagrant/.local/bin/make ]; then + # might not be a symlink, so remove + rm -f /home/vagrant/.local/bin/make + su - vagrant -c 'ln -s /usr/local/bin/gmake /home/vagrant/.local/bin/make' + fi +INIT_RIOT + +Vagrant.configure("2") do |config| + config.vm.define "RIOT-FreeBSD" + config.vm.box = "freebsd/FreeBSD-12.1-STABLE" + config.disksize.size = '50GB' + config.vm.provision "shell", + inline: $init_riot +end