After various attempts, I’ve finally figured out how to compile the android source code on Mac OS X 10.6 Snow Leopard. It works on both 64-bit and 32-bit kernels. Here are the steps.

1. Install XCode, Macports, repo, etc.

I assume everyone knows how to do this. Follow the instructions from the Android source page. Just remember to create a new partition that is a case-sensitive partition if you’re using a non case-sensitive primary partition. I’ll start off after you’ve gotten the source from git.

2. Get the following patches.

Notice that I didn’t use “repo download” to get those patches. I realized that repo sometimes “undo” the patches when you download another patch. All bash commands start at the root of your Android source directory.

Patch 12074 - Change Ic4caeff0: Enable building on java 1.6 without conflicts.

This patch will allow you to use Java 1.6 that comes with Snow Leopard instead of Java 1.5.

cd build
git pull git://android.git.kernel.org/platform/build refs/changes/74/12074/3

Patch 11845 – Change I155a531a: Add x86-64 checking for Darwin

This patch will add x86-64 checking for Darwin.

cd system/core
git pull git://android.git.kernel.org/platform/system/core refs/changes/45/11845/3

Patch 11846 – Change Id241a12d: Force gcc-4.0 for qemu build on Mac OS X

This patch allows qemu to build.

cd external/qemu
git pull git://android.git.kernel.org/platform/external/qemu refs/changes/46/11846/3

Patch 12597 – Change I0a8c2440: Use intptr_t for args expecting pointers

This patch allows libacc to compile.

cd system/core
git pull git://android.git.kernel.org/platform/system/core refs/changes/97/12597/1

3. Build and watch it fly.

make

I haven’t quite tested the image files and binaries but it seems to me like it works pretty well. Now to get my hands dirty and start messing around with the actual code.

Oh and remember, every time you do a repo sync, you might have to reapply some of the patches. I’m not too sure why. If there’s anyone who understands git well enough, please explain.

(UPDATE): New updated blog post for Android 2.1 – Compiling Android 2.1 Eclair Source on Mac OS X 10.6 Snow Leopard

© 2009 - 2011 JustinLee.sg Suffusion theme by Sayontan Sinha
Stop SOPA!

SOPA breaks our internet freedom!
Any site can be shut down whether or not we've done anything wrong.

Stop SOPA!