Skip to content

Instantly share code, notes, and snippets.

@jfro
Created May 15, 2015 21:19
Show Gist options
  • Save jfro/2937f23f6bd715042d99 to your computer and use it in GitHub Desktop.
Save jfro/2937f23f6bd715042d99 to your computer and use it in GitHub Desktop.
Raspberry Pi cross-compiling Vagrant VM
# -*- mode: ruby -*-
# vi: set ft=ruby fdl=99:
# 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/trusty64"
# 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.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.90.100"
config.vm.provider "virtualbox" do |vb|
vb.name = 'PiCompiler'
vb.memory = 2048
vb.cpus = 4
end
config.vm.provision "shell", args: [], inline: <<-EOS
set -e
# update and install software
sudo dpkg --add-architecture i386
apt-get update || true
apt-get -y upgrade
apt-get -y install git build-essential libc6:i386 libncurses5:i386 libstdc++6:i386
# Set up SSH
rm -f /root/.ssh/id_rsa # in case we're re-provisioning
ssh-keygen -t rsa -N '' -f /root/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
initctl reload-configuration
# download pi tools
git clone -q https://github.com/raspberrypi/tools.git /opt/pi-tools
echo "export PATH=/opt/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH" > /etc/profile.d/pi-tools.sh
echo "Pi tools downloaded to /opt/pi-tools & added to PATH"
EOS
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment