Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP hp420

21st February 2013, 03:44 AM   |  #1  
hp420's Avatar
OP Senior Member
Flag NY
Thanks Meter: 886
 
1,786 posts
Join Date:Joined: Jul 2011
More
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:

Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Code:
$ sudo apt-get update
Code:
$ sudo apt-get install sun-java6-jdk
If you have multiple java installations you need to change the version your system is using

Code:
$ wget http://webupd8.googlecode.com/files/update-java-0.5b
Code:
$ chmod +x update-java-0.5b
Code:
$ 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
http://developer.android.com/sdk/index.html

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

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

Install adb & fastboot:

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

Code:
$ adb devices
Install dependancies:

ubuntu 12.10+ dependancies
Code:
$ 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
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Clone the repo:

Code:
$ git clone git://github.com/mozilla-b2g/B2G.git
Code:
$ cd ~/B2G
Download the source:

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

Code:
$ ./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

Code:
$ ./config.sh (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
Code:
$ cd ~/B2G
Code:
$ ./build.sh
*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:

Code:
$ ./build.sh -j1
This takes HOURS (probably 4-5)

Flashing b2g:

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

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

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

plug in your device and enable usb debugging

Code:
$ sudo adb pull /system ~/Documents/crespo4g/b2g
Code:
$ 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)
Last edited by hp420; 21st February 2013 at 03:58 AM.
The Following 3 Users Say Thank You to hp420 For This Useful Post: [ View ]
21st February 2013, 03:45 AM   |  #2  
hp420's Avatar
OP Senior Member
Flag NY
Thanks Meter: 886
 
1,786 posts
Join Date:Joined: Jul 2011
More
reserved
The Following User Says Thank You to hp420 For This Useful Post: [ View ]
21st February 2013, 03:47 AM   |  #3  
hp420's Avatar
OP Senior Member
Flag NY
Thanks Meter: 886
 
1,786 posts
Join Date:Joined: Jul 2011
More
Reserved again
The Following User Says Thank You to hp420 For This Useful Post: [ View ]
21st February 2013, 03:57 PM   |  #4  
Senior Member
Flag Laval
Thanks Meter: 776
 
307 posts
Join Date:Joined: Jan 2013
Donate to Me
More
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, 06:27 PM   |  #5  
Junior Member
Thanks Meter: 0
 
28 posts
Join Date:Joined: Mar 2011
Big Thx Good Guide
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes