Mozilla Boot to Gecko

I'm not a coder. I barely know Git from Got, and I can't recall how many times I've wondered why adb won't work, only to discover I forgot to turn on USB debugging -- again. I've got Linux on a box here, but I only ever use it when I'm in the mood to throw a half-dozen questions at Jerry in the span of five minutes.

Also, I don't have a neckbeard.

So what in the wide, wide world of sports am I doing downloading Xcode on my MacBook Air (never mind that until this spring I'd been a Windows guy all my life), syncing from Git repos, compiling code and flashing an operating system I've consciously ignored up until now -- especially given that I've spent 24 hours dealing with a sick child, worrying about an ailing friend, and preparing for a probable hurricane, largely ignoring my actual job?

I, apparently, have a problem with flashing. And so that's how I recently found myself putting Mozilla's fledgling operating system, also known as "Gecko," on the Samsung Nexus S. 

Welcome to the Boot to Gecko project.

Like I said, I'm not a coder. But I do like to mess with things. And I managed to do this, as my young daughters like to say, all ... by ... my ... self. And you can, too.

Wait - why the hell are you doing this?

This is the first in a series that we're going to call our Weekend Projects. Things that you might not otherwise attempt. But if we can do it, so can you.

That said, there are a couple things that I'm not going to do for you here. This isn't going to be a detailed look at how to build and flash the Boot to Gecko project. I'm going to give you the broad strokes of my experience. Mozilla has some excellent documentation, and you really should read it if you're going to attempt this. (I also likely would fail to get everything right in translation.)

The other thing I'm not going to do is point you to someone else's build, flashable though ClockworkMod. You can search that on your own. What I wanted to do was actually compiling build this on my own inflection to the phone myself.

And so that's what I did.

Links you'll need

The Google is your friend. A simple search for "B2G" found everything I needed.

Mozilla Boot to Gecko

OK - now what the hell are you doing this on?

To build from scratch, according to Mozilla, you either need a Mac or a Linux machine. I've got both here. But the Mac instructions simply looked easier. (There's no shame in that, right?) But that makes sense, too. Chances are if you're running Linux, you can easily install all of the tools Mozilla's listed. Me? Not so much. So Mac it was. 

It really was as simple as this for me: Install Xcode from the Mac App Store, then fire up Terminal and run a few commands. I've done enough tinkering in Android to be OK with that. Mozilla's got a great script that installs everything you need. You then sync the git repository, compile the code, and flash it to your Android device like any other custom ROM. (And Mozilla's got a script for that last part, too, making things even easier.)

As far as the target device for which you're building, you've got options. Mozilla's split them into three tiers:

  • Tier 1: Otoro (some sort of dev device Mozilla's using); Pandaboard; an ARM or x86 emulator; or the desktop. Not what I was looking for.
  • Tier 2: The Samsung Nexus S and Nexus S 4G. I sense a common theme here. Easily unlockable phones, and Mozilla says these are picking up changes "secondarily." I've got a Nexus S laying around, so that's what I went for.
  • Tier 3: The Samsung Galaxy S2 and Galaxy Nexus. Folks are tinkering, but Tier 2 is your best shot.

So that's half the battle. Now to download, compile and flash B2G.

There were a couple of choices there, as well. One is to build on a Linux box. Mozilla spells out all the required tools you'll need, but it doesn't show you where to get them. Me being a Linux n00b, that's a bad thing. For most of the rest of the nerds using one distro or another, it should be less of a thing.

The other option is to build on a Mac. And Mozilla made it stupidly simple. 

Mozilla Boot to Gecko

So how did you do it?

Again, I did this on a Mac. And there really were just a few basic steps that even my non-bearded neck was able to follow.

  1. I had to install Xcode, which is the development environment for Mac.
  2. I installed Homebrew for Mac.
  3. I ran a script that Mozilla provided, which checked for the other prerequisites and prompted me to install them if needed.

At this point I'll note that Mozilla's instructions seemed to indicate that all I had to do was install Xcode and then run the script; the rest would take care of itself. But I had to install Homebrew on its own first. I'm not sure if that's because of something I did (or didn't) do, or what. But that's how it worked for me.

Next up: Fetch all the code from Git. That was as simple as copying and pasting another few lines into Terminal. Cool.

Then: Compile.

Now, these last couple of steps took a while. I'm not sure how long. I went away and did stuff. Made some coffee. Ran some errands. Wrote a book. It took a while on my little MacBook Air. I expected that. This isn't an overly difficult project, but neither is it overly quick. I let things run their course and ended up with a flashable image in the new "B2G" directory of my MBA.

Mozilla Boot to Gecko

Time to flash

So. Time to grab that Nexus S. It'll need to have an unlocked bootloader, of course, and it needs to be running Android 4.0 Ice Cream Sandwich. (Mozilla doesn't say anything about Jelly Bean, but I got it to work with it, too. Not too surprising.)

Fire the phone into fastboot mode and plug it in. Nothing we haven't done before with Android, right/

Now, again, Mozilla's made this really easy. I haven't bothered fixing my path variables, so adb and fastboot normally live within one folder of my Android SDK, and that's that. I can deal with that. Mozilla's smartly included all that. But even better is that it made a little script that does everything. It checks for whether the bootloader is unlocked. It erases all the partitions it needs to erase. Then it flashes the new images. Completely hands-on. That's nothing I couldn't have done myself, but I'm nothing if not occasionally lazy. Cheers, Mozilla.

Reboot, and, boom. We've Booted to Gecko.

Put it together and what have you got?

And now, for the fruits of our labor.

The bottom line

So that's Mozilla's Boot to Gecko on a Samsung Nexus S. Not a bad little project, actually. It took a couple hours, a working Nexus S and some hard drive space, but it wasn't too taxing on the brain. Once you have it flashed onto the phone, you can back it up using custom Android recoveries, then come and go as you please. 

I'd give this a 6 out of 10 on the difficulty scale, only because I really don't know what I'm doing when it comes to compiling code. But I follow directions pretty well, and Mozilla made things nice and easy. This is one you can attempt yourself.

 
There are 17 comments

Reader comments

Weekend project: Build Mozilla's Boot to Gecko for your Android smartphone

17 Comments
Sort by Rating

nice! I saw your post about b2g the other day and I also went seeking out some instructions...but I don't use mac, so i went the ubuntu route. You've inspired me to actually dive into it and try getting it running on my ns4g :)

I hope the steps aren't much harder than the mac ones are...I'm only slightly less n00b than you describe yourself as being lol

Android is Linux based.
WebOS is Linux based.
ChromeOS is Linux based.
Magenta is Linux based.
MeeGo is Linux based.
Tizen is Linux based.
Moblin is Linux based.
Maemo is Linux based.

Don't ATM's run on Linux as well? and Toyota's are using Linux now also.

Oh, and my car stereo runs Linux as well (Parrot Asteroid)

I get that this CAN be done...but how about a reason WHY it should be done?

I'm all for rooting, playing, and customizing. I run aGnex and n7. But I don't get why I would want to essentially install a half baked project that gives me no app access.

But, I'm willing to check it out if there's a reason to do it. So why?

Trying new things and new projects is a good thing. It's like exploring new tech frontiers more or less. And it's not like they're advocating doing this on a daily-driver device either.

MANY people like to toy with and work with their devices (snicker). It's a hobby, it's what they enjoy doing. Explaining the 'why' of a hobby is a philosophical question.

ui-wise.. now it seems ios and android seem really boring
creativeness is different: look for meego, wp and boot2gecko