Installing Boot2Gecko on Nexus S

EDIT: These instructions have been updated and simplified.

Mozilla announced the Boot to Gecko project late last year. I picked up an unlocked Nexus S and took a weekend to build B2G and flash the the phone with it. I’ve distilled what I did down to a few easy-to-follow steps. Well, forget the ‘few’ part. And maybe the ‘easy-to-follow’.

First, the pre-requisites/requirements. You need to have the Java SDK (I used 1.6) and the latest Android SDK installed, including the Platform-tools. Secondly, I did this using Linux Mint 12 and ICS running on an *already unlocked* Nexus S. If you have differences in either of these, these steps may or may not work out for you. Finally, you will need quite a bit of space on your hard drive. Cloning the B2G repo will result in multiple gigabytes of git submodules being cloned. According to the B2G wiki, you’ll need at least 80GB of space.
1. Install build dependencies
Run the following at the command line:

sudo apt-get install git mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 ia32-libs gcc-multilib g++-multilib bison flex gperf lib32z-dev lib32ncurses5-dev lib32ncursesw5-dev libidl-dev lib32gomp1 autoconf2.13 ccache libx11-dev lib32readline-gplv2-dev

Accept the additional installs as well.

2. Modify /etc/apt/sources.list for firefox build-dep
Mint repos don’t include source repositories for building firefox, so you need to modify the list by hand. Fire up your text editor and open /etc/apt/sources.list, and add the following line:

deb-src http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse

Save and then run

sudo apt-get update

You can always remove the added line later.

Now run

sudo apt-get build-dep firefox

3. Set up /etc/udev/rules.d/51-android.rules for the Nexus S
Create a new file at /etc/udev/rules.d/51-android.rules and enter the following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

4. Clone the B2G repository and make sync
Enter the following at the command line:

git clone git://github.com/andreasgal/B2G

This while take a while. When finished, enter the following:

cd B2G
make sync

This will take even longer.

5. Configure for a Nexus S build
This took several tries for me. Attempting Friday night resulted in several timeouts. Attempting again early Saturday morning was successful. Just keep trying. Enter the following at the command line:

make config-nexuss-ics

6. Make gonk
Yep, gonk.
To do so, modify glue/gonk/device/samsung/crespo/board-info.txt to include ‘I9020XXKL1’ (minus quotes) at the end of require version-bootloader and ‘I9020XXKI1’ (minus quotes) at the end of require version-baseband. When you open the file, you’ll know what I mean.

Enter the following, still in the B2G directory:

make gonk

and when that finishes,

make

From what I can tell, this will basically re-create B2G’s own version of adb and other android tools in its own filesystem.

7. Modify your ~/.bashrc to point to path to newly build adb
Enter the following line in your .bashrc:

export PATH=$PATH:"Path/to/B2G/glue/gonk-ics/out/host/linux-x86/bin"

8. Flash clockworkmod recovery image to phone.
Instructions can be found here.

9. Flash results to phone.
Connect phone to computer via USB. Start phone in flashboot mode by simultaneously pressing power and volume up buttons. Select recovery mode.
Run the following from the command line:

make flash-only

This will flash your B2G build onto the phone. You’ll lose everything previously on the phone!

This will probably re-boot your phone, and you will most likely get an error page when the phone is rebooted about no homescreen found. This just means that gaia, the B2G interface needs to be flashed to the phone. Do this by entering the following:

make install-gaia

And, if needed:

adb-reboot

There you have it! Leave a comment below if you have any questions…

Advertisements

About buffalobillion

Web Developer, JavaScript Balrog, Java dude, Ruby/Rails enthusiast. Guitar Playa.
This entry was posted in Mobile, Web Dev. Bookmark the permalink.

2 Responses to Installing Boot2Gecko on Nexus S

  1. Magnus says:

    Cool, and thanks for the guide!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s