Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,884 Members 52,359 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
hp420
Old
(Last edited by hp420; 21st February 2013 at 02:58 AM.)
#1  
hp420's Avatar
Senior Member - OP
Thanks Meter 863
Posts: 1,697
Join Date: Jul 2011
Location: NY
Prompt [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....

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)
The Following 3 Users Say Thank You to hp420 For This Useful Post: [ Click to Expand ]
 
hp420
Old
#2  
hp420's Avatar
Senior Member - OP
Thanks Meter 863
Posts: 1,697
Join Date: Jul 2011
Location: NY
reserved
The Following User Says Thank You to hp420 For This Useful Post: [ Click to Expand ]
 
hp420
Old
#3  
hp420's Avatar
Senior Member - OP
Thanks Meter 863
Posts: 1,697
Join Date: Jul 2011
Location: NY
Reserved again
The Following User Says Thank You to hp420 For This Useful Post: [ Click to Expand ]
 
Gingo21
Old
#4  
Senior Member
Thanks Meter 776
Posts: 307
Join Date: Jan 2013
Location: Laval

 
DONATE TO ME
Default 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
CarbonRom and Paranoid Android Nexus S maintainer.

If you like my work, feel free to buy me a drink !
 
crocodanser
Old
#5  
Junior Member
Thanks Meter 0
Posts: 28
Join Date: Mar 2011
Big Thx Good Guide
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes