With our understanding of Android Boot process and profiling of Android Boot Time Analysis, we will now start the actual process of Android boot time optimization.

There is no single solution to improve the boot time applicable to all platforms. The boot process is dependent on each peripheral involved right from DRAM speed, storage device performance, processor speed and also on the customer requirements and kind of application area being used etc. Termed as “Tooth paste effect” by Tim Bird, shortening a process somewhere here will end up lengthening something else over there.

Another important point to remember is that the configuration used for improving must be same as the finally deployment. For example, working on SD Card file system (For ease of programming) to improve the boot time and then finally deploying the result in a NAND file system, will lead nowhere as the data rates of NAND and SD Card will differ.

The following sections describe various techniques module by module for Android boot time optimization.


The boot loader performs a critical initialization that will affect the whole process – DRAM initialization. As the DRAM is going to host the text region and data section, an improper initialization will result in significant performance degradation.

Further the Boot loader copies uboot or Linux kernel image from a non-volatile storage medium such as NAND or SD Card. So the same has to be configured to run in the maximum possible frequency. DMA operations can be used to improve the data transfer through put.

Obviously the processor needs to be run in the highest possible frequency and with I-cache and D-cache enabled.

Unnecessary initializations like initializing display can be removed from the code. But in some applications, it will be required to display images immediately on boot up. For example, it may be required to show a company logo or to show battery status. In this case, it will not be possible to remove the display configuration.

Also the number of boot loader levels should be reduced if possible. This is possible depending on the processor implementation.


Using an uncompressed kernel “bImage” rather than a compressed “zImage” will avoid the delay to uncompress it run time. But this will increase the size of kernel image to be copied, there by significantly dependent of on the target system processor and data transfer speeds.

All the unnecessary driver modules should to be removed. A minimal set of device drivers can be built initially and other necessary drivers can be configured as modules and loaded later. A details study has to be made on the device initialization time, time required to copy the increased kernel image (in case of statically linked driver) or load time of a module over the file system.

File systems

Generally a non-removable media is used as the root file system. Sometimes a ramdisk image can be used as a root file system with certain functionalities there by reducing time to start the init scripts. This can be achieved by using uImage. Once again this will increase  the time required to copy it at the boot loader stage.

Also an optimized file system format can be used for the root file system for faster access. It is preferred to have ubifs for NAND and ext4 for SD Cards.


The below sections describes the techniques to improve the functionality inside the Android subsystem.


For a faster processing, avoid starting unnecessary services and daemons. Also since JellyBean, there are lot of changes in file permissions. So the logcat output can be used to analyse any discrepancies in permissions and corrected.

Android preload classes and resources

In ZygoteInit, Andorid loads all the classes and resources that it will need for further execution. The boot time can be reduced significantly by reducing the number of classes and resources to be preload or even avoiding them all.

This is the easiest process and most visible step in the optimization process. The preloading can be disable by just making the variable “PRELOAD_RESOURCES” false (only to disable preloading resources) or commenting the function “preload()” on “frameworks/base/core/java/com/android/internal/os/ZygoteInit.java” (to disable both resources and classes).

But disabling preloading will directly increase in launch time of individual application after boot up. As a compromise, the number of classes to be preloaded can be manually configured in the frameworks/base/preloaded-classes file.

Android System service

By default, the SystemServer starts all android system services. But some of them may not be applicable for the current system. For example, a device may not have a Bluetooth module, thereby has no need for the BlueTooth manager service. Thus a necessity analysis of services and disabling unnecessary ones, will reduce the start time.

Scanning Application Packages

The package manager, up on start up, scans all the available packages in the app directories. Hence the service can be expedited be removing unnecessary applications from the system. It is also possible to delay scanning of packages by custom changes in the package manager implementation and using a customized home application.

Precreate directories

In some systems, certain directives are created in the on-init process. If it is possible, these activities can be done offline once during file system creating there by significantly reducing the time to boot.


For a faster boot it is better to avoid or use a shorter boot animation. The bootanimation.zip can be tactically placed on the best file system for optimum performance.

Other Techniques

Some other techniques that can be used to speed up boot are:

Storage Device Speed/Processor Execution Speed Tune up

Based on bootchart, the resource requirements of major services can be analyzed and be spread across time to avoid overloading of processor as well as the disk usage.

Disabling All Debug Options

All the debug information like kernel level debugs, debug services like logcat, strace, bootchart etc can be removed on final release. The loglevel in android init.rc can also be reduced.

Proper shutdown

If the system is shutdown improperly (in a non-battery backed up device), the file systems will not be un-mounted properly. So when the system is booted next time, it takes some time to recover the file system errors. So it is necessary to make sure that the system is shutdown properly.


With the above mentioned techniques, it is possible to reduce the boot time of the android system. Once again it is iterated that the effectiveness of each technique is highly dependent on the system. But with some time and a lot of patience, it is possible to achieve significant difference and make the Android boot faster.

Various technological advances are being made in this area. Once of them is being captured in this Linaro page. For any queries or requirements on Android Porting and/or Android Boot Time Optimization, feel free to contact us.

On the previous post “Android Boot Process”, various steps involved in booting up the Android is explained. Before we start optimizing the Android boot process, each step has to profiled and analyzed to identify the critical delays. There are various tools and techniques available to understand the resource usage (both time and processing), which will be discussed in the below sections.

As the “Observer effect” notes that the measurements of certain systems cannot be made without affecting the system, using some of these tools will affect the actual performance. For example, using “bootchart” tool increases the system load marginally as it has to write to file system for storing the sampled data. But since we are not dealing with quantum mechanics, we can safely use them for improving the process and then disabling them in the release. Now about the tools.

Kernel Prints with Time stamps

The basic and primary technique is to enable the debug capabilities in the kernel. This option, up on enabled, will output debug prints along with the time stamp information. It can be enabled in the kernel by “make menuconfig” configuration using the following options

Kernel hacking

  • –>Kernel debugging
  • –> stacktrace
  • –> Enable dynamic printk() support
  • –> Kernel low-level debugging functions
  • –> Early printk

During run time, the prints are output in the console.

Logcat with higher log level

Android provides a service started by the “init” process to log various debug information.  The service can be enabled in init.rc file as follows

service logcat /system/bin/logcat -r 1000 -n 10 -v time -f /data/local/logcat.log

It provides options to print the debug options on process and even thread level along with the time stamp. The logcat can also be started from console command line without needing it to be run as a service and the output directly printed on the console.

The verbosity of the log can be increased by configuring a higher number with 8 as the upper limit. So changing the default log level 3 to log level 8 in init.rc file will help us understand some of the internal processes and execution time of the same.

A detailed description of this tool is available in Android Developer page.


Another valuable tool in documenting performance of each process is the “strace” tool. It helps us to trace the system calls executed by the associated process. To enable strace, in the /init.rc file, rather than starting a process directly, “strace” has to be started with the process as the arguments.

For example to document the zygote process, instead of the usual command,

service zygote /system/bin/app_process -Xzygote /system/bin –zygote –start-system-server

following can be used:

service zygote /system/xbin/strace -tt -o/data/boot.strace /system/bin/app_process -Xzygote /system/bin –zygote –start system-server

strace generally outputs a lot of information and can be used in advanced debugging.


Bootchart is tool to generate a graphical representation of android boot sequence. The greatest advantage of this tool is that the processor usage and disk usage are logged together and hence give a fairly good understanding of the cause of execution delays. This is internally supported in the Android and  is enabled during compilation, by exporting a environment variable as follows,

‘export INIT_BOOTCHART=true’

Followed by usual Android compilation process.

To instantiate boot chart process, create a file in /data directory with the number of seconds to log the boot information, typically by

‘echo 60 > /data/bootchart-start’

The up on booting the Android, the bootchart logs all the necessary information in the /data/data/bootchart/ directory.

The contents can be transferred to the host PC and by using a “python” based tool called “bootcharting”, the graphical representation can be created. To generate bootchart image by ‘system/core/init/grab-bootchart.sh’

The following is a typical output of a boot chart.

Bootchart - Capturing Android Boot process

As we can see, start time of each process along with their disk usage and execution pattern can be inferred.

Other tools:

There are other tools available for profiling the android processes. Some of them are



OProfile For Statistical profiling of entire system’s running code
Perf Performance Counters for Linux
Dalvik Method Tracer Profiling application performance graphically
Stop watch Measure boot up time manually

Since Android boot time optimization needs a lot of iterations, it is better to create an ecosystem to easily capture and process these profiling information using scripts and other techniques.

Now armed with detailed profiling information, we will look in to various Optimization techniques in our next post.

Android is one of the mostly widely used operating systems in the world. It is a feature rich system that can be used in a wide range of application areas like CE devices, industrial HMI’s, display interface for medical devices etc. Generally the boot time of the Android – from power up to showing the first screen is a time consuming process. In this series of posts, we will discuss about some of the tools and techniques for a fast Android boot.

This post is split in three parts:

  1. Android boot process
  2. Android boot time analysis
  3. Android boot optimization techniques

Now in this post, we will explain about the android boot process and its internals.

Android Boot Process

