[GUIDE] How to build firefoxOS from source with Ubuntu 12.10/13.04 x64
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....
$ sudo add-apt-repository "deb http://archive.canonical.com/ 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 http://webupd8.googlecode.com/files/update-java-0.5b
$ 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
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/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Clone the repo:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Download the source:
$ git clone git://github.com/mozilla-b2g/B2G.git
Plug in your device, ensure ICS or newer is installed, then enable usb debugging
$ ./config.sh nexus-s-4g
This is where you can change the guide to work with any supported device. The proper syntax is as follows
$ ./config.sh (device name)
where (device name) is one of the following:
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
Building from source:
if you're not already there
*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:
This takes HOURS (probably 4-5)
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
To create a flashable zip:
$ sudo fastboot flash userdata userdata.img
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)