Using the startup script init.rc in Android, you can perform simple operations in the initialization of the system.
Init.rc Startup script path: system/core/rootdir/init.rc
Content:
- Commands: Command
- Actions: Actions
- Triggers: Trigger Condition
- Services: Service
- Options: Option
- Properties: Attributes
Commands are some basic operations. Such as:
Mkdir/system
Mkdir/data 0771 System System
Mkdir/persist 0771 System System
Devwait/dev/block/mmcblk0p12
Mount ext3/dev/block/mmcblk0p
The action represents a series of commands, usually called in triggers, such as:
On init//indicates a trigger condition
Sysclktz 0
LogLevel 3
# Setup The Global environment
Export Path/sbin:/system/sbin:/system/bin:/system/xbin
Export Ld_library_path/system/lib
Export Android_bootlogo 1
Services typically means that an executable program is launched, and options are additional content for the service to use with the service.
Service Vold/system/bin/vold//vold is the name of the services,/system/bin/vold is the corresponding executable program.
Socket Vold Stream 0660 root mount//socket is the option used with the service
Ioprio be 2
Service netd/system/bin/netd
Socket netd Stream 0660 root system
The options used with the service are socket,user,group,oneshot.
OneShot indicates that the service is started only once, and if there is no oneshot option, the executable will persist-restarting if the executable program is killed.
Properties are some of the values used in the system and can be set up and read and written.
SetProp ro. Hidden_app_mem 5120//setprop for setting properties
SetProp ro. Content_provider_mem 5632
SetProp ro. Empty_app_mem 6144
...
On Property:ro.kernel.qemu=1//on property is used to determine properties
Start ADBD
The properties here are consistent across the entire Android system.
The init script keyword can refer to the System/core/init/keyword.h file in the init process. Such as:
KEYWORD (chroot, command, 1, do_chroot)//chroot is the command, Do_chroot () is a function called, which is set in the System/core/init/builtins.c file in the init process Yi.
Init.rc use method, see the description file System/core/init/readme.txt
Android Boot Script init.rc (2)