Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ice Cream Sandwich init.rc documentation

The behavior of init.*.rc in Ice Cream Sandwich seems to have changed. Previously, I had been able to start a service at boot with an entry like:

service my_kool_service /system/bin/my_kool_service

I did find this post, which gave a hint to change to:

service my_kool_service /system/bin/my_kool_service
    class main

So what is class main, and why is it necessary?

This documentation does talk about the class "option", but provides no details on default behavior, or the observed change.

Is the current ICS init rc language documented anywhere, formally or otherwise?

Thank you.

like image 977
Jameson Avatar asked Apr 21 '12 03:04

Jameson


People also ask

What is the init rc file?

Once kernel initialization and startup is done , it then looks for a file called init. rc in system files . Init is the root process or the first user process to start in Android .

Where is init rc file?

All services whose binaries reside on the system, vendor, or odm partitions should have their service entries placed into a corresponding init . rc file, located in the /etc/init/ directory of the partition where they reside.

What is .rc file in Android?

It is a program to initialize the elements of the Android system. Unlike Linux, Android uses its own initialization program. This Android init program processes 2 files, and it executes the commands it finds in both programs. These programs are: 'init. rc' and 'init<machine name>.


2 Answers

As already been said init.rc is documented in this readme. The class service option is used to group services and start and stop them together respectively with commands class_start and class_stop.

Specifically classes core, main and late_start are used in Android 3.0 onwards for encryption (see section "How Android encryption works" in the Notes on the implementation of encryption in Android 3.0). In particular, quoting that document:

Core services are never shut down after starting. main services are shutdown and then restarted after the disk password is entered. late_start services are not started until after /data has been decrypted and mounted.

like image 61
Diego Avatar answered Nov 15 '22 07:11

Diego


If you add a service in a particular class, then you can start the service calling start_class . E.g. If you have 10 services under class test, then by calling start_class test, you can start all 10 services under class test if they are not running already. Same is applicable for stopping all the services also...

See, following link for more details about init.rc language https://github.com/android/platform_system_core/blob/master/init/readme.txt

I hope it will help..:)

like image 35
Paritosh Avatar answered Nov 15 '22 09:11

Paritosh