What does Android do?

Source: Internet
Author: User
Android consists of six parts:

Applications (Java)
--------------------------------

Framework (Java)

============================================
| Core Libraries
External lib | --------------
| Dalvik (JVM)
|
-----------------------------------
Hal
==========================================
Linux Kernel

Part 1: Kernel

First, pull down the kernel code.

1 git clone git: // android.git.kernel.org/kernel/common.git
Git clone git: // android.git.kernel.org/kernel/common.git-O eclair
Git clone git: // android.git.kernel.org/kernel/common.git-O v2.6.29
How is the kernel version always 2.6.27? The kernel version I want is 2.6.29, because after 2.6.29
(Although the support for is not supported, most of the drivers of are not) but not in 2.6.27.
Solution: git branch-
Git checkout v2.6.29/Android-2.6.29
If makefile is modified, the following error occurs:
Error: You have local changes to 'makefile'; cannot switch branches.
First, recheckout The makefile.
Git checkout makefile
Then git checkout v2.6.29/Android-2.6.29

2 make menuconfig acrh = arm
Then compile
An
In File sorted ded from arch/ARM/plat-s3c/include/plat/cpu-freq.h: 14,
From ARCH/ARM/mach-s3c6410/CPU. C: 32:
Include/Linux/cpufreq. h: 258: 31: Error: macro parameters must be comma-separated
Make [1]: *** [ARCH/ARM/mach-s3c6410/CPU. O] Error 1

Solution:
# Define cpufreq_exit_idle (int cpu, unsigned long ticks) Do {} while (0)
To:
# Define cpufreq_exit_idle (CPU, ticks) do {} while (0)

3 what are the main changes to the kernel of Android?
1) Use yaffs2
In the file system fs/yaffs2
2) added alarm, ashmem, binder, power management, logger, kernel debugger, low memory killer
Among them, binder and logger are under driver/staging/android.
Alarm in Driver/RTC/alarm. c
Binder is used by application IPC, while power managerment is called by Android. OS. powermanager.

I downloaded a 2.6.29 version from the Linux official website and compared it with 2.6.29 of Android, I found that there are still many differences.
Therefore, it is best to port some related drivers on the basis of Android 2.6.29 instead of porting android to Linux 2.6.29.

4. Where is the GPS driver of kernel?
In Android, GPS. H is defined and you need to implement GPS driver by yourself according to GPS. h.

5 Android added goldfish to support emulator
In the kernel source code directory:
Git checkout origin/Android-goldfish-2.6.29
CP./ARCH/ARM/configs/goldfish_defconfig. config
Modify makefile, use the arm-2008q3 compiler, and then make arch = arm will generate zimage
This image can be run under emulator


Part 2 hal
Hal is not a driver in the hardware directory. It actually belongs to the user space rather than the kernel layer.
That is to say, Hal is used to separate upper-layer applications and services from lower-layer systems. In earlier versions of Android, there is no such layer. After 1.0, the Hal layer is obvious.
For example, for the backlight setting, we can implement a lights. Default. So dynamic library, which implements the set_light interface, and set_light will open the kernel
Device, and then perform operations (through Io control, or write) to adjust the backlight.
There is a RIL (radio interface layer) in Hal, mainly for the telephone Function
 
Part 3 External libs
This part is under external
1. It uses bionic instead of glibc
Bionic is faster and smaller, but does not fully support POSIX standards, such as C ++ exceptions, wide char
Other toolchains cannot be used to compile android
I personally think that the speed of the system is not closely related to glibc. The slowness of Android is caused by the platform rather than glibc,
Therefore, it is unwise for Android to replace glibc with Bionic. Therefore, it is better to develop its own compiler toolchain and bionic to focus on platform development.
Is it to bypass GPL?

2. Use opencore instead of mplayer
Support for hardware/software codec plug-ins

3. SQLite instead of db4o
In this way, many Java developers need to modify Database Operations unless db4o is transplanted to Android (db4o can run seamlessly on the Android platform)

Part 4 Dalvik Virtual Machine
This part is the core of Android. In the directory Dalvik, compile and generate dalvikvm
It differs from standard JVM
1) Dalvik is based on registers, while JVM is based on stacks.
2) Performance Optimization and standard JVM

It is a subset of j2se, but does not pass java standard authentication and supports swing. The standard interface class of j2's is the class in the lcdui package, and does not support swing.
See http://www.mcuol.com/Tech/122/29755.htm

Part 5 Framework
This part is under the framework. Including
. Activity Manager
• Telephony Manager
• Window Manager
• Power Manager
• Resource Manager
• Notification Manager
It provides an interface called by the application.

Part 6 Applications
Google provides many applications, which are under the packages directory. For example, there are many applications under packages/apps.
These applications are also written in Java, including Google Maps, browsers, and Google stores.

In addition to the above 6 parts, Android also provides a set of toolchain, in prebuilt/linux-x86/toolchain/has arm cross compiler. for native applications, Android toolchain must be used for compilation. Other toolchain compilation programs cannot be used on the Android platform, because other programs are not bionic. for kernel, uboot can be compiled using other toolchains. Because kernel and uboot are independent, glibc is not used.
The toolchain supports arm V5 and later versions. Therefore, to port Android, if the CPU is arm V4 such as S3C2440, you must also port toolchain in addition to kernel.
However, it is strange that I use the android toolchain to compile the kernel, there is an error, but the arm2008-q3 is no problem ???
FS/binfmt_aout.c: In function 'Load _ aout_binary ':
FS/binfmt_aout.c: 270: Error: 'segment _ SIZE 'undeclared (first use in this function)
FS/binfmt_aout.c: 270: Error: (each undeclared identifier is reported only once
FS/binfmt_aout.c: 270: Error: for each function it appears in .)
Solution:
Userspace binary formats --->
Kernel support for A. Out and ecoff binaries.

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.