Saturday, August 2, 2008

Android File System

Android emulator has 3 basic images on tools/lib/images directory.

  • ramdisk.img
  • system.img
  • userdata.img 

ramdisk.img is gziped cpio archive (cpio is a binary file archiver and a file format). ramdisk image is very small and contains configuration files, and some executable files such as init and recovery. The init file is not a regular system V init. It is made just for the Android and do special things to start up the Android system.

system.img and userdata.img are VMS Alpha executable. system.img and userdata.img have the contents of /system and /data directory on root file system. They are mapped on NAND devices with yaffs2 file system. /dev/block/mtdblock0 for /system and /dev/block/mtdblock1 for /data.

/system directory has libraries and default system packages (*.apk). /data directory has timezone, cache, and ApiDemos.apk package.

The main services are zygote(/system/bin/app_process), runtime(/system/bin/runtime), and dbus(/system/bin/dbus-daemon). You can see the /etc/init.rc file on the Android ramdisk image.

... zygote {     exec /system/bin/app_process     args {         0 -Xzygote         1 /system/bin         2 --zygote     }     autostart 1 } 
runtime {     exec /system/bin/runtime     autostart 1 } ... 
dbus {     exec /system/bin/dbus-daemon     args.0 --system     args.1 --nofork     autostart 1 } ...