Android启动脚本init.rc(三)

2014-11-24 03:29:32 · 作者: · 浏览: 11
e insight into
what it's doing:


init.action
Equal to the name of the action currently being executed or "" if none


init.command
Equal to the command being executed or "" if none.


init.svc.
State of a named service ("stopped", "running", "restarting")



Example init.conf
-----------------


# not complete -- just providing some examples of usage
#
on boot
export PATH /sbin:/system/sbin:/system/bin
export LD_LIBRARY_PATH /system/lib


mkdir /dev
mkdir /proc
mkdir /sys


mount tmpfs tmpfs /dev
mkdir /dev/pts
mkdir /dev/socket
mount devpts devpts /dev/pts
mount proc proc /proc
mount sysfs sysfs /sys


write /proc/cpu/alignment 4


ifup lo


hostname localhost
domainname localhost


mount yaffs2 mtd@system /system
mount yaffs2 mtd@userdata /data


import /system/etc/init.conf


class_start default


service adbd /sbin/adbd
user adb
group adb


service usbd /system/bin/usbd -r
user usbd
group usbd
socket usbd 666


service zygote /system/bin/app_process -Xzygote /system/bin --zygote
socket zygote 666


service runtime /system/bin/runtime
user system
group system


on device-added-/dev/compass
start akmd


on device-removed-/dev/compass
stop akmd


service akmd /sbin/akmd
disabled
user akmd
group akmd


Debugging notes
---------------
By default, programs executed by init will drop stdout and stderr into
/dev/null. To help with debugging, you can execute your program via the
Andoird program logwrapper. This will redirect stdout/stderr into the
Android logging system (accessed via logcat).


For example
service akmd /system/bin/logwrapper /sbin/akmd