Firefox OS

This page details how to build Firefox OS and flash it on your phone. Note that Firefox OS is not the Firefox web browser.

Phone

 * Obviously, you will need a smartphone supported by Firefox OS, see the list here.
 * fastboot must be enabled, you may need to unlock the bootloader for that. This is out of the scope of this document.

Computer

 * 64bit Gentoo with a multilib profile
 * 4GB of RAM
 * 30GB of disk space (sources alone take 14GB)

Packages
Quite a few packages are required, so we might as well create a set.

You also need the 32bit versions of ncurses and zlib

Test adb
Check if adb detects your phone

Udev rule
If your phone is not detected, you may need a new udev rule

Then retry to detect your phone

Backing up your data
This backup can be used later to build Firefox OS because some non-free files are not included in the sources and must be extracted from a backup (or the phone directly)

Alternatively you can use this script to backup and restore user data.

Find your phone's codename
See this table.

Choose a Firefox OS version
The list of versions available can be seen here. As of this writing, v2.2 is the lastest stable version but you can build any version you want.

Python
The script fetching the sources uses python, unfortunatly it only works with python2, if your default python interpreter is python3, you will need this small hack

GCC
Old versions of Firefox OS require GCC 4.6, the current master can be built with any modern version. See this MDN page for information on how to use older compilers if you need to build an older version.

Non-free files
To build Firefox OS you need some non-free files only present on the phone (or backups of the phone). If you did a backup, you can use it for the build by setting ANDROIDFS_DIR, otherwise you need to connect your phone via USB while building.

Fetching the sources
The last command will start fetching the sources, this will take a very long time, possibly hours since it basically downloads 14GB of data.

Build
Building takes quite some time and displays a lot of warnings.

Flashing
If all goes well, your phone should reboot on the new version of Firefox OS