Created
January 29, 2014 16:45
-
-
Save samjoch/8691968 to your computer and use it in GitHub Desktop.
b2g vm
This file contains hidden or 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
#!/bin/bash | |
machine=$(VBoxManage list runningvms | cut -d "{" -f 2 | cut -d "}" -f 1) | |
phone=$(VBoxManage list usbhost | grep Captured -B10 | grep UUID | tr -d ' ' | cut -d ":" -f 2) | |
VBoxManage controlvm $machine usbdetach $phone |
This file contains hidden or 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
#!/bin/bash | |
/Library/StartupItems/VirtualBox/VirtualBox restart |
This file contains hidden or 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 : | |
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 mercurial tmux ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev libasound2 make zip android-tools-adb | |
ccache --max-size 15GB | |
# Set the permission filters to the right devices. | |
cat <<EOF >> /etc/udev/rules.d/android.rules | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="11ac", MODE="6565", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="1782", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="5d04", MODE="0666", GROUP="vagrant" | |
EOF | |
cat <<EOF >> /etc/udev/rules.d/51-android.rules | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="11ac", MODE="6565", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="1782", MODE="0666", GROUP="vagrant" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="5d04", 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 | |
# 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" | |
# For NFS | |
config.vm.network "private_network", ip: "192.168.50.42" | |
# Use B2G_PATH environment variable to sync with vm's /home/vagrant/B2G | |
# directory. | |
config.vm.synced_folder ".", "/home/vagrant/b2g", type: "nfs" | |
config.vm.provider "virtualbox" do |v| | |
# Enable 4GB of RAM | |
v.customize ["modifyvm", :id, "--memory", "4608"] | |
# Enable usb | |
v.customize ["modifyvm", :id, "--usb", "on"] | |
# Filter the devices | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x04e8', '--name', 'b2g1'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x19d2', '--name', 'b2g2'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x18d1', '--name', 'b2g3'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x11ac', '--name', 'b2g4'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x05c6', '--name', 'b2g5'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x1004', '--name', 'b2g6'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x1782', '--name', 'b2g7'] | |
v.customize ['usbfilter', 'add', '0', '--target', :id, '--vendorid', '0x5d04', '--name', 'b2g8'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment