Firefox OS

From Gentoo Wiki
Jump to:navigation Jump to:search
This article has been flagged for not conforming to the wiki guidelines. Please help Gentoo out by starting fixing things.
Mozilla has stopped development of Firefox OS in September 2016. Gentoo has changed since then and the information below might be out of date

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



  • 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.


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


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

FILE /etc/portage/sets/firefox_os@firefox_os set
# see

You also need the 32bit versions of ncurses and zlib.

FILE /etc/portage/package.use/firefox_os
sys-libs/ncurses abi_x86_32
sys-libs/zlib abi_x86_32
root #emerge --ask @firefox_os


You won't be able to backup or flash your phone via USB if adb/fastboot is not working.

Test adb

Check if adb detects your phone

user $adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
roamer2 device

Udev rule

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

FILE /etc/udev/rules.d/firefox_os.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", ATTR{idProduct}=="1351", MODE="0666", GROUP="plugdev"
replace 19d2 and 1351 (ZTE Open) by the values of your phone, they can be obtained with lsusb, also make sure your user is in the plugdev group
root #/etc/init.d/udev restart
root #adb kill-server

Then retry to detect the phone.

Backing up your data

user $mkdir backup
user $adb pull /system backup/system
user $adb pull /data backup/data
user $# Some phones also have a /vendor
user $adb pull /vendor backup/vendor

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.

Building Firefox OS

Find the 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.


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

user $mkdir /tmp/ffos_bin
user $ln -s `which python2` /tmp/ffos_bin/python
user $export PATH="/tmp/ffos_bin:${PATH}"
You could also set python2 as your default interpreter with eselect python, but this may cause problems with other python programs)


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.

user $export ANDROIDFS_DIR="${PWD}/backup"

Fetching the sources

user $cd B2G
user $BRANCH=v1.4 ./ inari
Replace v1.4 by the version you want, and inari by the codename of your phone (inari = ZTE Open)

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


user $./

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


user $./

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