From: eLinux.org

Android Porting

This page describes various effort to port Android to new boards and new
processors

Contents

Porting Overview

This overview of porting steps was seen on the android-porting list:
See
porting@googlegroups.com/msg06721.html"">http://www.mail-archive.com/android-porting@googlegroups.com/msg06721.html

This glosses over all the kernel work for a new board, and the
android-specific kernel patches, but has some good discussion about the
flash partitioning and file system bringup process.

  1. If the linux kernel is up and running with all drivers in.
  2. (particularly touchscreen and display) it shouldn't be too bad.
  3. IHMO, the easiest way to get you running is to aggregate the initial
  4. ramfs built into the kernel with the Android build, the root Android
  5. root filesystem (system), and the user data section (mounted as /data
  6. I believe) into one root filesystem.
  7. You can then take that root filesystem as one tarball.
  8. Modify the NAND partitioning of the kernel to set aside space for the
  9. whole Android rootfs, and of course rebuild the kernel. (Be sure yaffs
  10. support is in the kernel) Also no need for a ramfs at this point, just
  11. have the kernel look to mtd2 for it's root filesystem, which will be
  12. jffs2
  13. Create yourself a busybox root filesystem too. Make that into a jffs2
  14. image.
  15. So your partitioning would look something similar to this (you'll have
  16. to decide on the sizes of course):
  17. mtd0: bootloader
  18. mtd1: kernel
  19. mtd2: rootfs (jffs2)
  20. mtd3: Android rootfs.
  21. Erase everything on the NAND.
  22. Burn the normal Chumby bootloader to mtd0.
  23. Burn the the new kernel into mtd1.
  24. Burn the jffs2 rootfs image to mtd2.
  25. Boot the device. Hopefully you get yourself to a prompt.
  26. Once you have that prompt mount mtd3 to /mnt/android as a yaffs2
  27. partition.
  28. Untar your Android rootfs into /mnt/android.
  29. Chown and chgrp everything under /mnt/android to "root"
  30. chroot to that mount point "chroot /mnt/android /init"
  31. At this point you should see Android trying to run.
  32. I know that's a bit to chomp on, but it's more of an outline of what
  33. you will need to do. Of course it's assuming you have the ability to
  34. erase the whole nand and put down images amongst other assumptions,
  35. but it should help get your mind around a little bit of the
  36. requirements to get Android running on your device.
  37. Regarding your bootloader question, I'd just stick with the current
  38. one. You'll only need to modify that if/when you go into having
  39. everything compatible with the recovery system. Which is a completely
  40. different discussion.

Porting Tutorials

Porting Issues

  • Matt Porter (Mentor Graphics) gave a presentation on difficulties
    encountered while they were porting Android to MIPS and PPC
    processors at ELC Europe
    2009
    .
    His talk was called “Mythbusters: Android” and has lots of good
    information.

  • Dalvik porting
    guide

  • Matthias Brugger presented his personal “war story” on porting
    Android at ELC Europe 2012. See his
    slides
    on slideshare.

Android Hardware Abstraction Layer

Android talks to standard devices through its hardware abstraction
layer, which overlays the kernel interfaces to devices (e.g. devices
nodes, Linux system calls, etc.). To add support for your own hardware,
or, in particular, to add support to Android for some new type of
hardware, you need to understand this abstraction layer.

Karim Yaghmour has a good blog entry describing the Android HAL layer:
http://www.opersys.com/blog/extending-android-hal

Porting to New Processors

  • Mentor Graphics has ported Android to MIPS and PPC
  • Power.Org supported the work to port Android to PPC

Virtualization environments

There are available some virtualization environments, which allow
Android applications (or the whole system) to run on other Linux-based
systems, such as MeeGo or Ubuntu.

Here is some information about different systems known to exist:

Category: