Brief introduction to Android init.rc file

Brief introduction to Android init.rc file

The init.rc script is parsed by the first user level process init in Linux in Android.

The init.rc file is not an ordinary configuration file, but a file written by a script called Android init language (hereinafter referred to as AIL).

The file is read-only in ROM. even if you have root permission, you can modify the file. Because the files we see in the root directory are just images of memory files. That is, after Android starts, the init.rc file will be loaded into memory. Modifying the contents of the init.rc file is actually just modifying the contents of the init.rc file in memory. Once Android is restarted, the contents of the init.rc file will be restored to the original load. The only way to completely modify the contents of the init.rc file is to modify the kernel image (boot. IMG) in the Android ROM.

Init.rc script includes many processes of file system initialization and loading. Init.rc mainly works on:

1) Set some environment variables 2) create directories such as system, sdcard, data and cache (see case 1) 3) mount some file systems to some directories, such as Mount TMPFS TMPFS / SQLite_ stmt_ Journals 4) set user groups and permissions for some files 5) set some thread parameters 6) set TCP cache size

The keywords of init script (such as MKDIR, Chmod, service, etc.) can refer to the system / core / init / keyword. H file of init process.

For the usage of init.rc, please refer to the document system / core / init / readme.txt

If you want to modify the startup process, you only need to modify the contents in init. C (system / core / init) or init.rc

The positions of init. C and init.rc in the source code are as follows:

1 init.c : /system/core/init 2 init.rc : /system/core/rootdir

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>