Android BootUp Sequence: Major Milestones

Understanding the Key Steps from Power On to Launcher

Android BootUp Sequence: Major Milestones

1. Power On

When the user presses the power button, it loads the bootloader from a predefined location in ROM to RAM and executes it.

2. Bootloader

This is a small program that loads before kernel. It primarily loads the kernel and executes it.

3. Linux Kernel

When the kernel starts, it performs the initial setup, including memory management, drivers (including the binder driver), cache, scheduling, etc. Once the kernel is loaded and the setup is complete, it starts the init process.

4. Init Process

This is the first user-space process started by Android.

  • It creates and mounts file directories required for startup, such as /dev and /proc.
  • It initializes system properties.
  • It starts native services like ServiceManager and zygote.

This process parses and executes the init.rc script. The implementation of init can be found at system/core/init and the init.rc script can be found at system/core/rootdir/.

5. Zygote

This is the base/template process that gets forked every time a new application is launched.

  • It preloads common libraries, resources (eg. Java classes, Android framework classes). Hence, when an application needs to be launched, it will not be starting from scratch.
  • It loads the VM (Virtual Machine), where the application's java bytecode will be executed.
  • Zygote starts the system server process.

At this time, the boot animation will be visible.

Note: After initialization, Zygote will just wait for AMS (Activity Manager Service) to request start of a new process. When it receives such request, it will fork itself and create to new process.

6. System Server

The system server starts all the SystemServices (e.g. PMS, AMS etc.). It also creates and starts the binder thread pool. This is implemented in frameworks/base/services/java/com/android/server/SystemServer.java

7. Launcher, SystemUI

SystemUI and Launcher are core application in android launcher during boot time. SystemUI is responsible for various core UI components like notifications, the lock screen, the status bar, and the navigation bar. The Launcher is the activity that is base of all the activities, the user can view and launch other applications from the launcher.

The above flow can be summarized in the following diagram: Android Bootup Sequence Flow

In subsequent posts, we will dive deeper into the milestones shown above.