Firefox OS/TCP/Patching

From MozillaWiki
< Firefox OS‎ | TCP(Redirected from FirefoxOS/TCP/Patching)
Jump to: navigation, search

Developing for the Tablet

The primary Firefox OS build documentation, including pre-requisites, set-up, building, flashing, and FAQs are all available at

This is meant to be a quick reference guide specific to the Tablet Contribution Program and the first tablet device which is named in the project as "flatfish".

Here's a great introductory slide deck on hacking Firefox OS.


The following instructions of this document are all verified on Ubuntu 12.04 & 12.10 and also Mac OS.

  1. Firefox OS (B2G) environment, including Android ADB and fastboot

    sudo apt-get install libxml2-utils

  2. Create an account in github

Gotcha: udev rules for Linux

When building on Linux, you may need to manually set up udev rules as noted in the above directions. Beware that the Flatfish appears to report different USB vendor IDs depending on whether it's already booted up or in the fastboot mode! You may need to add both of these udev rules to /etc/udev/rules.d/51-android.rules in order to do a full system flash:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

Download B2G and AOSP source codes of flatfish

  1. git clone b2g scripts and config files

    git clone git:// -b master b2g_flatfish

  2. configure flatfish and repo sync aosp and b2g source codes

    cd b2g_flatfish

    ./ flatfish

    You have to wait for a long while to download the source codes depending on the network bandwidth. The files will need approx. 11gb disc space.

Start to build flatfish

  1. Connect flatfish device for extract necessary files at first build

    The first build will pull necessary files into backup-flatfish which is automatic created by You DO NOT need to connect flatfish device if backup-flatfish is created.

  2. How to build all of B2G

    For flatfish, we need some prefix to support tablet distribution and enable some functions. GAIA_DEVICE_TYPE=tablet is used for supporting tablet distribution of gaia (older versions used GAIA_DISTRIBUTION_DIR=distribution_tablet instead). B2G_SYSTEM_APPS=1 is for moving webapp from /data to /system, and B2G_UPDATER=1 is enable OTA.


    Building whole system might take a long time, you can take a rest or try to build gecko/gaia if you just modify gecko/gaia.

  3. How to build Gecko or Gaia only

    Gecko only

    B2G_UPDATER=1 ./ gecko

    Gaia only

    GAIA_DEVICE_TYPE=tablet B2G_SYSTEM_APPS=1 ./ gaia

Flash the images you build

Please make sure adb can connect to your device successfully before flash images. You can do a simple test to check adb connection; you will see something like “FLATFISH_123456 device” after typing “adb devices” if adb connection successfully.

  1. Flash whole images


  2. Flash gecko only

    ./ gecko

  3. Flash gaia only

    ./ gaia

Flashing problems

If you have problems with the flashing process failing with timeout errors try disabling any USB 3.0 controllers in the BIOS

If your tablet becomes bricked, please follow the steps in Repairing a bricked device to reflash your device.

If you need the driver for your Windows computer, see this Jing for instructions.

Subsequent code pulls

To update all the code:

git pull

./repo sync -d

Or to sync only a single make target:

./repo sync gaia

Contributing your code

You can either submit a GitHub pull request or file a bug in Bugzilla with a patch. However, you should almost certainly first discuss it with the B2G or Gaia teams. See the MDN documentation on contributing to Gaia.

WIP bug list

Bug 965145 - [Camera] refactor .sensorAngle patch in bug 947956 for new camera app


To be continued