Firefox OS build prerequisites

  • Revision slug: Mozilla/Boot_to_Gecko/B2G_build_prerequisites
  • Revision title: B2G build prerequisites
  • Revision id: 233981
  • Created:
  • Creator: Gerv
  • Is current revision? No
  • Comment Add requirement to install adb; 169 words added, 9 words removed

Revision Content

{{ B2GMain() }}

Before you can even get the code so you can build Boot to Gecko, you'll need a properly-configured build system. You can currently build on 64-bit Linux distributions and Mac OS X.

Have a compatible phone

This is important. Even though we support several phones, some of them are available in multiple variations, and only select variations of them may be supported.

You can, of course, build the desktop client or one of the emulators without a phone.

Samsung Nexus S
The known working model numbers of Nexus S devices are GT-I9020A and GT-I9023. Others may work.
Samsung Galaxy S2
The only model that works is the i9100; no other variants are officially compatible. (i9100P might work, since the only change is a NFC chip added)
Samsung Galaxy Nexus
I'm not currently aware of any variations that are not compatible.
Important: Only devices running Android 4 (aka Ice Cream Sandwich) are supported. If your device is listed above but running an older version of Android, please update it before doing anything.

Requirements for Linux

To build on Linux, you'll need to have a system configured with:

  • An installed Linux distribution (we recommend Ubuntu 11.10, and a 64-distribution is preferable).
  • At least 4 GB of swap space.
  • At least 80 GB of hard disk space.

This is more than the bare minimum, but you'll find after a while that you'll need the resources.

It's possible to use other distributions, but we recommend this one just to ensure everything works as expected.

You will also need the following tools installed:

  • autoconf-2.13
  • git
  • ccache
  • gcc/g++, and you will need g++ multilibs
  • bison
  • flex
  • 32-bit ncurses (libncurses5-dev on Ubuntu/Debian)
  • 32-bit zlib
  • make
  • heimdall (if building for the Samsung Galaxy S2; see {{ anch("Installing heimdall") }})

Requirements for Mac OS X

To build B2G on Mac OS X, you need to install Xcode, which is available through the Mac App Store; on Xcode 4 or later, be sure to go into Preferences, then the Downloads panel, and install the Command Line Utilities. In addition, make sure you have at least 20 GB of free disk space.

Then you need to open a terminal and run this command in the terminal; this will pull and run a bootstrap script that makes sure you have all prerequisites met.

curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash

This will check to see if you have all the things you need to be able to build the emulator, and will prompt you for permission to install anything you're missing. The items this script will check for and install for you are:

  • git
  • gpg
  • ccache
  • yasm
  • autoconf-213
  • gcc-4.6
  • homebrew

If you plan to build for the Samsung Galaxy S2, you will also need to install heimdall. See {{ anch("Installing heimdall") }} for details.

Note: If you have installed the Samsung Kies tool, which is used to manage the contents of many Samsung phones, you will have to remove it before you can flash Boot to Gecko onto your device. You can use the standard application removal process on Windows; on Mac, the Kies install disk image has a utility to fully remove Kies from your system. Flashing will not work if you have Kies installed. If you forget to remove Kies, the build system will detect it and remind you to uninstall it. Note also that the uninstall tool does not correctly remove the folder ~/Library/Application Support/.FUS, and leaves a reference to a utility there in your user startup items list. You will want to remove these manually.

Configure Phone

Before you plug your phone into your USB port, put it USB developer mode. This lets us access the phone for debugging and flashing. To do this, go to the Settings application and navigate to Applications > Development, and turn on the "USB debugging" checkbox.

Install adb

For some (all?) phones, the build process needs to pull binary blobs from the Android installation on the phone before building B2G. (Obviously, this is not necessary for an emulator build.) For this, you will need "adb", the Android Debug Bridge.

Install the Android SDK starter package for your platform. Then run their package manager, $SDK_HOME/tools/android, and use the GUI to install "Android SDK Platform-tools".

adb will be installed to $SDK_HOME/platform_tools. Make sure this directory is in your PATH. Also, you may wish to run:

