Once you've built Boot to Gecko for a supported mobile device, you can install it. This article will guide you through the process.
Installing ADB
On OSX
If you have homebrew on OSX:
brew install android-platform-tools
Otherwise, download the Android Developer Tools and add the binaries to your PATH.
On Ubuntu
sudo apt-get install android-tools-adb
Flashing your phone
To flash everything to your phone, simply connect your phone and type:
./flash.sh
That's it. The B2G you've currently got built will flash onto your device.
Note that If you are updating across revisions with significant Gaia changes, you might need also do:
cd gaia make reset-gaia
This will wipe all of your data stored in Gaia, but also clear out obsolete Gaia settings and prefs so that you'll boot into a "clean" Gaia. In theory ./flash.sh
should do this already, but for some devices (e.g. hamachi) ./flash.sh
only flashes a subset of modules (./flash.sh -f
will force flash everything.)
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. (Though it also might just mean you need to run ./flash.sh with sudo) 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"
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
.Special notes for Hamachi, Helix, and Leo devices
If your phone is a hamachi, helix or leo device, the ./flash.sh 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 ./flash.sh -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 flash.sh
script; you'll need to also do:
./flash.sh 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:
./flash.sh system ./flash.sh boot ./flash.sh user
WARNING: flashing user (at least) may delete your user-specific data (contacts, etc.).
Updating specific modules
You can update specific components of B2G by specifying their names when flashing. For example:
./flash.sh gaia ./flash.sh gecko
In order to update only one application you can use BUILD_APP_NAME environment variable:
BUILD_APP_NAME=calendar ./flash.sh 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 ./flash.sh 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!
Troubleshooting
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, but note that it may also delete your user-specific data (contacts, etc.). Here's how:
cd gaia make reset-gaia
If you want change from developer to production mode
cd gaia make reset-gaia PRODUCTION=1
WARNING: reset-gaia may delete your user-specific data (contacts, etc.).
"image is too large" error message on ./flash.sh 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.