The relationship between Linux and Android

  

Everyone knows that Android is based on the Linux kernel operating system
, and once and the Linux Foundation have had differences due to kernel issues, this article will begin to analyze the Android kernel, It mainly introduces the relationship between Android and Linux, and will also talk about some functions and drivers of the Android system extended on the Linux system.

Although Android is based on the Linux kernel, there is still a big difference between it and Linux. For example, Android adds its own unique driver to the Linux kernel. Let's analyze what is the relationship between them?

First, why does Android choose Linux

There are many mature operating systems, but why does Android choose to use Linux kernel? This is related to some features of Linux, such as:

1, powerful memory management and process management scheme

2, permission-based security mode

3, support Shared library

4, certified driver model

5, Linux itself is an open source project

More information about the above features can refer to the official documentation of the Linux 2.6 kernel This makes it easier for us to better understand the features unique to Android in later learning. Next, analyze the relationship between Android and Linux.

Second, Android is not Linux

When you see this title, you may be confused. I have not always said that Android is based on the Linux kernel. How is it not Linux now? Confusion is also normal, please look at the following points first, then we will analyze each point, after reading, you will think that Android is not Linux.

Because it doesn't have a local window system, there is no glibc support, and it doesn't include a full set of standard Linux applications, and Linux is enhanced to support its unique drivers.

1. It does not have a local window system

What is a local window system? The local window system refers to the X window system on GNU/Linux, or the Quartz of Mac OX X. The window system of different operating systems may be different. Android does not use (and does not need to use) Linux's X window system. This is a basic reason why Android is not Linux.

2. It does not have glibc support

Because Android was originally used on some portable mobile devices, Android may not use glibc as a C library for efficiency and other reasons. Instead, Google developed a set of Bionic Libc instead of glibc.

3. It does not include a whole set of standard Linux applications.

Android does not completely copy the kernel of the Liunx system. In addition to correcting some of the Liunx bugs, it adds a lot of content. For example, it is based on the Gold-Fish platform added by the ARM architecture, and the yaffs2 FLASH file system.

4.Android-specific drivers

In addition to these differences, Android has also enhanced Linux device drivers, mainly as shown below.

1) Android Binder A driver based on the OpenBinder framework for providing InterProcess Communication (IPC) functionality on the Android platform. The source code is located at drivers/staging/android/binder.c.

2) Android Power Management (PM) A lightweight Android power management driver based on a standard Linux power management system that is optimized for embedded devices. The source code is located at:
kernel/power/earlysuspend.ckernel/power/consoleearlysuspend.ckernel/power/fbearlysuspend.ckernel/power/wakelock.ckernel/power/userwakelock.c

3) Low Memory Manager (Low Memory) Killer) is more flexible than Linux's standard OOM (Out Of Memory) mechanism, which kills processes as needed to free up the memory needed. The source code is located at drivers/staging/android/lowmemorykiller.c.

4) Anonymous shared memory (Ashmem) provides large shared memory between processes, while providing the kernel with a mechanism to recycle and manage this memory. The source code is located at mm/ashmem.c.

5) Android PMEM (Physical) PMEM is used to provide a continuous physical memory area to the user space, DSP and some devices can only work in continuous physical memory. The source code is located at drivers/misc/pmem.c.

6) Android Logger A lightweight log device for crawling various logs of the Android system. The source code is located at drivers/staging/android/logger.c.

7) Android Alarm provides a timer to wake the device from sleep, and it also provides a clock reference that runs even when the device is asleep. The source code is located at drivers/rtc/alarm.c.

8) USB Gadget Driver A device driver based on the standard Linux USB gadget driver framework. The Android USB driver is based on the gadget framework. The source code is located at drivers/usb/gadget/.

9) Android Ram Console In order to provide debugging capabilities, Android allows debugging log information to be written to a device called RAM Console, which is a RAM-based Buffer. The source code is located at drivers/staging/android.

10) Android timed device provides timing control for devices, currently supports vibrator and LED devices. The source code is located at drivers/staging/android /timed_output.c(timed_gpio.c).

11)Yaffs2 File System Android uses Yaffs2 as the MTD nand flash file system. The source code is located in the fs/yaffs2/directory. Yaffs2 is a fast and stable cross-platform embedded device file system for NAND and NOR Flash. Compared with other Flash file systems, Yaffs2 can use smaller memory to save its running state, so it takes up less memory. Yaffs2's garbage collection is very simple and fast, so it can perform better. Yaffs2's performance on large-capacity NAND Flash is particularly outstanding, which is very suitable for large-capacity flash storage

Copyright © Windows knowledge All Rights Reserved