SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
Android Booting Sequence
Bootloader
Kernel
init
Zygote DVM
SystemServer
Boot ROM
ManagersManagersManagersManagers
Stage 2
Stage 3
Stage 4
Stage 5
Stage 1
Stage 1
• On pressing POWER button, the Boot ROM code starts executing from a pre-
defined location which is hardwired in ROM.
• It loads the Bootloader into RAM.
• Bootloader is code that is executed before any Operating System starts to run.
• Bootloaders is a low-level code contains the instructions that tell a device how
to start up and find the system kernel.
• The bootloader usually lives on the system board in non-volatile memory and
is often specific to a device.
• The boot loader is usually split into stages. Stage 1 will load stage 2 from a
specific sector on the disk, then stage 2 will initialize the system and load the
kernel from 'boot' flash partition into RAM.
Stage 2
• Once kernel boots, it start setup cache, protected memory, scheduling, loads
drivers, starts kernel daemons, mounts root file system, initializing I/O , starts
interrupts, initializes process table.
• the 'kernel' is the central component of most operating systems; it is a bridge
between applications and the actual data processing done at the hardware
level.
• A kernel is the lowest level of easily replaceable software that interfaces with
the hardware in your device.
• It is responsible for interfacing all of your applications that are running in
“user mode” down to the physical hardware, and allowing processes, known as
servers, to get information from each other using inter-process communication
(IPC).
• When kernel finish system setup first thing it look for “init” in system files and
launch root process or first process of system.
Stage 3
• During booting of an Android device, init is the first user space process
start_kernel() spawns.
• The init process has two responsibilities.
– Mounts directories like /sys , /dev or /proc and
– Runs /init.rc script
• Init.rc is responsible for the initial set up of the system.
• It imports /init.${ro.hardware}.rc which is the primary vendor supplied .rc file.
• The 'init.rc' file is intended to provide the generic initialization instructions,
while the ‘init.${ro.hardware}.rc ' file is intended to provide the machine-
specific initialization instructions.
• The init process is what will set up all native services and this is similar to a
regular Linux system boot.
Stage 3 Cont..
• The init process first creates a shared memory region and stores a fd to the
region. Then init process maps the region into its virtual space
with mmap with MAP_SHARED flag, as a result, any updates to this area can be
seen by all processes.
• After that, init process will load properties from following files:
 /default.prop
 /system/build.prop
 /system/default.prop
 /data/local.prop
• At this stage, you can finally see the Android logo in your screen.
• init runs the C++ program /system/bin/app_process, and gives the resulting
process the name "zygote“.
Stage 4
• Zygote is a daemon started as a system service whose goal is to launch
applications.
• When app_process launches Zygote, it creates the first Dalvik VM and calls
Zygote’s main () method.
• Once Zygote starts, it preloads all necessary Java classes and resources,
starts System Server and opens a socket to listen for requests for starting
applications.
• Zygote receives a request to launch an App through /dev/socket/zygote. Once
it happens it trigger a fork() call.
• When a process forks, it creates a clone of itself. It replicates itself in another
memory space. This is done pretty efficiently. When this happens to Zygote, it
creates an exact and clean new Dalvik VM, preloaded with all necessary classes
and resources that any App will need. This makes the process of creating a VM
and load resources pretty efficiently.
Stage 4 Cont..
• As we know, Android runs on Linux. The Linux Kernel implements a strategy
call Copy On Write (COW).
• What this means is that during the fork process, no memory is actually copy to
another space. It is shared and marked as copy-on-write. Which means that
when a process attempt to modify that memory, the kernel will intercept the
call and do the copy of that piece of memory.
• In the case of Android those libraries are not writable. This means that all
process forked from Zygote are using the exact same copy of the system classes
and resources.
• The Zygote enables code sharing across the Dalvik VM, achieving a lower
memory footprint and minimal startup time.
Stage 5
• After zygote preloads all necessary Java classes and resources, it starts System
Server.
• The system server is the core of the Android system and as described in the
boot sequence post it is started as soon as Dalvik is initialized and running.
• The other system services will be running in the context of the System Server
process.
• The first thing that happens is that the server will load a native library called
android_servers that provides interfaces to native functionality.
• Then the native init method that will setup native services is called.
• After setting up the native services it create the server thread. This thread will
start the remaining services in the system according to the necessary start
order.
Stage 5 Cont..
• Each service is running in a separate Dalvik thread in the SystemServer
process.
• Once System Services up and running in memory, Android has completed
booting process, At this time “ACTION_BOOT_COMPLETED” standard broadcast
action will fire.
Reference
• http://www.androidenea.com/2009/08/init-process-and-initrc.html
• https://android.googlesource.com/platform/system/core/+/master/init/rea
dme.txt
• http://www.androidenea.com/2009/07/system-server-in-android.html
• https://anatomyofandroid.com/2013/10/15/zygote/
• http://www.androidenea.com/2009/08/init-process-and-initrc.html
• https://community.nxp.com/docs/DOC-102546
• http://www.onsandroid.com/2014/10/in-depth-android-boot-sequence-
process.html
• http://elinux.org/Android_Zygote_Startup
• http://rxwen.blogspot.in/2010/01/android-property-system.html
• https://en.wikibooks.org/wiki/Operating_System_Design/Initialization/Bootl
oader
• http://www.addictivetips.com/mobile/what-is-bootloader-and-how-to-
unlock-bootloader-on-android-phones-complete-guide/

