Version: 0.4
FirefoxOS Build Environment in a VM (Virtual Machine). Powered by vagrant and virtualbox.
- Edit source code in your host machine with any editor and have the files sync into the guest machine.
- Compile in VM without setup environment and required libraries
- Can test Firefox Nightly or B2G Desktop in bundled GUI environment
You have to download and install Virtualbox & Vagrant before you start using foxbox.
Prepare:
Download or Clone https://github.com/gasolin/foxbox.git via git clone
command to local computer (we call it Host OS). Then enter the foxbox folder:
$ git clone https://github.com/gasolin/foxbox.git
$ cd foxbox
On linux or mac, run configure.sh
. The script will download B2G repository to your Host OS and start vagrant to setup VM for you.
On other platform, start the setup process
$ B2G_PATH=<local path> vagrant up
You have to enter password in Linux/Mac to proceed share the NFS folders.
It will take time to download and setup the environment. Go have a cup of coffee.
(If foxbox is stablized, we'd like to ship a preconfigured box to save your time and bandwidth)
Connect to VM
$ B2G_PATH=<local path> vagrant up
In linux/mac you could use ${PWD}/B2G
instead of real <local path>
.
Log in with the account 'vagrant', password 'vagrant'
in VM's console.
Disconnect to VM
$ exit
$ vagrant halt
Though the VM already popup a separate window. You can still remote access to VM via command:
$ vagrant ssh
Connect to VM via command
$ B2G_PATH=<local path> vagrant up
Then FoxBox provide an init script to help you fetch B2G source:
$ ./init_B2G.sh
Then go to B2G folder and type
$ cd B2G
$ ./configure.sh {your device}
$ ./build.sh
refer to https://developer.mozilla.org/en-US/Firefox_OS/Preparing_for_your_first_B2G_build
Basically the above instruction can build all FirefoxOS for you including gecko and gaia. But you could build gaia or gecko independently to debug specific part of FirefoxOS.
Connect to VM via command
$ GAIA_PATH=<local path> vagrant up
Then FoxBox provide an init script to help you fetch gaia source:
$ ./init_gaia.sh
Then go to gaia folder and type
$ cd gaia
$ make DEBUG=1
refer to https://developer.mozilla.org/en-US/Firefox_OS/Platform/Gaia/Hacking
Connect to VM via command
$ GECKO_PATH=<local path> vagrant up
Then
$ cd gecko
$ make -f client.mk build
To test Firefox OS, you'll need the graphical display of VM. ssh does not support GUI. Run the command To start the GUI (powered by xfce):
$ ./gui.sh
The firefox nightly
is located in the top left Applications Menu > internet > Nightly Web Browser
.
If you found no prompt in Terminal Emulator. The reason is a color setting found in Edit->Profile Preferences where it said "Colors" and defaulted to "Use colors from system theme". Uncheck it and everything runs fine.
You can run following command to delete the VM anytime.
$ B2G_PATH=<local path> vagrant destroy
The shared folders will be detached and the VM will be deleted. The basic vagrant box and the fetched source code will still exist so you don't have to fetch again.
If there's any issue that make the setup process fail. You can rerun the configure process by following command:
$ B2G_PATH=${PWD}/B2G vagrant reload --provision
According to StackOverflow, invoking following command did the trick:
$ repo sync -f -j10
As it seems -f
or --force-broken
flag allows it to recover from network error and more important recover on broken/missing objects.
- enable developer jump into B2G development without pain
- enable developer jump into gaia development without pain
- Utils
- backup/restore tool by dietrich
- easy switch between versions
- ship a preconfigured box with b2g source
- l10n and keyboard layout settings
- customization
- able to compile all Firefox projects (for those can be done in linux)
- Firefox Desktop
- Firefox for Android
Foxbox is based on the gist by Yura Zenevich.
FoxBox follow MPL 2.0 License.