init.rc Parsing and chmod changing file properties is useless
Turn from: Http://h1372865100.blog.163.com/blog/static/2104291032012929114132327/android's init.rc grammar is unique, it can be said to be a language bar.
INIT.RC syntax is divided into actions (actions), commands (Commands), Service (services), Options .
category |
name |
Description |
Section |
On |
Trigger condition |
Ditto.. |
Service |
Parsing service |
COMMAND |
ChDir |
Change the current working directory |
Ditto.. |
Chroot |
Change the location of the reference's root directory |
.. |
Class_start |
Start a service with the class name set |
.. |
Class_stop |
Stop a service that has a class name set |
.. |
DomainName |
Domain name |
.. |
Exec |
Calling programs and transferring processes |
.. |
Export |
Submit variable |
.. |
Hostname |
Host Name |
.. |
Ifup |
Activate network card |
.. |
Insmod |
Mount Module |
.. |
Import |
Introduction of configuration, such as etc under the RC files, and Java import almost |
.. |
Mkdir |
Create a Directory |
.. |
Mount |
Mount File System |
.. |
Setkey |
From the source view, should be set a command of the keyword abbreviation, such as the DomainName can be mapped to DN |
.. |
SetProp |
Set a property |
.. |
Setrlimit |
Sets the maximum number of files that can be opened by the current program to the maximum number of files that the system requires the program to open |
.. |
Start |
Start a service |
.. |
Stop |
Stop Service |
.. |
Trigger |
Not clear, is it a custom trigger. |
.. |
Symlink |
Create a symbolic link |
.. |
Sysclktz |
Set base Time |
.. |
Wait |
Wait for the file to be ready. This is a function of process scheduling in Linux |
.. |
Write |
Write something to a file or device. It's definitely not the wirte that sent the message. |
.. |
Copy |
Do not explain |
.. |
Chown |
Change owner |
.. |
chmod |
Change permissions |
.. |
LogLevel |
Log output level, below this level of output |
.. |
Restart |
Restart Service |
OPTION |
Capability |
Ability, that is, a system of the process of a privilege control. |
Ditto.. |
Class |
Set class name |
.. |
Console |
Enable Console |
.. |
Critical |
Is the key, that is, 4 minutes to restart more than 4 times, after the reboot into the recovery mode |
.. |
Disabled |
Do not start automatically with class |
.. |
Group |
Group attribution |
.. |
Keycodes |
Don't understand..... |
.. |
OneShot |
Start only once and do not need to reboot after exiting unexpectedly |
.. |
Onrestart |
When restarting |
.. |
Setenv |
Increase environment variables |
.. |
Socket |
Request Socket Resource |
.. |
User |
User ownership |
.. |
Ioprio |
IO scheduling Priority |
(Many of the attributes and command usages are not much different from the commands in Linux)
Init is a segmented (section) parsing init.rc, where you can view the definition of a keyword in keywords.h. What is the symbol of Init to parse init.rc? Combined with the content of init.rc, it can be seen that the segmented markup is marked with on and service. Here is a detailed description.
On what time?
On belongs to the behavior.
on Early-init
Executed before Init, after loading all RC files, in MIUI ROM, init.rc executes the start Ueventd in Early-init, according to the KEYWORDS.H definition, start is a command.
Here, by the way, ueventd,android in the bottom (generally refers to the driver) to notify the upper level of the event, with the UEVENT,JAVA layer through the observer mode implementation, the class used for Ueventobserver, using intent to pass The native layer is android_os_ueventobserver.cpp, using uevent.c to pass through the socket. Of course, this is the framework and the following level, the general development is not often used, not to mention these several classes have not been exposed.
On Init
Executes before the Propety properties file is loaded, before Init becomes propety service, it belongs to the init phase.
On Early-boot
Executes after the property service is started.
On boot
When boot is executed.
On Property:xxxxx=x
Executes when a property is set to the expected value.
About Init.rc, actually combine/src/system/core/init/* source code and Init.rc file look, will understand many.
=========
Sometimes you need to add your own added files to root, and then in init.rc modify the properties of the file found no use, I also toss a half-day, on the internet to see a post:
Create a script somewhere, for example,/system/bin/mymod.rc
#!/system/bin/sh
chmod 0777/dev/mynode
Add the following in/init.rc:
Service Mymod/system/bin/mymod.rc
OneShot
(Note that the table adds the wrong location/system/bin/, is the system directory that generates the filesystem, not the system directory under root)