More Related Content

PPT
Learning AOSP - Android Booting Process
PDF
Booting Android: bootloaders, fastboot and boot images
PDF
Embedded Android Workshop with Pie
PDF
Design and Concepts of Android Graphics
PDF
Android Things : Building Embedded Devices
PDF
Understanding the Android System Server
PDF
Explore Android Internals
PDF
Android power management
Learning AOSP - Android Booting Process
Booting Android: bootloaders, fastboot and boot images
Embedded Android Workshop with Pie
Design and Concepts of Android Graphics
Android Things : Building Embedded Devices
Understanding the Android System Server
Explore Android Internals
Android power management

What's hot (20)

PPTX
Android bootup process
PDF
Low Level View of Android System Architecture
PDF
Android IPC Mechanism
PDF
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
PDF
Android Internals
PDF
Android Internals
PPT
Android booting sequece and setup and debugging
PDF
Hacking Android OS
PPT
Learning AOSP - Android Linux Device Driver
PDF
Android Boot Time Optimization
PPT
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
PPTX
Binder: Android IPC
PDF
Android Automotive
PPTX
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
PDF
Android's HIDL: Treble in the HAL
PDF
Embedded Android : System Development - Part I
PDF
Init of Android
PDF
Android Storage - Vold
PDF
Android Binder IPC for Linux
Android bootup process
Low Level View of Android System Architecture
Android IPC Mechanism
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Android Internals
Android Internals
Android booting sequece and setup and debugging
Hacking Android OS
Learning AOSP - Android Linux Device Driver
Android Boot Time Optimization
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
Binder: Android IPC
Android Automotive
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android's HIDL: Treble in the HAL
Embedded Android : System Development - Part I
Init of Android
Android Storage - Vold
Android Binder IPC for Linux
Ad

Similar to Android Booting Sequence (20)

ODP
Android crash debugging
PDF
Android Patching & Client-Side CyberSecurity
PDF
Android Internals at Linaro Connect Asia 2013
PPTX
Introduction of Android Architecture
PPTX
Android training course
PDF
Android for Embedded Linux Developers
PDF
Linux: the first second
PPTX
Process Management in Android
PPTX
Android internals By Rajesh Khetan
PDF
Leveraging Android's Linux Heritage at AnDevCon IV
PPTX
Zeelogic android-training-2013
PDF
Linux: the first second
PPT
Portinig Application, Drivers And Os
PDF
Is Android the New King of Embedded OSes at Embedded World 2014
PDF
Running Code in the Android Stack at ELCE 2013
PDF
Leveraging Android's Linux Heritage at ELC-E 2011
PDF
Leveraging Android's Linux Heritage
PDF
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
PDF
Android Architecture
PDF
Android is NOT just 'Java on Linux'
Android crash debugging
Android Patching & Client-Side CyberSecurity
Android Internals at Linaro Connect Asia 2013
Introduction of Android Architecture
Android training course
Android for Embedded Linux Developers
Linux: the first second
Process Management in Android
Android internals By Rajesh Khetan
Leveraging Android's Linux Heritage at AnDevCon IV
Zeelogic android-training-2013
Linux: the first second
Portinig Application, Drivers And Os
Is Android the New King of Embedded OSes at Embedded World 2014
Running Code in the Android Stack at ELCE 2013
Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Android Architecture
Android is NOT just 'Java on Linux'
Ad

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Modernizing your data center with Dell and AMD
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm

