Android init. rc

Source: Internet
Author: User

Source: http://hi.baidu.com/donghaozheng/blog/item/e2f5045577cb73c8b645aec0.html

Excerpted from "detailed explanation of Android system principles and development points"

In Android, the startup script init. rc can perform some simple initialization operations during system initialization. This script is directly installed in the root file system of the target system and parsed by the init executable program. Init. rc is the startup script executed after init is started. Its Syntax mainly includes the following:

Commands: Command
Actions: Action
Triggers: Triggers
Services: Service
Options: Options
Propertise: Properties

(1) Commands is some basic operations, such:
Mkdir/sdcard 0000 system
Mkdir/system
Mkdir/data 0771 system
Mkdir/cached 0770 system cache
Mkdir/config 0500 root
Mkdir/sqlite_stmt_journals 01777 root
Mount tmpfs/sqlite_stmt_journals size = 4 m
These commands are parsed In the init executable program, and then relevant functions are called for implementation.

(2) Actions (Action) indicates a series of commands, which are usually called in Triggers (Triggers). The action and trigger condition form is:
On <trigger>
<Command>
<Command>
<Command>
Example:
On init // init is the trigger condition. After triggering, export and mkdir are used as an Action.
Export PATH/sbin:/system/bin:/system/xbin // set the environment variable
Mkdir/system // create a directory

(3) Services usually start an executable program. Options are additional content of the service for use with the service.

Service vold/system/bin/vold
Socket vold stream 0660 root mount

Service bootsound/system/bin/playmp3
User media
Group audio
Oneshot

Vold and bootsound are the names of the two services, respectively./system/bin/vold and/system/bin/playmp3 are their corresponding executable programs.
Socket, user, group, and oneshot are the options used with the service. The oneshot option indicates that the service is started only once. If the oneshot option is not available, the executable program will always exist. If the executable program is killed, it will be restarted.

(4) Properties are some values used in the system and can be set and read.

Setprop ro. FOREGROUND_APP_MEM 1536
Setprop ro. VISIBLE_APP_MEM 2048
On property: ro. kernel. qemu = 1
Start adbd
Setprop is used to set attributes. on property can be used to determine attributes. The attributes here are consistent throughout the Android system.

For the keyword of the init script, refer to the system/core/init/keyword. h file of the init process.
For how to use init. rc, refer to the instruction file system/core/init/readme.txt.

To modify the startup process, you only need to modify the content in init. c (system/core/init) or init. rc.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.