Call Us Now :

Android

Android Internals: How Android OS Bootup Process work?

A few years back Google launched an operating system platform called Android. The OS was mainly released for mobile devices. I am writing this blogpost for all the wanna-be developer nerds or software engineers out there who are willing to learn about Android OS. This post is about the Android Internals and the boot-up process of Android.

In this topic, I will provide the piece of information which is mentioned above, but won’t dig down much deeper. You can get a complete overview of Android Internals and Android OS boot-up process.

We will see how an Android OS gets fired up using the Activity Manager and how the Activity Manager gets initialized. If you want to pursue a career as an Android Software Developer then this topic might help you.

The knowledge of Android Internals is essential. Apart from your career choice, this topic can help you in cracking interviews for software engineer jobs. But first things first let’s give you an idea about the Android Operating System.

Android Operating System:

Android is a modified version of Linux Kernel running on Linux Platform. It was mainly developed for operating touchscreen mobile phones. Later the OS is used in different devices like Televisions, Tablets, Computers, SmartWatches, etc.

After buying Android OS from Android Inc., Google first launched the commercial version of this OS in September 2008. From that day the OS made a major impact on the market of operating systems. Starting from the very first version, the OS is currently running on its 9th version which is “Android Pie”.

But today we are going to discuss a little bit more about the Android OS. We are going to have a shallower discussion over this OS. So, let’s get started.

Want to Know the Android Internals and the Boot-Up Process?

Now, this is an important section for all the wanna-be developers and software engineers out there. Before we start talking about this topic let’s get an imagery view of working of Android Boot-up process.

Now let’s take a closer look at the fields mentioned in the above table. Hang on, you are about to get some real knowledge on Android OS.

1. Bootloader:

The bootloader is a code which is responsible for running different operating systems in any device. Therefore bootloader is not specific for Android only. It comprises several codes which makes the booting process happen from beginning the startup process to set up memory management and security options.

A bootloader consists of two major files: init.s and main.c. Init.s initializes the stacks and BSS segments and the main.c is responsible for start-up hardware parts like keyboards, system clock, console, etc.

2. Kernel:

Well, this is one of the most important parts of booting your Android device. After the process of Bootloader, the Kernel starts its process. It set up a cache memory, load drivers, mount files, start kernel daemons, etc.

Once the work of kernel is done it looks for the init process to launch the root process. The Kernel allows your software to connect with your hardware. Without Kernel your system won’t even start.

3. Init.s 

The init is the root process or the grandfathering process to boot-up your Android OS. The two main processes of init are:

  1. Mounts directories like /sys, /dev or /proc.
  2. Runs init.rc script

The init process can be accessed at: /init::<android source>/system/core/init.

Init.rc file can be traced at : <android source>/system/core/rootdir/.

4. Zygote and VM:

When an Android OS boots up, the zygote is the first Android-specific process to execute. The Zygote is triggered by the command app_process. At first, a VM is created and then a call is send to Zygote’s main() function.

Zygote preload all the resources of the system and classes used by the Android Framework. It is a virtual machine process that is responsible for the start-up the booting system.

The Zygote loading process includes:

  • Load Zygote Init class:

            <android

            source>/frameworks/base/core/java/com/android/internal/os/ZygoteInit.java

  • registerZygoteSocket():: Registers a server socket for Zygote command.
  • preloadClasses():: A text file containing a list of classes that need to be preloaded. You can locate the file at <android source>/framework/base
  • preloadResources() :: With this method, everything included in the android R file will be loaded.

5. System Service:

After the above processes are completed, the system services are being launched by Zygote. The core service provided by Zygote to launch the system services are:

  • Starting power manager.
  • Creating the activity manager.
  • Starting telephony registry
  • Starting package manager.
  • Set activity manager serves as a system process.
  • Starting context manager
  • Starting system contact providers.
  • Starting battery service
  • Starting alarm manager
  • Starting sensor service
  • Starting window manager
  • Starting Bluetooth service
  • Starting mount service

Conclusion:

Android Kernel was built mainly focussing on mobile OS platform. Though Android was built on Linux platform, the android kernel version is very much different from Linux Kernel. Developers made memory management on the Linux kernel OS ( Linux kernel was built for running desktops) and developed Android Kernel.

Throughout the years since it was first introduced, Android has become the leading Operating System for mobile phones. And the OS is getting advance day by day. I just hope that my article will help you with your urge to learn about Android Internals and Android OS.