Understanding of the boot process of the target platform is the starting point for the optimizing the boot time. Generally on any platform, following components are loaded and executed step by step

  • Boot loader
  • U-boot (optional)
  • Kernel
  • Android

The Android process has the following sequence

  • Init
  • Zygote
  • System Server
  • Service Manager
  • Other Daemons and processes
  • Applications

The following diagram depicts the boot process.

Boot loader

Up on power up, the processor boots from a ROM area typically located internally. This code determines the boot media and loads the boot loader from the media. The boot loader can be used to initialize the DRAM and load another level of loader or directly the Linux kernel. IT is generally dependent on the processor architecture and implementation.


U-Boot is used as a first or second level boot loader. It reads the Linux and ramdisk images from boot media and validates them. While it may not be mandatory to use u-boot, it offers some flexibility like passing arguments to the kernel (easily used to enter the recovery mode), fast boot modes, as a backup option to reprogram the OS etc.


Linux kernel is the heart of the Android responsible for the process creation, inter process communication, device drivers, file system management etc. Android applies a custom patch on the main stream kernel to support certain features like Wake locks etc needed for operation of the Android.

The kernel can be either loaded as uncompressed image or as a compressed image. Up on loading, it mounts the root file system (typically passed as kernel command line arguments) and starts the first application in user space.


Android typically operates wholly on the user space. The android applications are executed over a Virtual Machine called the Dalvik. The following section explains the internals in detail.

init and init.rc

The first user space application executed on booting the kernel is the init executable located in the root folder. The process parses a start up script called the “init.rc” script. This is written in a language designed for android used to start all the necessary processes, daemons and services for a proper operation of android. It offers various types of execution timings such as early-init, on-boot, on-post-fs etc. A detailed explanation of the scripting model is available on Android documentation site.

Demons and Services

The init process creates various daemons and processes like rild, vold, mediaserver, adb, etc each responsible for its own functionality. Descriptions of these processes are not in the scope of this post. Rather we will discuss more about “Zygote” process.

Service Manager

The service manager process manages all the services running in the system. Every service created registers itself with this process and this information is used for future references by other processes/applications.


Zygote is one of the first init process created on boot. The term “zygote” is based the biological “initial cell formed that divides to produce offsprings”. Similarly “zygote in android” initializes the Dalivik VM and forks to create multiple instances to support each android process. It facilitates using a shared code across the VM instances resulting in a low memory foot print and short load time, ideal for an embedded system.

Zygote apart from installing a listener on the server socket, also preloads classes and resources to be used later in the Android applications. Once done, the system server is started.

Android System services (SystemServer)

SystemServer process starts all services available in the Android. Some of them are described below.



Activity Manager Manages activities life cycle and new services
Package Manager Manages application package handling (install, uninstall, upgrade, permissions)
Window Manager Manages all the window manipulations (like input events, orientation).
AppWidget Service Handles Android widgets
Backup Manager Manages backup scheduling and transfer
Status Bar Shows software/hardware status. It works with other managers like Notification, Network Status, Battery Status
Power Manager Handles power management while Android’s different modes (lock mode, sleep mode, Adjust brightness)
NetworkManagement Service Deals with network related activities
Notification Manager Manage all notifications (Toasts)
Location Manager Manages location providers
Entropy Mixer Handles (load & save periodically) kernel randomness
Display Manager Manages display properties
Telephony Registry Provides telephony information
Scheduling Policy Manages the process scheduling
Account Manager Handles the users account credential of different online services
Content Manager Handles all the data’s on a device
Battery Service Manages battery level and charging states
Alarm Manager Used to schedule the user applications to be run at future.
Input Manager Handles input devices and key layouts
Device Policy Enforces security policies for the device
Clipboard Service Provides Clipboard based copy/past operations.
NetworkStats Service Monitors Network connection Status
NetworkPolicy Service Enforces network security policies.
Wi-Fi P2pService Handles WiFi peer to peer connection
Ethernet Service Manages Ethernet connectivity.
Wi-Fi Service Manage WiFi connectivity
Connectivity Service Monitors and handles network connection state changes
Network Service Discovery Service Used to find local network devices to share app data

Once all the services are started and are executing, the Android broadcasts a “ACTION_BOOT_COMPLETED” message implying end of the boot process.

Android Home Screen

The Android package Manager on start up, parses each package (“.apk” file) available in the “/system/app” and “/system/vendor/app” and validates its AndroidManifest.xml. The application that is configured as the “Home” in its manifest is launched there by showing the android UI. Typically the Launcher application is launched as it is the default home application.

Generally this whole process may take around 25 to 60 seconds depending up on various factors to be discussed in later posts. Now with the boot process understood, we will look in to the tools available for profiling the boot activity in the next post – Android Boot Time Analysis.