Installing Firefox OS on Nexus 4

I just managed to flash my Nexus 4 device with Firefox OS, here are the steps I went through to do it.

1. Install ADB

ADB is the tool we use to communicate with our Firefox OS device from our machine. Before you can flash any devices with new versions of Firefox OS, you need to have this tool installed.

Download it with the Android SDK, and make sure both adb and fastboot executables are available on your command-line.

2. Turn Android into Firefox OS

2.1 Download the following package

2.2 Unzip and cd ./mako

2.3 Power off device.

2.4 Power on device holding Volume Down + Power.

2.5 Select reboot bootloader.

2.6 Run ./flash.sh.

Your device should then reboot as a Firefox OS device. Next we want to get the freshest version of Firefox OS onto your Nexus 4. This takes a little more work, but will mean that you will be able to develop at the bleeding edge.

3. Create a case-insensitive 'mountable disk image'

I know, sounds like gibberish right? But B2G is built on Android, which requires a case-insensitive file system for particular builds. Most B2G build don't require this, but the Nexus 4 does.

MacOSX does not have a case-insensitive file system by default, but allows you to create virtual drives that do. The following instructions were copied from here.

3.1 Create a new drive

hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage

3.2 Mount the drive

open ~/firefoxos.sparseimage

3.3 cd into it

cd /Volumes/firefoxos/

4. Clone the B2G onto your mounted drive

git clone https://github.com/mozilla-b2g/B2G.git
cd B2G

5. 'Config' B2G for this device

./config.sh nexus-4

Warning: this could take a while...

6. 'Build' B2G

./build.sh

Warning: this could take a while...

If at any point throughout this process the build scripts error, it is most likely that you are missing a dependency. Check what the error message is complaining about, and go use HomeBrew to install it.

7. Flash new Gaia and Gecko

./flash.sh gecko
./flash.sh gaia

You now have a completely fresh, up-to-date version of Firefox OS on your Nexus device.

Props to Ryan Watson for improvements.

comments powered by Disqus