Android Booting Sequence

  • 3. Stage 1 • On pressing POWER button, the Boot ROM code starts executing from a pre- defined location which is hardwired in ROM. • It loads the Bootloader into RAM. • Bootloader is code that is executed before any Operating System starts to run. • Bootloaders is a low-level code contains the instructions that tell a device how to start up and find the system kernel. • The bootloader usually lives on the system board in non-volatile memory and is often specific to a device. • The boot loader is usually split into stages. Stage 1 will load stage 2 from a specific sector on the disk, then stage 2 will initialize the system and load the kernel from 'boot' flash partition into RAM.
  • 4. Stage 2 • Once kernel boots, it start setup cache, protected memory, scheduling, loads drivers, starts kernel daemons, mounts root file system, initializing I/O , starts interrupts, initializes process table. • the 'kernel' is the central component of most operating systems; it is a bridge between applications and the actual data processing done at the hardware level. • A kernel is the lowest level of easily replaceable software that interfaces with the hardware in your device. • It is responsible for interfacing all of your applications that are running in “user mode” down to the physical hardware, and allowing processes, known as servers, to get information from each other using inter-process communication (IPC). • When kernel finish system setup first thing it look for “init” in system files and launch root process or first process of system.
  • 5. Stage 3 • During booting of an Android device, init is the first user space process start_kernel() spawns. • The init process has two responsibilities. – Mounts directories like /sys , /dev or /proc and – Runs /init.rc script • Init.rc is responsible for the initial set up of the system. • It imports /init.${ro.hardware}.rc which is the primary vendor supplied .rc file. • The 'init.rc' file is intended to provide the generic initialization instructions, while the ‘init.${ro.hardware}.rc ' file is intended to provide the machine- specific initialization instructions. • The init process is what will set up all native services and this is similar to a regular Linux system boot.
  • 6. Stage 3 Cont.. • The init process first creates a shared memory region and stores a fd to the region. Then init process maps the region into its virtual space with mmap with MAP_SHARED flag, as a result, any updates to this area can be seen by all processes. • After that, init process will load properties from following files:  /default.prop  /system/build.prop  /system/default.prop  /data/local.prop • At this stage, you can finally see the Android logo in your screen. • init runs the C++ program /system/bin/app_process, and gives the resulting process the name "zygote“.
  • 7. Stage 4 • Zygote is a daemon started as a system service whose goal is to launch applications. • When app_process launches Zygote, it creates the first Dalvik VM and calls Zygote’s main () method. • Once Zygote starts, it preloads all necessary Java classes and resources, starts System Server and opens a socket to listen for requests for starting applications. • Zygote receives a request to launch an App through /dev/socket/zygote. Once it happens it trigger a fork() call. • When a process forks, it creates a clone of itself. It replicates itself in another memory space. This is done pretty efficiently. When this happens to Zygote, it creates an exact and clean new Dalvik VM, preloaded with all necessary classes and resources that any App will need. This makes the process of creating a VM and load resources pretty efficiently.
  • 8. Stage 4 Cont.. • As we know, Android runs on Linux. The Linux Kernel implements a strategy call Copy On Write (COW). • What this means is that during the fork process, no memory is actually copy to another space. It is shared and marked as copy-on-write. Which means that when a process attempt to modify that memory, the kernel will intercept the call and do the copy of that piece of memory. • In the case of Android those libraries are not writable. This means that all process forked from Zygote are using the exact same copy of the system classes and resources. • The Zygote enables code sharing across the Dalvik VM, achieving a lower memory footprint and minimal startup time.
  • 9. Stage 5 • After zygote preloads all necessary Java classes and resources, it starts System Server. • The system server is the core of the Android system and as described in the boot sequence post it is started as soon as Dalvik is initialized and running. • The other system services will be running in the context of the System Server process. • The first thing that happens is that the server will load a native library called android_servers that provides interfaces to native functionality. • Then the native init method that will setup native services is called. • After setting up the native services it create the server thread. This thread will start the remaining services in the system according to the necessary start order.
  • 10. Stage 5 Cont.. • Each service is running in a separate Dalvik thread in the SystemServer process. • Once System Services up and running in memory, Android has completed booting process, At this time “ACTION_BOOT_COMPLETED” standard broadcast action will fire.
  • 11. Reference • http://www.androidenea.com/2009/08/init-process-and-initrc.html • https://android.googlesource.com/platform/system/core/+/master/init/rea dme.txt • http://www.androidenea.com/2009/07/system-server-in-android.html • https://anatomyofandroid.com/2013/10/15/zygote/ • http://www.androidenea.com/2009/08/init-process-and-initrc.html • https://community.nxp.com/docs/DOC-102546 • http://www.onsandroid.com/2014/10/in-depth-android-boot-sequence- process.html • http://elinux.org/Android_Zygote_Startup • http://rxwen.blogspot.in/2010/01/android-property-system.html • https://en.wikibooks.org/wiki/Operating_System_Design/Initialization/Bootl oader • http://www.addictivetips.com/mobile/what-is-bootloader-and-how-to- unlock-bootloader-on-android-phones-complete-guide/