Android Deep Explore Chapter One experience

Source: Internet
Author: User

This chapter is a simple introduction to Android and Linux drivers.

The first section describes the Android system architecture, which is divided into four layers, from bottom to top in turn:

1. The first layer: The Linux kernel, mainly includes the driver and the management of memory, process, power and other resources of the program.

2. The second layer: C + + code base, mainly includes the Linux. So file and the NDK code embedded in the APK program.

3. Third tier: Android SDK API, direct application-oriented Java APK

4. Layer Fourth: Applications, Java applications for direct end users (APK program)

The second section describes the main work of Android migration

Android porting can be divided into two parts: application porting and system porting. This book is mainly about porting the system. The main goal of Android system porting is to enable Android to run on a specific hardware platform. The Linux kernel is supported for most common CPU architectures. Android's support for various hardware on the platform is also done by the Linux kernel, which is the Linux driver. So for system porting, in addition to porting the CPU architecture, the main thing is to complete the Linux-powered porting.

The abstract hardware layer HAL (Hardware Abstraction Layer) is unique to an Android system that allows the Android SDK to access the Linux driver directly through the HAL. If you add or modify the driver for Android, the HAL code must also be changed.

However, the drivers for different versions of the Linux kernel are not generic, and the source code must be modified and re-compiled under the new Linux kernel before it can be used on the new Linux kernel. Therefore, in the Linux drive porting, the main consideration is the version of the Linux kernel, for the Android version can not be considered. As long as the Linux kernel version is the same, you can replace each other on different android (and sometimes you need to consider whether Hal and Linux drive capacity).

The third section describes two ways to view the kernel version of a Linux system, as follows:

Execute the following command on the Linux terminal uname–a

Execute the following command on the Linux terminal cat/proc/version

The/proc:linux kernel provides a mechanism for accessing kernel internal data structures and changing kernel settings at run time through the/proc file system. The proc file system is a pseudo-file system that only exists in memory and does not occupy external memory space. It provides an interface for accessing system kernel data in a file system manner.

The fourth section describes the definition rules for the Linux kernel version number

The Linux kernel version number consists of five parts: Major version number, minor version number, revision number, fine-tuning version number and a special tuning description for specific Linux systems.

Section Sixth describes the classification and characteristics of equipment

The hardware of a computer system is mainly composed of CPU, memory and peripherals. Drives are for memory and peripherals (including internal CPU-integrated memory and peripherals)

Linux divides the memory and peripherals into three categories, namely the character device (Character devices), the block devices, and the network devices.

The seventh section describes the Linux driver: LED

Any Linux driver has a load function called when the load is driven and an unload function (called when the driver is unloaded). The load function and unload function are specified by the Mobule_init and module exit macros, respectively.

Android Deep Explore Chapter One experience

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.