Android Boot Process

Source: Internet
Author: User
1. Boot bootloader

1) source code: bootable/bootloader /*

2) Note: After power-on, the CPU will first execute the bootloader program. There are three options:

  1. Start fastboot by running Camera + power, that is, the command or SD card burning mode, without loading the kernel and file system. The factory mode can be burned here.
  2. Start the system at home + power to recovery mode, load recovery. IMG, recovery. IMG contains the kernel, basic file system, and is used for burning and writing in engineering mode.
  3. Boot press power, boot the system normally, load boot. IMG, Boot. IMG contains the kernel, the basic file system, used to start the mobile phone normally (the following only analyzes the normal startup)
2. kernel Kernel
  1. Source code: kernel /*
  2. Note: The kernel is loaded by the bootloader.
3. File System and Application init
  1. Source code: System/CORE/init /*
  2. Configuration File: System/CORE/rootdir/init. RC,
  3. Description: init is a user-level process started by the kernel. set execution in RC: start the service (the service here refers to the underlying service in Linux, such as adbd to provide ADB support, vold to provide SD card mounting, etc.), execute commands and execute corresponding functions according to the configuration statement
4. Important background program zygote

1) source code: Frameworks/base/cmds/app_main.cpp, etc.

2) Note: zygote is a tool in init. the specified service to be started in RC, the command for this service is/system/bin/app_process source (Service zygote/system/bin/app_process-xzygote/system/bin -- zygote -- start-system-server socket zygote stream 666)

  1. Create Java runtime and Virtual Machine
  2. Establish a socket to receive requests from activitymanangerservice for the fork Application
  3. Start System server
5. System Service System server
  • Source code: Frameworks/base/services/Java/COM/Android/Server/systemserver. Java
  • Note: started by zygote, the android service is managed through System Manager (here the service refers to the service under frameworks/base/services, such as satellite positioning service and clipboard Service)
6. Desktop Launcher
  • Source code: activitymanagerservice. Java is the portal, and packages/apps/launcher * is implemented.
  • Note: After the system is started successfully, systemserver uses XXX. systemready () notifies various services that the system is ready and the desktop program home is in activitymanagerservice. systemready () is created during the notification process, and starthomeactivitylocked () is called to start launcher.
7. Unlock
  • Source code: Frameworks/policies/base/phone/COM/Android/Internal/policy/impl/* Lock *
  • Description: After the system is started successfully, systemserver calls WM. systemready () notifies windowmanagerservice, then calls phonewindowmanager, and finally displays the unlock interface through lockpatternkeyguardview. The tracking code shows that the unlock interface is not an activity. This is just a drawing to a specific layer, the code is stored in a special location.
8. Third-party applications started on startup
  • Source code: Frameworks/base/services/Java/COM/Android/Server/AM/activitymanagerservice. Java
  • Note: After the system is successfully started, systemserver calls activitymanagernative. getdefault (). systemready () notifies activitymanager of successful startup. activitymanager notifies another thread of activitymanager by setting the variable mbooting. This thread will send broadcast android. intent. action. boot_completed to inform registered third-party programs to automatically start upon startup.
9. Summary

To sum up, the core components of system-level startup are zygote (app_process) and system server. zygote is responsible for the establishment of the most basic virtual machine to support the startup of various applications, the system server is used to manage the android background services, including the startup steps and sequence.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.