During my on-boarding on Firefox OS team I kept a draft of all necessary stuff that need to be done in order to build the project and flash it to the phone. I’m pretty sure it can help people on-boarding the project by having a single page that would allow anyone to start working on Firefox OS. I highly suggest you to take a look at MDN Firefox OS documentation if you visit this page later on, as this blogpost will most likely be outdated in some weeks.
Use a Virtual Machine
I’m suggesting everyone to use a VM. It allows you to use exactly same environment, in order to maximize your chances to succeed building Firefox OS! Using another OS, another linux distro or even another Ubuntu version will introduce differences in dependencies versions and can easily give you errors no one but you are facing :(
You can use VMware Player which is free and available here, or any other VM software you are confortable with that has decent USB support (required to flash the phone).
Use Ubuntu 11.10
For the same reason than the VM, I suggest you to use the recommended linux distro and version You can download this Ubuntu 11.10 x64 ISO image and create a VM out of it (It is super easy with VMware, it almost does everything for you). The only important things are to set a large enough virtual drive, 30GB is a safe minimum, and enough memory, 4GB is a safe minimum.
Now open a terminal and launch all following commands in order to install all necessary dependencies.
Install build dependencies:
Java JDK 6 needed for adb
1 2 3 4
Android SDK in order install adb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Tweak udev in order to recognize your phone
If you do not do that at all, or not properly,
$ adb devices will print this:
You need to put the following content into
1 2 3 4 5
Here I register only internal Mozilla phones otoro and unagi IDs. You may want to add lines for other phones. See this webpage for other vendor IDs.
Checkout all necessary projects
Checkout B2G repository
Take a minute to configure git, otherwise next steps will keep bugging you asking for your name and email.
1 2 3 4 5 6 7
Connect your phone and ensure it is visible from your VM.
In order to do so run
adb devices, you should see non-empty list of devices.
1 2 3
If you see
no permissions message, checkout udev step.
Note that you have to setup your Virtual machine software to connect the USB port to the VM. In VMware player, click on:
Player menu > Removable devices > "...something..." Android > Connect (Disconnnect from host).
Checkout all dependencies necessary for your particular phone
Before running the following command, ensure that your phone is connected.
Note that you have to run this command with your phone still being on Android OS and ICS version. If your phone is already on B2G, you will have to retrieve the backup-otoro or backup-unagi folder automatically created when running the following command.
If your device is on an Android version older than ICS, you will have to flash it first to ICS. For both of these issues, ask in #b2g for help. This step will take a while, as it will download tons of big projects: android, gong, kernel, mozilla-central, gaia,… More than 4GB of git repositories, so be patient.
1 2 3
Install Qualcomm Areno graphic driver
Only if you are aiming to build Firefox OS for otoro or unagi phones,
you will have to manually download Qualcomm areno armv7 graphic driver, available here.
Unfortunately, you will have to register to this website in order to be able to download this file. Once downloaded, put this
Adreno200-AU_LINUX_ANDROID_ICS_CHOCO_CS.04.00.03.06.001.zip into your
Build Firefox OS
If ./config.sh went fine, you can now build Firefox OS!
Here is the possible error you might see:
arm-linux-androideabi-g++: Internal error: Killed (program cc1plus)
You are most likely lacking of memory. 4GB is a safe minimum.
KeyedVector.h:193:31: error: indexOfKey was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
Your gcc version is too recent. Try using gcc 4.6.x version.
Flash the phone
If ./build.sh went fine, you can now flash your phone:
Note that I have to unplug replug the device in order to make it work in the VM.
When running ./flash.sh, the unagi phone switch to a blue screen, then ./flash.sh script is stuck on
< waiting device > message. If I unplug and plug in back, it immediately starts flashing. Be carefull if you have to do the same, ensure that ./flash.sh doesn’t start flashing when you unplug it!
If ./flash.sh failed by saying that the image is too large, It might mean that you have to root your phone first. Again, ask in #b2g for help.