MDN will switch to a new design later today, a sneak peek:

Once you've built Boot to Gecko for a supported mobile device, you can install it. This article will guide you through the process.

Note: The first time you flash your phone, it must have Android 4 (Ice Cream Sandwich) installed. The process will not work correctly otherwise. Once you've done your first install of B2G, however, you can simply update on top of it.


To flash everything to your phone, simply connect your phone and type:


That's it. The B2G you've currently got built will flash onto your device.

Configuring the udev rule for your device

On Linux, if you get this,

< waiting for device >

that probably means that you haven't added a udev rule for the fastboot device, which is not the same as the one for adb. You can get the USB vendor ID by running lsusb now, but typically it's Google's: 18d1, so adding this line in your /etc/udev/rules.d/51-android.rules would work:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
Note: If you get a very helpful libusb error "-3" on Linux, it means you need to be root to have the needed access to the USB device. Run the script again using sudo.
Note 2: If you have an Unagi or a Geeksphone Keon phone, you need two lines like this - one for the original phone vendor's ID, and one for Google's.

Special notes for Hamachi, Helix, and Leo devices

If your phone is a hamachi, helix or leo device, the ./ script will now default to flashing only gecko and gaia.  It is recommended that you flash with the OEM as a base build to get the firmware and the gonk layers and then flash the gecko and gaia on top.  If you want to flash using the images, there is an override flash where you can ./ -f and it will use the image files to flash your device.

Special notes for the Samsung Galaxy S2

If your phone is a Galaxy S2 and you are using heimdall 1.3.2 (the latest version; use heimdall version to check), you may see an alarming error "FACTORYFS upload failed!" followed by "Heimdall flashing failed" and some additional information. This is actually a success condition, and you can ignore the advice.

To get rid of this strange behavior, grab a source copy of heimdall, downgrading to the 1.3.1 release ("git checkout fbbed42c1e5719cc7a4dceeba098981f19f37c06"), then compile it  according to the README, then install that to make the error go away. However, this isn't strictly necessary.

All versions of heimdall are unable to flash a system.img larger than 100MB. Do:

ls -l ./out/target/product/galaxys2/system.img

to see how big yours is. If it's too large, ask in IRC for advice; there are ways to do it in two stages.

Added step for the Samsung Galaxy S2

If you're flashing onto the Galaxy S2, there is an additional step to follow. Gaia does not get flashed automatically by the script; you'll need to also do:

./ gaia

Flashing specific partitions to fastboot phones

You can flash specific partitions to fastboot phones (that is, any phone other than the Samsung Galaxy S2). For example:

./ system
./ boot
./ user

Updating specific modules

You can update specific components of B2G by specifying their names when flashing. For example:

./ gaia
./ gecko

In order to update only one application you can use BUILD_APP_NAME environment variable:

BUILD_APP_NAME=calendar ./ gaia

If your phone is not for developer (you aren't interested on test apps and/or require optimization), you can update gaia using:

VARIANT=user ./ gaia

Next steps

At this point, your phone should be running Boot to Gecko! It's time to experiment, write some code, test, or do some debugging!

Note: A helpful usage tip: if your build of B2G starts up with the lock screen requesting a pass code to unlock the phone, the default code is 0000.


Here are a some tips for what to do if your device doesn't work right after installing B2G, or updating it to a new version

If the UI doesn't start up

If you update your phone and the user interface doesn't start up, you can reset it to clear out out-of-date configuration and the like. This may bring it back to life. Here's how:

cd gaia
make reset-gaia

If you want change from developer to production mode

cd gaia
make reset-gaia PRODUCTION=1

"image is too large" error message on ./ execution

It might mean that you phone needs to be rooted first before flashing it. As b2g needs to be written on root partition, your phone needs to be rooted in order to install it.


 最后编辑者: chrisdavidmills,