Last active
August 29, 2015 13:59
-
-
Save kamituel/10551317 to your computer and use it in GitHub Desktop.
Vagrant file for Firefox OS builds. Based on yzen work (https://gist.github.com/yzen/7723421), but updated with missing packages, X support and instructions how to workaround Mac OS filesystem's case insensitivity.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# To use this script and prepare your build environment, run the following | |
# command in the same directory as the Vagrantfile. | |
# B2G_PATH={path to your B2G directory} vagrant up | |
# NFS file system is case insensitive. This will make B2G build to fail. | |
# To avoid this: | |
# (host-mac): hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage | |
# (host-mac): open ~/firefoxos.sparseimage | |
# (host-mac): diskutil info /Volumes/firefoxos | |
# (host-mac): sudo vifs # edit fstab | |
# UUID=myPartitionsUUID /vagrant/shared/dir hfs rw,auto | |
# (host-mac): open ~/firefoxos.sparseimage | |
VAGRANTFILE_API_VERSION = "2" | |
# This script will be run on the first start and it will set up the build | |
# environment. | |
# All you need to do afterwards is: | |
# * vagrant ssh | |
# * Unplug/Plug the phone; run adb devices to make sure that the phone is | |
# listed. | |
# * cd B2G | |
# * ./configure.sh {your device} | |
# * ./build.sh | |
$bootstrap = <<SCRIPT | |
# Installing all build prerequisites. | |
apt-get update | |
apt-get install -y python-software-properties | |
add-apt-repository -y ppa:nilarimogard/webupd8 | |
apt-get update | |
apt-get install -y autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev libasound2 make zip android-tools-adb libxml2-utils python-setuptools xinit fluxbox firefox | |
# Set ccache max size to 3GB | |
ccache --max-size 3GB | |
# Set the permission filters to the right devices. | |
cat <<EOF >> /etc/udev/rules.d/android.rules | |
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="vagrant" | |
EOF | |
cat <<EOF >> /etc/udev/rules.d/51-android.rules | |
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="vagrant" | |
EOF | |
chmod a+r /etc/udev/rules.d/android.rules | |
chmod a+r /etc/udev/rules.d/51-android.rules | |
service udev restart | |
echo "exec fluxbox" > /home/vagrant/.xinitrc | |
chmod a+rw /home/vagrant/.xinitrc | |
# Node.js required by Gaia unit tests | |
cd /usr/local | |
curl -O http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz | |
tar --strip-components 1 -xzf node-v0.10.26-linux-x64.tar.gz | |
cd - | |
# Not sure if it's necessary but the build complaints about the Java version. | |
apt-get purge -y openjdk* | |
add-apt-repository -y ppa:webupd8team/java | |
apt-get update | |
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections | |
apt-get install -y oracle-java7-installer | |
SCRIPT | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "precise64" | |
# Run the bootsrap script on start. | |
config.vm.provision "shell", inline: $bootstrap | |
# Use ubuntu 12.04 | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
# Assign static IP to be able to use nfs option (if you have a conflict, | |
# change it to something else). | |
config.vm.network "private_network", ip: "192.168.50.4" | |
config.vm.network :forwarded_port, host: 6000, guest: 8080 | |
# Use B2G_PATH environment variable to sync with vm's /home/vagrant/B2G | |
# directory. | |
config.vm.synced_folder ENV['B2G_PATH'], "/home/vagrant/B2G", nfs: true | |
config.vm.provider "virtualbox" do |v| | |
# GUI | |
v.gui = true | |
# RAM and CPU settings | |
v.customize ["modifyvm", :id, "--memory", "10000"] | |
v.customize ["modifyvm", :id, "--cpus", "3"] | |
# Enable usb | |
v.customize ["modifyvm", :id, "--usb", "on"] | |
# Filter the following devices: inari, keon, android | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'inari', '--vendorid', '0x19d2'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'full_keon', '--vendorid', '0x05c6'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'android', '--vendorid', '0x18d1'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment