Upload
ron-munitz
View
55
Download
1
Embed Size (px)
Citation preview
Android Init et. al Ron Munitz - android-4.4_r1 (.a.k.a “KitKat”)
The init call graph
init init.rc
init.environ.rc
init.<anboot.hw>.rc
import /init.environ.rc - env. variables
import /init.usb.rc - USB configuration - defines Android as the slave on the USB bus - with some mode switching options
import /init.${ro.hardware}.rc - androidboot.hardware
import /init.trace.rc - system wide tracing to the kernel trace buffer
init
Kernel/init/main.c
system/core/init
system/core/rootdir
device/vendor/product/init.hw.rc
init.usb.rc
init.trace.rc
system/core/initREAD: readme.txt
Syntax
● on <trigger> <do stuff>
● service <example> <path> <arguments> user <SomeUser_lets_say_root> group <SomeGroup_lets_say_system> class <start me with the rest of the class> oneshot
Gotcha’s
● Service name MUST not be too long!○ service the_most - OK! :) ○ service the_most_important_service_in_the_world - NOT :(
● Start services at appropriate times (class)● Beware of the critical option
○ 4 crashes in 4 minutes will cause device reboot● Watch for user/group● Unnamed class will assume “default”
Gotcha’s
● Service must be started○ service the_most - OK! :) ○ service the_most_important_service_in_the_world - NOT :(
● Start services at appropriate times (class)● Beware of the critical option
○ 4 crashes in 4 minutes will cause device reboot● Watch for user/group● Unnamed class will assume “default”
Debugging tips
● getprop is a life server○ getprop init.svc.<service_name> tells the status of
the service■ running, stopped,restarting
○ getprop init.action tells the action currently being executed
○ getprop init.command tells the command currently being executed
A note about the readme file
● There is no such thing as “init.conf”. They actually refer to “init.rc”.○ For example, “on boot” is the first trigger called
after the init process loaded the file init.rc
TutorialHello world native service
@see https://github.com/ronubo/AnDevCon/tree/master/aosp_kvm