Full documentation for init process.

1,121 views
Skip to first unread message

jui...@gmail.com

unread,
Dec 13, 2013, 2:41:10 AM12/13/13
to android...@googlegroups.com
Hi,
Because I was digging sources and Internet for long time with this topic and didn't find some full documentation for this I dare to ask someone here.
I'm having some troubles with porting Android to some new device so that's why I choose this group.

During the study of init.rc doc (https://android.googlesource.com/platform/system/core/+/master/init/readme.txt) I had feeling that no one care about proper documentation.
Let see some example:
In readme.txt is written:
"Actions and Services implicitly declare a new section. All commands
or options belong to the section most recently declared.  Commands
or options before the first section are ignored."

Then I look into example file (from: https://android.googlesource.com/platform/system/core/+/master/rootdir/init.rc) and see, that firs command is the "include" but it is command (placed in section commands in readme.txt) so it should be ignored. Why is not ignored? Why is not proper described? What happen if I include file which is on partition which isn't mounted at beginning?

Then I started looking closer and deeper and here is another example of lack of lack of consistency: Triggers.
readme.txt:
"Actions take the form of:
on <trigger>
    <command>
     ...

Triggers
   ...
boot
   ...
<name>=<value>
   ...
device-added-<path>
device-removed-<path>
   ...
service-exited-<name>
   ..."

So what is that in example init.rc like:
on early-init
on init
on fs
on post-fs

There is no documentation for this (even "do not touch this sections"), no definition in keywords.h or init_parser.c after digging more finally I have it! In file init.c function main there is section of parsing those "Triggers" but when this is triggered? Which goes first? How init recognizing that now is "init" part of process, or "fs".

Then looking closer I see some another crucial label for init process called: "charger". Where it is came from? Why some boot has "charger" option. When?
Why this is not documented if this is important part of init process?

So is there any real, I mean REAL documentation for whole Android init process?
Because this what is provided by AOSP is really poorly written. To not say "slovenly".

I will be really thankful for giving me some ideas and "breadcrumbs" for understanding whole booting process in init part as well as what I should care most with porting Android to new device.

Thanks
Kamil

Glenn Kasten

unread,
Dec 13, 2013, 10:50:39 AM12/13/13
to android...@googlegroups.com
As you have found, the internal documentation is sometimes out-of-date.
In cases like this, the authoritative reference is the source code
in system/core/init/

A general web search for this topic finds a number
of articles on this subject.  I can't vouch for the accuracy of them all,
but some of them might be helpful to you.

If you would like to help improve the documentation, please see

ri9000

unread,
Aug 25, 2014, 9:58:38 AM8/25/14
to android...@googlegroups.com
<juiczek@...> writes:
> Because this what is provided by AOSP is really poorly written. To not say
"slovenly".
>
>
> I will be really thankful for giving me some ideas and "breadcrumbs" for
understanding whole booting process in init part as well as what I should
care most with porting Android to new device.
>
> Thanks
> Kamil
>

Kamil I agree with you 100%.

The documentation is TERSE in the extreme..

It is woefully inadequate.

This lack of information is what drove me away from Microsoft years ago.

If "Android" doesn't pick up the "game" I will go elsewhere.

Sure it is rapidly evolving but, it is NOT good enough to put all the

responsibility onto the opensource community.

Especially when many are making lots of money out of us.
Richard.


Stuart Small

unread,
Aug 25, 2014, 1:42:37 PM8/25/14
to android...@googlegroups.com
I've found the O'Reilly Embedded Android book to be really useful.  It has a good section on init and might clear up a lot of your questions.  Just keep in mind it is a little out of date and sometimes too high level, but it makes a good first step for a lot of Android platform questions.
Reply all
Reply to author
Forward
0 new messages