adb pull /system <empty target dir>

to back up the entire Android system partition. Then, you have a copy of all the binary blobs even if you later delete your b2g tree.

Install heimdall

Heimdall is a utility for flashing the Samsung Galaxy S2. It's used by the Boot to Gecko flash utility to replace the contents of the phone with B2G, as well as to flash updated versions of B2G and Gaia onto the device. You'll need it if you want to install B2G on a Galaxy S2; it is not needed for any other device. For other devices, we build and use the fastboot utility instead.

Note: Again, it's important to note that this is only required for installing B2G on the Samsung Galaxy S2.

There are two ways to install heimdall:

  • You can download the code GitHub and build it yourself.
  • Use a package manager to install it.
    • On Linux: sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
    • On Mac, you can download an installer package and use that.
    • On Mac: sudo brew install libusb libusb-devel

On to the next step

At this point, you should be ready to fetch the B2G code!

Revision Source

<p>{{ B2GMain() }}</p>
<p>Before you can even get the code so you can build Boot to Gecko, you'll need a properly-configured build system. You can currently build on 64-bit Linux distributions and Mac OS X.</p>
<h2>Have a compatible phone</h2>
<p>This is important. Even though we support several phones, some of them are available in multiple variations, and only select variations of them may be supported.</p>
<p>You can, of course, build the <a href="/en/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client" title="en/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client">desktop client</a> or one of the <a href="/en/Mozilla/Boot_to_Gecko/Using_the_B2G_emulators" title="en/Mozilla/Boot_to_Gecko/Using_the_B2G_emulators">emulators</a> without a phone.</p>
<dl> <dt><a class="link-https" href="https://en.wikipedia.org/wiki/Nexus_S#Variants" title="https://en.wikipedia.org/wiki/Nexus_S#Variants">Samsung Nexus S</a></dt> <dd>The known working model numbers of Nexus S devices are GT-I9020A and GT-I9023. Others may work.</dd> <dt>Samsung Galaxy S2</dt> <dd>The only model that works is the i9100; no other variants are officially compatible. (i9100P might work, since the only change is a NFC chip added)</dd> <dt>Samsung Galaxy Nexus</dt> <dd>I'm not currently aware of any variations that are not compatible.</dd>
</dl>
<div class="warning"><strong>Important</strong>: Only devices running <strong>Android 4</strong> (aka <strong>Ice Cream Sandwich</strong>) are supported. If your device is listed above but running an older version of Android, please update it before doing anything.</div>
<h2>Requirements for Linux</h2>
<p>To build on Linux, you'll need to have a system configured with:</p>
<ul> <li>An installed Linux distribution (we recommend Ubuntu 11.10, and a 64-distribution is preferable).</li> <li>At least 4 GB of swap space.</li> <li>At least 80 GB of hard disk space.</li>
</ul>
<p>This is more than the bare minimum, but you'll find after a while that you'll need the resources.</p>
<p>It's possible to use other distributions, but we recommend this one just to ensure everything works as expected.</p>
<p>You will also need the following tools installed:</p>
<ul> <li>autoconf-2.13</li> <li>git</li> <li>ccache</li> <li>gcc/g++, and you will need g++ multilibs</li> <li>bison</li> <li>flex</li> <li>32-bit ncurses (libncurses5-dev on Ubuntu/Debian)</li> <li>32-bit zlib</li> <li>make</li> <li>heimdall (<strong>if building for the Samsung Galaxy S2</strong>; see {{ anch("Installing heimdall") }})</li>
</ul>
<h2>Requirements for Mac OS X</h2>
<p>To build B2G on Mac OS X, you need to <a class="external" href="http://itunes.apple.com/us/app/xcode/id497799835?mt=12" title="http://itunes.apple.com/us/app/xcode/id497799835?mt=12">install Xcode</a>, which is available through the Mac App Store; on Xcode 4 or later, be sure to go into Preferences, then the Downloads panel, and install the Command Line Utilities. In addition, make sure you have at least 20 GB of free disk space.</p>
<p>Then you need to open a terminal and run this command in the terminal; this will pull and run a bootstrap script that makes sure you have all prerequisites met.</p>
<pre>curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash
</pre>
<p>This will check to see if you have all the things you need to be able to build the emulator, and will prompt you for permission to install anything you're missing. The items this script will check for and install for you are:</p>
<ul> <li>git</li> <li>gpg</li> <li>ccache</li> <li>yasm</li> <li>autoconf-213</li> <li>gcc-4.6</li> <li>homebrew</li>
</ul>
<p>If you plan to build for the Samsung Galaxy S2, you will also need to install heimdall. See {{ anch("Installing heimdall") }} for details.</p>
<div class="note"><strong>Note:</strong> If you have installed the <a class="external" href="http://www.samsung.com/us/kies/" title="http://www.samsung.com/us/kies/">Samsung Kies</a> tool, which is used to manage the contents of many Samsung phones, you will have to remove it before you can flash Boot to Gecko onto your device. You can use the standard application removal process on Windows; on Mac, the Kies install disk image has a utility to fully remove Kies from your system. Flashing <strong>will not work</strong> if you have Kies installed. If you forget to remove Kies, the build system will detect it and remind you to uninstall it. Note also that the uninstall tool does not correctly remove the folder <code>~/Library/Application Support/.FUS</code>, and leaves a reference to a utility there in your user startup items list. You will want to remove these manually.</div>
<h2>Configure Phone</h2>
<p>Before you plug your phone into your USB port, put it USB developer mode. This lets us access the phone for debugging and flashing. To do this, go to the Settings application and navigate to Applications &gt; Development, and turn on the "USB debugging" checkbox.</p>
<h2 class="note">Install adb</h2>
<p>For some (all?) phones, the build process needs to pull binary blobs from the Android installation on the phone before building B2G. (Obviously, this is not necessary for an emulator build.) For this, you will need "adb", the Android Debug Bridge.</p>
<p>Install the <a class=" external" href="http://developer.android.com/sdk/index.html" title="http://developer.android.com/sdk/index.html">Android SDK starter package</a> for your platform. Then run their package manager, $SDK_HOME/tools/android, and use the GUI to install "Android SDK Platform-tools".</p>
<p>adb will be installed to $SDK_HOME/platform_tools. Make sure this directory is in your PATH. Also, you may wish to run:</p>
<pre>adb pull /system &lt;empty target dir&gt;
</pre>
<p>to back up the entire Android system partition. Then, you have a copy of all the binary blobs even if you later delete your b2g tree.</p>
<h2 class="note">Install heimdall</h2>
<p>Heimdall is a utility for flashing the Samsung Galaxy S2. It's used by the Boot to Gecko flash utility to replace the contents of the phone with B2G, as well as to flash updated versions of B2G and Gaia onto the device. You'll need it if you want to install B2G on a Galaxy S2; it is <strong>not</strong> needed for any other device. For other devices, we build and use the fastboot utility instead.</p>
<div class="note"><strong>Note:</strong> Again, it's important to note that this is <strong>only required for installing B2G on the Samsung Galaxy S2</strong>.</div>
<p>There are two ways to install heimdall:</p>
<ul> <li>You can <a class="link-https" href="https://github.com/Benjamin-Dobell/Heimdall" title="https://github.com/Benjamin-Dobell/Heimdall">download the code</a> GitHub and build it yourself.</li> <li>Use a package manager to install it. <ul> <li>On Linux: <code>sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev</code></li> <li>On Mac, you can <a class="link-https" href="https://github.com/downloads/Benjamin-Dobell/Heimdall/heimdall-suite-1.3.2-mac.dmg" title="https://github.com/downloads/Benjamin-Dobell/Heimdall/heimdall-suite-1.3.2-mac.dmg">download an installer package</a> and use that.</li> <li>On Mac: <code>sudo brew install libusb libusb-devel</code></li> </ul> </li>
</ul>
<h2>On to the next step</h2>
<p>At this point, you should be ready to <a href="/en/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build" title="en/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build">fetch the B2G code</a>!</p>
Revert to this revision