Android init process in detail (i)

Source: Internet
Author: User

The software version used in this article

android:4.2.2

Linux kernel: 3.1.10

     This article and a few subsequent articles will be on the Android initialization (INIT) process in detail, stripped silk cocoon analysis, and in which a lot of knowledge, and hope that the reader understand the Android startup process and help. This chapter mainly introduces the determination of the hardware-related initialization file name and the principle and implementation of the attribute service.

     Android is essentially a Linux kernel-based operating system. Similar to Ubuntu Linux, Fedora Linux. Just Android has added some unique support for mobile devices in the application layer. Since Android is a Linux kernel system, the basic boot process should also conform to Linux rules. If you have studied other Linux systems, it should be understood that a complete Linux system will first load a Linux kernel into memory, that is, compiling the Bzimage file generated by the Linux kernel source code, The Zimage file is generated for Linux kernel source code optimized for Android. This file is the binary version of the Linux kernel. Since Zimage is running in kernel space, and our usual software is running in application space (for a detailed description of kernel space and application space, refer to the contents of the book "Android Deep Exploration (Vol. 1): Hal and Driver Development", In subsequent volumes will be a comprehensive analysis of Android's overall system). Kernel space and application space cannot be accessed directly through the memory address level, so there is a need to establish some kind of communication mechanism.

     There are many communication mechanisms in Linux that can interact between user space and kernel space, such as device driver files (located in the/dev directory), memory files (/proc,/sys directories, and so on). Everyone who knows Linux should know that one of the important features of Linux is that everything is in the form of files, for example, a device usually corresponds to one or more device files. These files that interact with the kernel space are in user space, so when the Linux kernel is loaded, you need to first build the directory where the files are located. The process of completing these tasks is the init that this article describes. Init is a command-line program. One of its main tasks is to establish the directory where these files interact with the kernel space. When the Linux kernel is loaded, the first thing to do is to call the INIT program, which means that Init is the first program that user space executes.

Before analyzing the core code of INIT, it is necessary to understand that Init does the following work in addition to creating some directories.

1. Initialize Properties

2. The command to process the configuration file (primarily the init.rc file), including handling various actions.

3. Performance analysis (using the Bootchart tool).

4. Infinite loop Execution command (start other processes).

Although Init does not do a lot of work, the code is very complex. The INIT program is not made up of a source code file, but is linked by a set of source file target files. These files are located in the following directory.

<android source code This directory >/system/core/init

Where init.c is the main file for Init, now open the file and look at the contents of it. Since Init is a command-line program, parsing init.c should start with the main function, and now it's good to the main function

Http://androidguy.blog.51cto.com/974126/1178404Android of the Init process (i)

Android init process in detail (i) (GO)

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.