Android Kernel Features

From eLinux.org
Revision as of 13:52, 5 January 2010 by Tim Bird (talk | contribs) (Binder: add implementation info)
Jump to: navigation, search

List of Kernel features unique to Android

Binder

  • Binder - corba-like IPC
    • used instead of SysV IPC for interprocess communication
    • The Linux version of Binder was originally derived from a project by PalmSource to implement a CORBA-like message-passing or method invocation system. Documentation on that system is at: http://www.angryredplanet.com/~hackbod/openbinder/docs/html/index.html
    • implementation is at: drivers/android/binder.c, with include file: include/linux/binder.h

ashmem

  • ashmem - Android shared memory
    • implementation is in mm/ashmem.c

According to the Kconfig help "The ashmem subsystem is a new shared memory allocator, similar to POSIX SHM but with different behavior and sporting a simpler file-based API."

Apparently it better-supports low memory devices, because it can discard shared memory units under memory pressure.

To use this, programs open /dev/ashmem, use mmap() on it, and can perform one or more of the following ioctls:

  • ASHMEM_SET_NAME
  • ASHMEM_GET_NAME
  • ASHMEM_SET_SIZE
  • ASHMEM_GET_SIZE
  • ASHMEM_SET_PROT_MASK
  • ASHMEM_GET_PROT_MASK
  • ASHMEM_PIN
  • ASHMEM_UNPIN
  • ASHMEM_GET_PIN_STATUS
  • ASHMEM_PURGE_ALL_CACHES

pmem

  • PMEM - Process memory allocator
    • implementation at: drivers/misc/pmem.c with include file at: include/linux/android_pmem.h
    • Brian Swetland says:
The pmem driver is used to manage large (1-16+MB) physically contiguous
regions of memory shared between userspace and kernel drivers (dsp, gpu,
etc).  It was written specifically to deal with hardware limitations of
the MSM7201A, but could be used for other chipsets as well.  For now,
you're safe to turn it off on x86.

logger

  • logger - system logging facility
    • This is the kernel support for the 'logcat' command
    • The kernel driver for the serial devices for logging are in the source code drivers/android/logging.c
    • See Android logger for more information

wakelocks

  • wakelock - used for power management
    • Holds machine awake on a per-event basis until wakelock is released
    • See Android Power Management for detailed information

oom handling

  • oom handling modifications
    • lowmem notifications

alarm

  • alarm

paranoid network security

timed gpio

Generic gpio is a mechanism to allow programs to access and manipulate gpio registers from user space.

"Timed gpio" appears to be a system to allow for similar gpio manipulation, but with an added capability to automatically set a value in a gpio after a specified timeout.

On my ADP1, there is a driver at:

I'm not sure who uses this, or how it is used, but this is a directory with the following items:

# cd /sys/bus/platform/drivers/timed-gpio
# ls -l
--w-------    1 0        0            4096 Nov 13 02:11 bind
lrwxrwxrwx    1 0        0               0 Nov 13 02:11 timed-gpio -> ../../../../devices/platform/timed-gpio
--w-------    1 0        0            4096 Nov 13 02:11 uevent
--w-------    1 0        0            4096 Nov 13 02:11 unbind

Also, there is a device at:

# cd /sys/devices/platform/timed-gpio
# ls -lR
.:
lrwxrwxrwx    1 0        0               0 Nov 13 01:34 driver -> ../../../bus/platform/drivers/timed-gpio
-r--r--r--    1 0        0            4096 Nov 13 01:34 modalias
drwxr-xr-x    2 0        0               0 Nov 13 01:34 power
lrwxrwxrwx    1 0        0               0 Nov 13 01:34 subsystem -> ../../../bus/platform
-rw-r--r--    1 0        0            4096 Nov 13 01:34 uevent

./power:
-rw-r--r--    1 0        0            4096 Nov 13 01:34 wakeup

Possibly this means that one of the GPIO pins on the ADP1 is tied to a power wakeup event???

Kernel configuration options

The file Documentation/android.txt has a list of required configuration options for a kernel to support an Android system.

Resources