mozilla

Revision 309217 of Building Firefox OS

  • Revision slug: Mozilla/Boot_to_Gecko/Building_Boot_to_Gecko
  • Revision title: Building Boot to Gecko
  • Revision id: 309217
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment clarify the info about deleting xulrunner-sdk

Revision Content

{{ B2GMain() }}

Once you've set up your build system and performed your initial pull and configure of the code, you can build Boot to Gecko.

Updating your code

If this isn't your very first time building B2G, you might want to pull the latest code before you start to build. To do that, you should update both the B2G tools and the dependencies, using the following two commands:

git pull
./repo sync

You can update a specific make target's repository by specifying its name:

./repo sync gaia

The repo command has other options available that might be interesting; repo help will give you a lot of information.

Building

To build Boot to Gecko, simply use the build.sh tool:

cd B2G
./build.sh

Time for another coffee break, or possibly a nap (especially if this is your first build).

Building specific modules

If you want to build just a particular module, such as Gecko, you can specify it by name:

./build.sh gecko

To get a list of the modules you can build, you can do:

./build.sh modules

Setting the number of processor cores to use

By default, the B2G build scripts use the number of cores your system has plus two as the number of parallel tasks to run. You can change this by specifying the -j parameter when running build.sh. This can be handy if you're using your system for other things while building in the background and need to reduce CPU load a bit. It's also handy when you're having build problems, as it can make reading error output from the build process easier if you have just one task going at a time!

For example, to build using just two parallel tasks:

./build.sh -j2

The most common use case for this, however, is to prevent builds from running in parallel at all. This makes the output of the process much easier to read, making it easier to sort out build problems. To do this:

./build.sh -j1

If you get build errors while the build system is running tests

Sometimes (especially after build tool or operating system updates) you'll get weird errors like this when the build system runs its post-build tests:

Generating permissions.sqlite...
test -d profile || mkdir -p profile
run-js-command  permissions
WARNING: permission unknown:offline-app
WARNING: permission unknown:indexedDB-unlimited
build/permissions.js:122: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPermissionManager.add]
make[1]: *** [permissions] Error 3
make: *** [gaia/profile.tar.gz] Error 2

In this situation, try deleting the gaia/xulrunner-sdk directory and re-pulling the code:

rm -r gaia/xulrunner-sdk

This deletes the downloaded, precompiled copy of XULRunner that the build system retrieves automatically; on your next build, a new copy of XULRunner will be automatically retrieved.

Next steps

After building, your next step depends on whether you built Boot to Gecko for the emulator or for a real mobile device; see the following articles for details:

Revision Source

<div>
  {{ B2GMain() }}</div>
<p>Once you've <a href="/en-US/docs/Mozilla/Boot_to_Gecko/B2G_build_prerequisites" title="en-US/docs/Mozilla/Boot_to_Gecko/B2G_build_prerequisites">set up your build system</a> and performed your <a href="/en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build" title="en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build">initial pull and configure</a> of the code, you can build Boot to Gecko.</p>
<h2 id="Updating_your_code">Updating your code</h2>
<p>If this isn't your very first time building B2G, you might want to pull the latest code before you start to build. To do that, you should update both the B2G tools and the dependencies, using the following two commands:</p>
<pre>
git pull
./repo sync
</pre>
<p>You can update a specific make target's repository by specifying its name:</p>
<pre>
./repo sync gaia
</pre>
<p>The repo command has other options available that might be interesting; <code>repo help</code> will give you a lot of information.</p>
<h2 id="Building">Building</h2>
<p>To build Boot to Gecko, simply use the <code>build.sh</code> tool:</p>
<pre>
cd B2G
./build.sh
</pre>
<p>Time for another coffee break, or possibly a nap (especially if this is your first build).</p>
<h3 id="Building_specific_modules">Building specific modules</h3>
<p>If you want to build just a particular module, such as Gecko, you can specify it by name:</p>
<pre>
./build.sh gecko
</pre>
<p>To get a list of the modules you can build, you can do:</p>
<pre>
./build.sh modules
</pre>
<h3 id="Setting_the_number_of_processor_cores_to_use">Setting the number of processor cores to use</h3>
<p>By default, the B2G build scripts use the number of cores your system has plus two as the number of parallel tasks to run. You can change this by specifying the <code>-j</code> parameter when running <code>build.sh</code>. This can be handy if you're using your system for other things while building in the background and need to reduce CPU load a bit. It's also handy when you're having build problems, as it can make reading error output from the build process easier if you have just one task going at a time!</p>
<p>For example, to build using just two parallel tasks:</p>
<pre>
./build.sh -j2
</pre>
<p>The most common use case for this, however, is to prevent builds from running in parallel at all. This makes the output of the process much easier to read, making it easier to sort out build problems. To do this:</p>
<pre>
./build.sh -j1
</pre>
<h3 id="If_you_get_build_errors_while_the_build_system_is_running_tests">If you get build errors while the build system is running tests</h3>
<p>Sometimes (especially after build tool or operating system updates) you'll get weird errors like this when the build system runs its post-build tests:</p>
<pre>
Generating permissions.sqlite...
test -d profile || mkdir -p profile
run-js-command  permissions
WARNING: permission unknown:offline-app
WARNING: permission unknown:indexedDB-unlimited
build/permissions.js:122: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPermissionManager.add]
make[1]: *** [permissions] Error 3
make: *** [gaia/profile.tar.gz] Error 2</pre>
<p>In this situation, try deleting the <code>gaia/xulrunner-sdk</code> directory and re-pulling the code:</p>
<pre>
rm -r gaia/xulrunner-sdk
</pre>
<p>This deletes the downloaded, precompiled copy of <a href="/en-US/docs/XULRunner" title="/en-US/docs/XULRunner">XULRunner</a> that the build system retrieves automatically; on your next build, a new copy of XULRunner will be automatically retrieved.</p>
<h2 id="Next_steps">Next steps</h2>
<p>After building, your next step depends on whether you built Boot to Gecko for the emulator or for a real mobile device; see the following articles for details:</p>
<ul>
  <li><a href="/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_emulators" title="en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_emulators">Using the B2G emulators</a></li>
  <li><a href="/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client" title="en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client">Using the B2G desktop client</a></li>
  <li><a href="/en-US/docs/Mozilla/Boot_to_Gecko/Installing_Boot_to_Gecko_on_a_mobile_device" title="en-US/docs/Mozilla/Boot_to_Gecko/Installing_Boot_to_Gecko_on_a_mobile_device">Installing Boot to Gecko on a mobile device</a></li>
  <li><a href="https://developer-new.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Pandaboard" title="https://developer-new.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Pandaboard">Installing Boot to Gecko on a pandaboard</a></li>
</ul>
Revert to this revision