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 (for the non-nerd explanation of B2G)
- B2G on the Mozilla Developer Network (this is where the real work begins)
- Building and installing 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.
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.
- I had to install Xcode, which is the development environment for Mac.
- I installed Homebrew for Mac.
- 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.
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.
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.
- Filed under: