Tuesday, April 24, 2012

Headless Android on Raspberry Pi - Progress Report

I know you are all dying to know how my progress has been going on the Raspberry Pi Android port. Well, it's coming along. 

The Raspberry Pi currently uses a 3.1.9 ARM Linux kernel. The version of Android I decided to port over uses the 3.0.8 ARM kernel. To patch the 3.1.9 ARM kernel with Android, I had to go a circuitous route.

It would have been pretty easy if there were patches already out there that were JUST Android patches. I couldn't find any. I'm sure there is a way, using Git, to isolate the Android patches from the Git Android repository, but I haven't spent enough time playing with Git to do it. So, I went the old fashioned way.

To create my own isolated Android patch, I first needed to find an Android running on a 3.x.x version of the kernel. Ice Cream Sandwich is running against a 3.0.8 kernel (at the time I did this post) so that is where I started. The trick was to not include any ARM patches with the isolated Android patch because I needed to keep all of the Raspberry Pi ARM changes in tact.

So, starting with an x86 3.0.8 Android kernel I found, I created a patch from stock x86 3.0.8 to Android x86 3.0.8. That gave me an isolated Android patch. Then I applied that isolated Android patch to the 3.1.9 Raspberry Pi kernel. That took my Raspberry Pi kernel to an Android kernel.

Now I need to make the modifications to the Ice Cream Sandwich Android to make it a Headless Ice Cream Sandwich (in the shape of an Android, of course.)

Why x86? Well, that's a good question.

In order to get a clean isolated Android patch I needed to start with something that I could:
a) get a good clean stock kernel for, and
b) if there were unnecessary changes to the architecture or driver files they wouldn't affect and ARM system.

I could have attempted an ARM 3.x.x kernel but it's pretty hard to find an ARM kernel (of the 3.x.x revision) with an matching ARM kernel with Android that you would have confidence that the ARM portion is all the same. At least the x86 stuff is fairly well known and consistent.

Stay tuned, more to come!


  1. Any more updates on this? I'm really interested in learning how it's done!

  2. No update. I still don't have hardware to try it on. However, I could send you the kernel source I merged if you are brave enough to try it. I'm sure it won't work right out of the gate, but if you are a kernel hacker you are welcome to try it.

  3. I would be happy to try it, only if you could guide me on how to do it!(Not really a dummies guide, but just an overview.) I'm just getting started with hacking the kernel these days!

  4. Avik, I will try and get a "how to" post up with my kernel source next week so you can try it.

  5. Thanks, that will be great information for me and many others too! :)

  6. Hey, great job you're doing, it's a pity you're still wating for a Pi to try. Do you plan to maybe release a non-headless version as well when it is done?

  7. fodi, Luckily the kernel port won't matter with headless or non-headless. I did not disable the graphics subsystem so any Android root filesystem should work. Having said that, who knows how Android will handle the video output and non-touchscreen input. If you try it let us know.

  8. Avik, I just did a new post with a walk through for building Android for Raspberry Pi. I'm almost positive it won't work out of the box, but give it a try and let me know what you have to change to get it to work.

    Sorry it took so long. My day job got busy.

  9. Thanks for the post! I plan to build the kernel over the weekend. Will keep you updated :)

  10. Replies
    1. Ultimateohm, it should be. You may have to fiddle with the USB settings on the Pi as well as your host, but luckily Android is all pretty standard in that respect so it should work.

  11. Hi,
    I am trying to port headless android ics on i.Mx6 Sabre Lite.
    I looked at the Gingerbread patch to modify the ics aosp but the source is slightly different from ICS.
    Moreover the Surfaceflinger service is still trying to start in the logcat.
    I deleted all what concerned Sufaceflinger in the init.freescale.rc but it's the same.
    I would be grateful If you could hand me a patch to make ics headless from which I could inspire to modify my aosp.

    1. Jérôme,

      I haven't had any free cycles lately to look at this. However, if you grep the sources and just comment out or stub out anywhere the Surfaceflinger is used it should work. Essentially that's what the existing patch does.

      Best of luck. If you get it working let me know and I'll post it.


  12. hi..Im college student, thanks for sharing :)