diff --git a/Tools/scripts/install-prereqs-ubuntu.sh b/Tools/scripts/install-prereqs-ubuntu.sh new file mode 100755 index 0000000000..5f4967362f --- /dev/null +++ b/Tools/scripts/install-prereqs-ubuntu.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +BASE_PKGS="gawk make git arduino-core curl" +SITL_PKGS="g++" +PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \ + autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \ + genromfs" +ASSUME_YES=false + +function maybe_prompt_user() { + if $ASSUME_YES; then + return 0 + else + read -p "$1" + if [[ $REPLY =~ ^[Yy]$ ]]; then + return 0 + else + return 1 + fi + fi +} + + +OPTIND=1 # Reset in case getopts has been used previously in the shell. +while getopts "y" opt; do + case "$opt" in + \?) + exit 1 + ;; + y) ASSUME_YES=true + ;; + esac +done + +if $ASSUME_YES; then + APT_GET="sudo apt-get --assume-yes" +else + APT_GET="sudo apt-get" +fi + +$APT_GET update +$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS + +if [ ! -d ~/PX4-Firmware ]; then + git clone git://github.com/PX4/Firmware.git ~/PX4-Firmware +fi + +if [ ! -d ~/gcc-arm-none-eabi-4_6-2012q2 ]; then + ARM_TARBALL=gcc-arm-none-eabi-4_6-2012q2-20120614.tar.bz2 + ( + cd ~; + curl -OL "https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q2-update/+download/$ARM_TARBALL"; + tar xjf ${ARM_TARBALL}; + rm ${ARM_TARBALL}; + ) +fi +exportline="export PATH=$HOME/gcc-arm-none-eabi-4_6-2012q2/bin:\$PATH"; +if ! grep -Fxq "$exportline" ~/.profile ; then + if maybe_prompt_user "Add $HOME/gcc-arm-none-eabi-4_6-2012q2/bin to your PATH [Y/n]?" ; then + echo $exportline >> ~/.profile + else + echo "Skipping adding $HOME/gcc-arm-none-eabi-4_6-2012q2/bin to PATH." + fi +fi diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000000..d694662266 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,15 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant::Config.run do |config| + config.vm.box = "ubuntu-12.04-32bit" + config.vm.box_url = "http://files.vagrantup.com/precise32.box" + + config.vm.share_folder("ardupilot", "~/ardupilot", ".") + + # Allow symlinks + config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/cross-compiler", "1"] + # Otherwise the compile will go into swap, making things slow + config.vm.customize ["modifyvm", :id, "--memory", "2048"] +end +