Android boot time optimization
Rocky @ 20110317
Android boot and most smart phone devices have a common problem. The Speed Optimization here is not from the source code perspective, because I believe Google has done a lot of work. But each person's machine is different. In particular, we are doing mid, and the product is very different. It is necessary to make some cropping work for our own products and use this cropping to optimize our boot speed.
Android boot process:
Bootloader
Kernel
Init
Zygote
Service Manager
Specific analysis:
Bootloader is generally difficult to operate. Here we can also do as few unnecessary latency operations as possible.
Kernel:
This part is divided into two parts:
1: Reduce the driver you do not need. In this way, the kernel size is naturally small. The loading speed is naturally faster.
2: Reduce Unnecessary printing information. In the official version, we need to delete all debugging information. The specific deletion depends on the situation. This article is recommended.
Http://www.elinux.org/Boot_Time
The kernel speedups mentioned in the section includes the following methods:
Disable Console-avoid overhead of console output during system startup.
Disable bug and printk-avoid the overhead of bug and printk. disadvantage is that you loose a lot of info.
....
I personally found that these two points are the most obvious on our machines.
Add quiet to the kernel command string to save the startup time of the kernel for 10 s.
Location:
/Kernel/make menuconfig
[Boot options] and [Default kernel command string]
Add a sentence at the end
Quiet
Init: initialization is actually done. Including load service and zygote.
Zygote:
Its source code is in android_tcgit/frameworks/base/CORE/Java/COM/Android/Internal/OS/zygoteinit. Java
Will do some preloadclasses, preloadresources action. We can
ADB shell logcat-s zygote I
View the printing information of this part. It can be seen that the time consumption in preloadclasses is quite long. However, it is not recommended to modify it. Otherwise, it is the benefit of toothpaste, and the loading time is longer. There are many articles about saving time here.
I advise you not to touch it. The reason for this is that many people will talk about it.
Service Manager.
This load is divided into two parts: one is frameworks/base/services/Java/COM/Android/server code loading, and the other is loading in files similar to init. RC.
Remember to delete things we don't need. For example, we have no Bluetooth. Therefore, you can delete Bluetooth-related items.
In short, the android startup structure has been optimized. The key point is to remove unnecessary things, such as printing information, unnecessary drivers, and service startup items.
References:
Http://www.elinux.org/Boot_Time
Http://elinux.org/Improving_Android_Boot_Time
Http://blog.csdn.net/jackyu613/archive/2010/11/30/6044297.aspx
Http://elinux.org/Improving_Android_Boot_Time_Outline