Your SlideShare is downloading. ×
0
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Init of Android
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Init of Android

5,626

Published on

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,626
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
272
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Init of Android 2010.12.10Tetsuyuki Kobayashi 1
  • 2. Who am I? 20+ years involved in embedded systems  10 years in real time OS, such as iTRON  10 years in embedded Java Virtual Machine  Now GCC, Linux, QEMU, Android, … Blogs  http://d.hatena.ne.jp/embedded/ (Personal)  http://blog.kmckk.com/ (Corporate) Twitter  @tetsu_koba 2
  • 3. Todays topic /init Boot part of init Daemon part of init Check it out using debugger 3
  • 4. /init Quite different from usual Linux system Add ”init=/init” in kernel boot parameter. Kernel searches only the following init  /sbin/init  /etc/init  /bin/init  /bin/sh
  • 5. /init Android init is static linked. So it can run standalone  (Linux /sbin/init is dynamically linked. If some trouble in dynamic link system, the whole system wont work)
  • 6. Component of init See the source code of init  system/core/init Init is made of 2 parts: boot part and daemon part  At first, boot part is executed once  After that daemon part executed repeatedly
  • 7. int main(int argc, char **argv){ /* Boot part   */  for (;;) { /* Daemon part */ }}
  • 8. Boot part Setup the directories  /dev  /proc  /sys Parse /init.rc and execute it Yokohama Android Platform club has a lot of information for this topic (written in Japanese)
  • 9. Daemon part Waiting for 4 fds by poll system call and handle these in forever loop  device_fd  property_set_fd  signal_recv_fd  keychord_fd
  • 10. device_fd Receiving the device status notification from kernel and create or remove device files under /dev In usual Linux system, udevd do this.
  • 11. property_set_fd Waiting for write request for system property Init process maintains master data of system property. The other processes share it in read only mode by android ashmem mechanism. (Lets talk this in other session)
  • 12. signal_recv_fd Waiting for exiting child process and finish them by waitpid system call If the child process is registered as service, restart it as registered info.
  • 13. keychord_fd Monitoring special key comination and start the associated service Effective only if system property ”ro.debuggable” == ”1” || “init.svc.adbd” == “running” No services use this in default init.rc
  • 14. See also KMC blog ”init of Android”  http://blog.kmckk.com/archives/3137191.html  This page have links of Yokohama Android Platform club, too.  Written in Japanese
  • 15. Q&AThank you for listening!Any comments to blogs are welcome. 15

×