Remove All Ads from XDA

[GUIDE] How to build firefoxOS from source with Ubuntu 12.10/13.04 x64

2,394 posts
Thanks Meter: 1,359
By hp420, Senior Member on 21st February 2013, 02:44 AM
Post Reply Email Thread
I have yet to see a good, COMPLETE, step by step tutorial for building firefoxOS, so since I figured it out thought I would document the steps I took and get a good guide going for us.

**This guide is written with Samsung Nexus S 4G (crespo4G) specifically in mind, but it can easily be adapted to any officially supported device

what you will need:

a nexus s 4g (or other officially supported device)
a pc capable of compiling android from source (ie: minimum 2x core cpu, 4gb ram)
ubuntu 12.10 or 13.04 64-bit (google it, it's open source!)
broadband internet (trust me, you want a minimum of 10mbit/sec)
a basic understanding of terminal command, adb and fastboot

ok, let's get started!!

I'll assume you've already installed ubuntu and gotten the network set up. If not, do so now.

First, set up the build environment....

Install java:

$ sudo add-apt-repository "deb lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
If you have multiple java installations you need to change the version your system is using

$ wget
$ chmod +x update-java-0.5b
$ sudo ./update-java-0.5b
(it says java 0.5, but it's java 6 don't worry)

choose any java 6 installation and save.

Install android sdk:

download the sdk from android dev site

extract it to ~/android/sdk/.....

$ cd ~/android/sdk/tools
$ ./android update sdk
update all packages

Install adb & fastboot:

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install android-tools-adb android-tools-fastboot
test it!!!

$ adb devices
Install dependancies:

ubuntu 12.10+ dependancies
$ sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make
64 bit dependancies
$ sudo ln -s /usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/ /usr/lib/i386-linux-gnu/
Clone the repo:

$ git clone git://
$ cd ~/B2G
Download the source:

Plug in your device, ensure ICS or newer is installed, then enable usb debugging

$ ./ nexus-s-4g
This is where you can change the guide to work with any supported device. The proper syntax is as follows

$ ./ (device name)
where (device name) is one of the following:
- galaxy-s2
- galaxy-nexus
- nexus-s
- nexus-s-4g
- otoro
- unagi
- pandaboard
- emulator
- emulator-x86

This takes about an hour

When the source is done downloading, create a file called .userconfig with gedit containing the following two lines of code then save and drop it in ~/B2G

export CC=gcc-4.6
export CXX=g++-4.6

Building from source:

if you're not already there
$ cd ~/B2G
$ ./
*if you get build errors, use a -j option. -j1 option tells your pc to use only one cpu core. -j2 tells it to use 2, and so on...

Using less cpu cores can lead to a more stable build environment and reduce errors

If you use a -j1 option, the syntax is as follows:

$ ./ -j1
This takes HOURS (probably 4-5)

Flashing b2g:

when it's done, find the .img files in ~/B2G/out/product/target/crespo4g

$ cd ~/B2G/out/product/target/crespo4g
Boot your device to the bootloader

$ sudo fastboot flash boot boot.img
$ sudo fastboot flash system system.img
$ sudo fastboot flash userdata userdata.img
To create a flashable zip:

plug in your device and enable usb debugging

$ sudo adb pull /system ~/Documents/crespo4g/b2g
$ sudo adb pull /data ~/Documents/crespo4g/b2g
add the meta-inf from another nexus s 4g flashable zip

create a .zip with the 3 directories (meta-inf, system and data) and the boot.img you just created

flash in recovery after a FULL wipe (system, boot, data, cache, dalvik)
The Following 3 Users Say Thank You to hp420 For This Useful Post: [ View ] Gift hp420 Ad-Free
21st February 2013, 02:57 PM |#4  
Senior Member
Flag Laval
Thanks Meter: 777
Donate to Me
Re: [GUIDE] How to build firefoxOS from source with Ubuntu 12.10/13.04 x64
Thanks ! Will try this !

Sent from my Nexus s using xda app-developers app
21st February 2013, 05:27 PM |#5  
Junior Member
Thanks Meter: 0
Big Thx Good Guide
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes