Revision 233979 of Preparing for your first B2G build

  • Revision slug: Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build
  • Revision title: Preparing for your first B2G build
  • Revision id: 233979
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 141 words added

Revision Content

{{ B2GMain() }}

Before you can build B2G, you need to clone the repository and configure your build. This article explains how to do that.

Cloning the B2G repository

The first step, before you can start your first build, is to clone the B2G repository. This will not fetch everything! Instead, it will fetch the B2G build system and setup utilities. Most of the actual B2G code is in the main Mozilla Mercurial repository.

To clone the repository, use git:

git clone https://github.com/mozilla-b2g/B2G.git

After cloning (which should take just a few moments), cd into the B2G directory:

cd B2G

Configuring B2G for your device

Important: Remember that only devices running Android 4 (aka Ice Cream Sandwich) are supported. Please check that your phone is actually running ICS, otherwise this step will most likely fail since some drivers are pulled from non-Nexus devices.

Once you've retrieved the core B2G build system, you need to configure it for the device on which you plan to install it. To get a list of supported devices, you can use the config.sh utility, as follows:

./config.sh

This will display a list of the supported devices; for example:

Usage: ./config.sh (device name)

Valid devices to configure are:
- galaxy-s2
- galaxy-nexus
- nexus-s
- emulator
- emulator-x86

If your device isn't listed, you should stop right now and either help port B2G to your device or wait until someone else does it. We'd prefer it if you help out!

Note: If for any reason you want to build against a specific version of Gecko, see {{ anch("Building against a custom Gecko") }} before you proceed.

Configuring for a mobile device

If your device is listed, you can start the configure process by running config.sh again, this time specifying your device's name. For example, to build for the Samsung Galaxy Nexus S, you would type:

./config.sh nexus-s

Near the start of the configuration you might need to set the option for color usage, after this the process continues. This would be a good time for a coffee break, since at this point, you'll be doing your first pull of all the code needed to build Boot to Gecko.

Configuring to build an emulator

If you want to build one of the emulators, you can specify "emulator" to get the ARM device emulator, or "emulator-x86" to build the x86 emulator. The latter is faster but not as accurate a representation of an actual mobile device.

So, for example, to build the ARM emulator, you would configure like this:

./config.sh emulator

Near the start of the configuration you might need to set the option for color usage, after this the process continues. This would be a good time for a coffee break, since at this point, you'll be doing your first pull of all the code needed to build Boot to Gecko.

Building against a custom Gecko

There may be times that you want or need to build Boot to Gecko based on a different version of Gecko than the one that's used by default (as specified in the manifest). You can do so by editing the file .userconfig before you pull the repository (before the config.sh step above). For example, if you want to build against mozilla-central:

GECKO_PATH=/path/to/mozilla-central
GECKO_OBJDIR=/path/to/mozilla-central/objdir-gonk

Revision Source

<p>{{ B2GMain() }}</p>
<p>Before you can build B2G, you need to clone the repository and configure your build. This article explains how to do that.</p>
<h2>Cloning the B2G repository</h2>
<p>The first step, before you can start your first build, is to clone the B2G repository. This will not fetch everything! Instead, it will fetch the B2G build system and setup utilities. Most of the actual B2G code is in the main Mozilla <a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> repository.</p>
<p>To clone the repository, use git:</p>
<pre>git clone https://github.com/mozilla-b2g/B2G.git
</pre>
<p>After cloning (which should take just a few moments), <code>cd</code> into the B2G directory:</p>
<pre>cd B2G
</pre>
<h2>Configuring B2G for your device</h2>
<div class="warning"><strong>Important</strong>: Remember that only devices running <strong>Android 4</strong> (aka <strong>Ice Cream Sandwich</strong>) are supported. Please check that your phone is actually running ICS, otherwise this step will most likely fail since some drivers are pulled from non-Nexus devices.</div>
<p>Once you've retrieved the core B2G build system, you need to configure it for the device on which you plan to install it. To get a list of supported devices, you can use the <code>config.sh</code> utility, as follows:</p>
<pre>./config.sh
</pre>
<p>This will display a list of the supported devices; for example:</p>
<pre>Usage: ./config.sh (device name)

Valid devices to configure are:
- galaxy-s2
- galaxy-nexus
- nexus-s
- emulator
- emulator-x86
</pre>
<p>If your device isn't listed, you should stop right now and either help port B2G to your device or wait until someone else does it. We'd prefer it if you help out!</p>
<div class="note"><strong>Note:</strong> If for any reason you want to build against a specific version of Gecko, see {{ anch("Building against a custom Gecko") }} before you proceed.</div>
<h3>Configuring for a mobile device</h3>
<p>If your device is listed, you can start the configure process by running <code>config.sh</code> again, this time specifying your device's name. For example, to build for the Samsung Galaxy Nexus S, you would type:</p>
<pre>./config.sh nexus-s
</pre>
<p>Near the start of the configuration you might need to set the option for color usage, after this the process continues. This would be a good time for a coffee break, since at this point, you'll be doing your first pull of all the code needed to build Boot to Gecko.</p>
<h3>Configuring to build an emulator</h3>
<p>If you want to build one of the emulators, you can specify "emulator" to get the ARM device emulator, or "emulator-x86" to build the x86 emulator. The latter is faster but not as accurate a representation of an actual mobile device.</p>
<p>So, for example, to build the ARM emulator, you would configure like this:</p>
<pre>./config.sh emulator
</pre>
<p>Near the start of the configuration you might need to set the option for color usage, after this the process continues. This would be a good time for a coffee break, since at this point, you'll be doing your first pull of all the code needed to build Boot to Gecko.</p><h2>Building against a custom Gecko</h2>
<p>There may be times that you want or need to build Boot to Gecko based on a different version of Gecko than the one that's used by default (as specified in the manifest). You can do so by editing the file <code>.userconfig</code> before you pull the repository (before the <code>config.sh</code> step above). For example, if you want to build against mozilla-central:</p>
<pre>GECKO_PATH=/path/to/mozilla-central
GECKO_OBJDIR=/path/to/mozilla-central/objdir-gonk
</pre>
Revert to this revision