mirror of https://github.com/ArduPilot/ardupilot
Tools: Vagrant: use install-prereqs-ubuntu for installation
This commit is contained in:
parent
793f50808d
commit
0a7ae22398
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
rm -rf jsbsim
|
||||
git clone https://github.com/tridge/jsbsim.git
|
||||
cd jsbsim
|
||||
./autogen.sh
|
||||
make -j2
|
|
@ -11,6 +11,7 @@ PX4_PKGS="python-argparse openocd flex bison libncurses5-dev \
|
|||
ARM_LINUX_PKGS="g++-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf"
|
||||
SITL_PKGS="libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing realpath"
|
||||
ASSUME_YES=false
|
||||
QUIET=false
|
||||
|
||||
UBUNTU_YEAR="15" # Ubuntu Year were changes append
|
||||
UBUNTU_MONTH="10" # Ubuntu Month were changes append
|
||||
|
@ -65,13 +66,17 @@ while getopts "y" opt; do
|
|||
;;
|
||||
y) ASSUME_YES=true
|
||||
;;
|
||||
q) QUIET=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
APT_GET="sudo apt-get"
|
||||
if $ASSUME_YES; then
|
||||
APT_GET="sudo apt-get -qq --assume-yes"
|
||||
else
|
||||
APT_GET="sudo apt-get"
|
||||
APT_GET="$APT_GET --assume-yes"
|
||||
fi
|
||||
if $QUIET; then
|
||||
APT_GET="$APT_GET -qq"
|
||||
fi
|
||||
|
||||
# possibly grab a newer cmake for older ubuntu releases
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
# this script is run by the root user in the virtual machine
|
||||
|
||||
set -e
|
||||
set -x
|
||||
set -u
|
||||
|
||||
echo "Initial setup of SITL-vagrant instance."
|
||||
|
||||
/vagrant/Tools/scripts/install-prereqs-ubuntu.sh -y
|
||||
|
||||
# extra packages we desire on the VM but aren't prereqs for AP compilation:
|
||||
sudo apt-get install -y valgrind gdb
|
||||
|
||||
VAGRANT_USER=vagrant
|
||||
|
||||
PROFILE_TEXT="
|
||||
source /vagrant/Tools/vagrant/shellinit.sh
|
||||
# This allows the PX4NuttX build to proceed when the underlying fs is on windows
|
||||
# It is only marginally less efficient on Linux
|
||||
export PX4_WINTOOL=y
|
||||
export PATH=\$PATH:\$HOME/jsbsim/src
|
||||
export BUILDLOGS=/tmp/buildlogs
|
||||
"
|
||||
|
||||
DOT_PROFILE=/home/$VAGRANT_USER/.profile
|
||||
|
||||
echo "$PROFILE_TEXT" | sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$DOT_PROFILE
|
||||
sudo -u $VAGRANT_USER ln -fs /vagrant/Tools/vagrant/screenrc /home/$VAGRANT_USER/.screenrc
|
||||
|
||||
# build JSB sim
|
||||
sudo -u $VAGRANT_USER /vagrant/Tools/scripts/install-jsbsim.sh /home/$VAGRANT_USER
|
||||
|
||||
#Plant a marker for sim_vehicle that we're inside a vagrant box
|
||||
touch /ardupilot.vagrant
|
||||
|
||||
# Now you can run
|
||||
# vagrant ssh -c "screen -d -R"
|
|
@ -7,85 +7,40 @@ set -x
|
|||
|
||||
echo "Initial setup of SITL-vagrant instance."
|
||||
|
||||
BASE_PKGS="gawk make git arduino-core curl"
|
||||
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk3.0 python-scipy python-opencv python-numpy python-empy python-pyparsing ccache"
|
||||
PYTHON_PKGS="pymavlink MAVProxy droneapi future pexpect"
|
||||
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
|
||||
autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
|
||||
zip genromfs cmake"
|
||||
UBUNTU64_PKGS="libc6:i386 libgcc1:i386 gcc-4.9-base:i386 libstdc++5:i386 libstdc++6:i386"
|
||||
|
||||
# GNU Tools for ARM Embedded Processors
|
||||
# (see https://launchpad.net/gcc-arm-embedded/)
|
||||
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
|
||||
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
|
||||
ARM_TARBALL_URL="http://firmware.ardupilot.org/Tools/PX4-tools/$ARM_TARBALL"
|
||||
ARM_HF_PKGS="g++-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf"
|
||||
|
||||
# Ardupilot Tools
|
||||
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
||||
|
||||
VAGRANT_USER=ubuntu
|
||||
if [ -e /home/vagrant ]; then
|
||||
# prefer vagrant user
|
||||
VAGRANT_USER=vagrant
|
||||
fi
|
||||
|
||||
# artful rootfs is 2GB without resize:
|
||||
sudo resize2fs /dev/sda1
|
||||
|
||||
usermod -a -G dialout $VAGRANT_USER
|
||||
|
||||
apt-get -y remove modemmanager
|
||||
apt-get -y update
|
||||
apt-get -y install dos2unix g++-4.7 ccache python-lxml screen xterm gdb pkgconf
|
||||
apt-get -y install $BASE_PKGS $SITL_PKGS $PX4_PKGS $UBUNTU64_PKGS $ARM_HF_PKGS
|
||||
pip -q install $PYTHON_PKGS
|
||||
easy_install catkin_pkg
|
||||
/vagrant/Tools/scripts/install-prereqs-ubuntu.sh -y
|
||||
|
||||
# run-in-terminal-window uses xterm:
|
||||
apt-get install -y xterm
|
||||
|
||||
# valgrind support:
|
||||
apt-get install -y valgrind
|
||||
|
||||
# gdb support:
|
||||
apt-get install -y gdb
|
||||
|
||||
|
||||
# ARM toolchain
|
||||
if [ ! -d /opt/$ARM_ROOT ]; then
|
||||
(
|
||||
sudo -u $VAGRANT_USER wget -nv $ARM_TARBALL_URL
|
||||
pushd /opt
|
||||
tar xjf ${OLDPWD}/${ARM_TARBALL}
|
||||
popd
|
||||
rm ${ARM_TARBALL}
|
||||
)
|
||||
fi
|
||||
|
||||
exportline="export PATH=/opt/$ARM_ROOT/bin:\$PATH"
|
||||
DOT_PROFILE=/home/$VAGRANT_USER/.profile
|
||||
PROFILE_TEXT=""
|
||||
if grep -Fxq "$exportline" $DOT_PROFILE; then
|
||||
echo nothing to do
|
||||
else
|
||||
PROFILE_TEXT="
|
||||
$PROFILE_TEXT
|
||||
$exportline
|
||||
"
|
||||
fi
|
||||
|
||||
PROFILE_TEXT="
|
||||
$PROFILE_TEXT
|
||||
source /vagrant/Tools/vagrant/shellinit.sh
|
||||
# This allows the PX4NuttX build to proceed when the underlying fs is on windows
|
||||
# It is only marginally less efficient on Linux
|
||||
export PX4_WINTOOL=y
|
||||
export PATH=\$PATH:\$HOME/jsbsim/src
|
||||
export BUILDLOGS=/tmp/buildlogs
|
||||
"
|
||||
|
||||
echo "$PROFILE_TEXT" | sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$DOT_PROFILE
|
||||
sudo -u $VAGRANT_USER ln -fs /vagrant/Tools/vagrant/screenrc /home/$VAGRANT_USER/.screenrc
|
||||
|
||||
# build JSB sim
|
||||
apt-get install -y libtool libtool-bin automake autoconf libexpat1-dev
|
||||
sudo -u $VAGRANT_USER -H bash <<"EOF"
|
||||
set -e
|
||||
set -x
|
||||
apt-get install -y libtool automake autoconf libexpat1-dev
|
||||
# libtool-bin
|
||||
sudo --login -u $VAGRANT_USER /vagrant/Tools/scripts/build-jsbsim.sh
|
||||
|
||||
cd
|
||||
rm -rf jsbsim
|
||||
git clone https://github.com/tridge/jsbsim.git
|
||||
cd jsbsim
|
||||
./autogen.sh
|
||||
make -j2
|
||||
EOF
|
||||
# adjust environment for every login shell:
|
||||
DOT_PROFILE=/home/$VAGRANT_USER/.profile
|
||||
echo "source /vagrant/Tools/vagrant/shellinit.sh" |
|
||||
sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$DOT_PROFILE
|
||||
|
||||
#Plant a marker for sim_vehicle that we're inside a vagrant box
|
||||
touch /ardupilot.vagrant
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Init that is run every time a new session starts up
|
||||
|
||||
# This allows the PX4NuttX build to proceed when the underlying fs is on windows
|
||||
# It is only marginally less efficient on Linux
|
||||
export PX4_WINTOOL=y
|
||||
export PATH=$PATH:$HOME/jsbsim/src
|
||||
export BUILDLOGS=/tmp/buildlogs
|
||||
|
||||
export APMROOT=/vagrant
|
||||
export PATH=$APMROOT/Tools/autotest:$PATH
|
||||
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Testing an ArduPilot VM:
|
||||
# sim_vehicle.py # in the starting directory should start a Copter simulation
|
||||
# xterm # X11 forwarding should work
|
||||
# sim_vehicle.py --debug --gdb
|
||||
# sim_vehicle.py --valgrind
|
||||
# cd /vagrant && ./waf configure --board=px4-v2 && ./waf build --target=bin/ardusub
|
||||
# cd /vagrant ./waf configure --board=navio2 && ./waf build --target=bin/arduplane
|
||||
# cd /vagrant ./Tools/autotest/sim_vehicle.py -v ArduPlane # should test JSBSim
|
||||
# cd /vagrant ./Tools/autotest/autotest.py build.APMrover2 drive.APMrover2
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
config.vm.box = "ubuntu/zesty32"
|
||||
# push.app = "geeksville/ardupilot-sitl"
|
||||
|
||||
# The following forwarding is not necessary (or possible), because our sim_vehicle.py is smart enough to send packets
|
||||
# out to the containing OS
|
||||
# config.vm.network "forwarded_port", guest: 14550, host: 14550, protocol: "udp"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
|
@ -39,6 +44,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||
# If you are on windows then you must use a version of git >= 1.8.x to update the submodules
|
||||
# in order to build. Older versions of git use absolute paths for submodules which confuses things.
|
||||
|
||||
config.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
|
||||
config.vm.define "devenv", primary: true do |devenv|
|
||||
config.vm.box = "ubuntu/zesty32"
|
||||
config.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
|
||||
end
|
||||
|
||||
config.vm.define "trusty64" do |trusty64|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.provision "trusty64", type: "shell", path: "Tools/vagrant/initvagrant.sh"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue