Introduction to the Android startup process

Source: Internet
Author: User

Android startup process: 1.Linux OSBootloader Linux Kernel2.Android/init RuntimeSystem Server3, ZYGOTE/VM, Services, Init Process.Framework homescreenServer Manager, Home luncher such as: Android startup process:1. System Boot Bootloader1). Source code Bootable/bootloader 2). After power on, the CPU will execute the bootloader program first, there are three cases: A. fastboot mode is command or SD card burning mode, do not load the kernel and file system, here can be burned in Factory mode B. Recovery mode, loading re Covery.img, which contains the kernel and the basic file system, used for engineering mode burning C. Normal start, load boot.img, it contains the kernel and basic file system for normal start of the phone.bootloader (assembly language) for the underlying initialization, and load kernel code, and eventually jump to the boot program of the kernel. To put it simply, Bootloader is a program that runs before the operating system runs, which allows the system's hardware and softwareenvironment to a suitable state, ready to run the operating system. This description is more abstract, but it does not have many tasks, and the ultimate goal is to pull the OS up and run. 2. Kernel kernel   1) Kernel core initialization (memory initialization, open interrupt, initialization process table, etc.);
2) initialization of the driver;
3) Start the kernel background (daemons) thread
4) Install root file system
5) start the first user-level process init kernel is loaded by bootloader, Source: Kernel 3. Init 1) Source: system/core/init/*
2) configuration file: system/rootdir/init.rc
init process Program in SYSTEM/CORE/INIT/INIT.C, it is the Android system-specific initialization program, is a kernel-initiated user-level process, and eventually it will be in the form of a background process (daemon) exists. This process mainly has the following functions:3) Create/install the device file/process file/System file node; 4) parse start/init.rc and/init.<machine_name>.rc;
5) Display logo screen;
6) Open device Socket,property socket, child process communication socket;
7) Execute the command or action specified in the script to start the specified service, such as the most basic Servicemanamger and Zygote
8) Enter the dead loop: check if there is an action to be performed, whether to restart a service, listen for a specific event (child process exit, device-related event, property event, new service start)
4. Native Service start--servicemanagerServiceManager belongs to Nativeservice. It will start when the init.rc is executed, as with zygote. Description of ServiceManager in init.rc script: Serviceservicemanager/system/bin/servicemanager
Source: frameworks/native/cmds/servicemanager/service_manager.c
according to System/core/rootdir/init.rc, the INIT process writes all service information to a specific file via Open_keychord () from Service_list (previously parsed from. RC), handle _keychord () reads out one by one and then calls Service_start () to create (fork () and then call Execve () in the child process to execute the service process specified. The services created here belong to the native service, run in Linux space, and provide a specific service to the upper layer via a socket. For example:Console: Shell console service.
servicemanager: Binder Service Manager, managing all Android system Services
vold: volume Daemon, hot-swappable for storage peripherals
ADBD: Android Debug Bridge Daemon, providing ADB-related features
mountd: Equipment Installation Daemon, responsible for equipment installation and status notification
debuggerd: Debug Daemon, request to process the debug process
rild: Wireless Interface Layer (radio interface layer) Daemon.
zygote: Launches Android Dalvik runtime and is responsible for process incubation services.
mediaserver: Start Audioflinger, Mediaplayerservice and Cameraservice. Responsible for multimedia playback related functions, including audio and video decoding, display output and so on.
INSTALLD: Package Installs Daemon, provides basic features such as package installation/removal/dex processing
5. ZygoteImportant background Program Zygote1) Source: frameworks/base/cmds/app_process/app_main.cpp, etc.
2) Description: Zygote is a service that is specified to start in init.rc, the command that corresponds to the service is/system/bin/app_process
A) Create a Java Runtime, set up a virtual machine
b) Set up a socket to receive Activitymanangerservice request for fork Application
c) Start the system Server
6. Systems Services System Server
1) Source: Frameworks/base/services/java/com/android/server/systemserver.java
2) Description: By Zygote startup, through the System Manager to manage the Android service (the service here refers to services under Frameworks/base/services, such as satellite location services, clipboard services, etc.)
Systemserver as the 1th sub-process of Zygote, is the Androidthe core of the framework, which is primarily responsible for initializing the Android system and initiating other services. Other Android services are started by Systemserver and run in the process space 7. Desktop launcher 1) Source: Activitymanagerservice.java for the entrance, packages/apps/launcher* realization
2) Description: After the system started successfully systemserver use Xxx.systemready () to notify each service, the system is ready, desktop program home is in the Activitymanagerservice.systemready () Notification of the process established, final call () Kai Launcher  Android Start-up process detailed1. Init process startupA. System/core/rootdir/init.rcB. system/core/init/init.c, init_parser.cc. Init through the main->init_parse_config_file ("/init.rc") in the init.c->parse_config->parse_new_section-> Parse_service-> eventually joins all service to Service_list        Ref:http://blog.csdn.net/maxleng/article/details/5508372http://blog.sina.com.cn/s/blog_415bf60a0100wxd9.html Http://wenku.baidu.com/view/42ebf459be23482fb4da4c33

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.