Boot to Gecko aims to create a complete, standalone operating system for the open web.
Shell Python Ruby Makefile
Latest commit 40aa1a6 Jul 17, 2016 @lissyx lissyx committed on GitHub Merge pull request #514 from Bonstra/master
Bug 1287331: Add openc-fr and openc-ebay devices r=gerard-majax
Failed to load latest commit information.
scripts Bug 1208261 - Update bootstrap_mac to include Mac OSX SDK 10.11 Sep 24, 2015
tools Bug 1213538 - Ensure system partition is mounted before device compat… Oct 10, 2015
.gitignore Bug 1146713 - Mochitest downloads b2g_sdk by itself Oct 8, 2015
GNUmakefile Now produces an error if you run make without sourcing May 7, 2012
LICENSE Add LICENSE Jul 12, 2012 Bug 1105812 - Allow the user to override GDB_PORT by setting it in th… Sep 15, 2015 Add new B2G build system May 5, 2012 Bug 1164365 - Prompt user to run ./ snod for emulator builds May 27, 2015 Bug 1287331: Add openc-fr and openc-ebay devices r=gerard-majax Jul 17, 2016 Bug 934671 - Add to make it easier to modify preference… Nov 4, 2013 Bug 1287331: Add openc-fr and openc-ebay devices r=gerard-majax Jul 17, 2016 Optionally source $DEVICE_DIR/ for per-device flashing commands. Sep 21, 2014
mach Bug 867817 - Add mach bootstrap to B2G, r=jgriffin Sep 4, 2013 Bug 935840 - Add b2g script r=jld Nov 7, 2013 Bug 1184949 - Allow profiling thread names with spaces. Jul 23, 2015
repo Bug 1245480 - Update repo to version 1.22 r=mwu Feb 3, 2016 Bug 1182005 - Enable to connect to GDB server on B2G via TCP. r=mwu Aug 21, 2015 Add support to allow using ddd. Aug 24, 2012 Bug 1163476 - Add option to set dns servers for the emulator. r=tdz Oct 12, 2015 Bug 1256527 - Use x86_64-targeted gdb when debugging on the Nexus Player Mar 15, 2016 Bug 1170776 - Update script Jun 11, 2015 include flame in the full flash Apr 15, 2014 Bug 912756 - Remove redundant Marionette script, r=ahal Oct 24, 2013 Replace Python hack to continuously display procrank info with much s… Oct 18, 2012

Boot to Gecko (B2G)

Boot to Gecko aims to create a complete, standalone operating system for the open web.

You can read more about B2G here:

follow us on twitter: @Boot2Gecko

join the Mozilla Platform mailing list:

and talk to us on IRC:

#B2G on



  • A 64 bit linux distro
  • 20GB of free disk space
  • autoconf-2.13
  • git
  • ccache
  • gcc/g++ 4.6.3 or older
  • bison
  • flex
  • 32bit ncurses
  • zlib
    • You need both zlib1g and zlib1g-dev for both i386 and amd64. That is, for Ubuntu 12.04 Precise or older, they are zlib1g, zlib1g-dev, zlib1g:i386, and zlib1g-dev:i386; for Ubuntu 12.10 Quantal or newer, they are zlib1g:amd64, zlib1g-dev:amd64, zlib1g:i386, and zlib1g-dev:i386.
  • make

Additionally, if you're building the emulator, you probably need the the Mesa implementation of OpenGL. On Ubuntu, this is the libgl1-mesa-dev package.

Ubuntu 12.10 ships with gcc 4.7 by default, which causes build errors pretty early in the process. To use gcc 4.6, edit .userconfig and add

export CC=gcc-4.6
export CXX=g++-4.6

Of course, you'll need the g++-4.6 package installed.

On Ubuntu 13.04, for example, you might find apt-get install zlib1g{,-dev}:i386 is going to do something seriously wrong like removing all your toolchain packages. You may execute either apt-get install --no-install-recommends <packages> to explicitly disallow installing recommended packages, or aptitude to interactively select the very necessary packages you need.

For full lists of minimum required packages that build B2G emulator on all recent Ubuntu releases, see .


Note: Builds for some devices require case-sensitive file systems

Some B2G subrepositories contain files whose names differ only in case. This causes build failures when building for some target phones (such as the Hamachi) if you're on a case-insensitive FS (the default on Mac). You'll see an error like the following during the ./ step:

[entering kernel] ERROR: You have uncommited changes in kernel You may force overwriting these changes with |source build/ force|

ERROR: Patching of kernel/ failed.

If you hit this error, the easiest way around it is to build on a case-sensitive file-system. Doing so doesn't require any re-partitioning; you can simply create a disk image and build within it using the following commands.

hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage
open ~/firefoxos.sparseimage
cd /Volumes/firefoxos/

See for details.

Note: Linker OOM with noopt builds

If you build with B2G_NOOPT=1 on MacOS, your linker may run out of memory and crash.

The solution, if you really want a noopt build, is to use a 64-bit linker. Follow these steps:

  1. Clone this repository somewhere

    $ git://

  2. In .userconfig, add the following line.

    export TARGET_TOOLS_PREFIX=/path/to/b2g-toolchain-prebuilt/toolchain-4.4.3/x86_64-apple-darwin/bin/arm-linux-androideabi-

    (Of course, replace /path/to/b2g-toolchain-prebuilt/ with the actual path.)

  3. Rebuild.

See for details.


Run to get a list of supported devices:


And then run for the device you want to build for:

./ [device name]

Udev Permissions

If you get "error: insufficient permissions for device"...

Obtain ID of device manufacturer (first 4 hexidecimal digits before colon):

$ lsusb

Add a line to /etc/udev/rules.d/android.rules (replacing XXXX with 4 digit ID):

SUBSYSTEM=="usb", ATTRS{idVendor}=="XXXX", MODE="0666"

Restart udev before re-plugging your device for it to be detected:

$ sudo service udev restart

Re-run configure:

./ [device name]

Building against a custom Gecko

It can sometimes be useful to build against a different Gecko than the one specified in the manifest, e.g. a mozilla-central checkout that has some patches applied. To do so, edit .userconfig:


Note that if you switch your userconfig's gecko path, you need to rm -rf the objdir and rebuild.


Run or to build B2G.


If you want to just build gecko or some other project, just specify it:

./ gecko


Make sure your phone is plugged in with usb debugging enabled.

To flash everything on your phone:


To flash system/userdata/boot partitions on fastboot phones:

./ system
./ boot
./ user

To update gecko:

./ gecko

To update gaia:

./ gaia

Update Repos

To update all repos:

git pull
./repo sync

To update a specific repo (eg, gaia):

./repo sync gaia


To restart B2G and run B2G under gdb:


To attach gdb to a running B2G process:

./ attach <PID>


To run the Marionette test suite on the emulator:


To run specific tests (individual files, directories, or ini files):

./ gecko/dom/sms gecko/dom/battery/test/marionette/

Specify the full path if you're using a different Gecko repo:

./ /path/to/mozilla-central/dom/battery/test/marionette/