Tuesday, September 5, 2017

Android bootup process

 Android Bootup Process


                            The Android boot sequence is similar to any other embedded system based on Linux: in a very abstract way, after the power-on, the system initializes the hardware, loads the kernel, and finally the Android framework.





Internal ROM – bios
                   When you press the power button on your device, the system loads a tiny amount of code, stored inside a ROM memory. This software is in charge of setting up all the parameters for CPU clock and running the RAM memory check. After this, the system loads the bootloader into memory and launches it.

An overview of bootloader
              The bootloader is in charge of loading the system kernel into the RAM memory and launching it, to continue the boot sequence.

                 The most popular bootloader software for Android devices is U-Boot, the Universal Bootloader. U-Boot is widely used in all kinds of embedded systems: DSL routers, smart TVs, infotainment systems, for example. U-boot is open source software and its flexibility to be customized for any device is definitely one of the reasons for its popularity. U-boot's main task is to read the kernel image from the boot partition, load it into the RAM memory, and run it. From this moment on, the kernel is in charge of finishing the boot sequence.

The kernel
              After the bootloader loads the kernel, the kernel's first task is to initialize the hardware. With all the necessary hardware properly set up, the kernel mounts the ramdisk from boot.imgand launches init.

The Init process
                In a standard Linux system, the init process takes care of starting all the core services needed to boot the system. The final goal is to complete the boot sequence and start the graphical interface or the command line to make the system available to the user. This whole process is based on a specific sequence of system scripts, executed in a rigorous order to assure system integrity and proper configuration.

Bootup Process in detail



A. The Boot ROM code present in OTPA will detect the boot media using a system register that maps to some physical address. This is to determine where to find the first stage of the boot loader.

B. Once the boot media sequence is established the boot ROM will try to load the first stage boot loader to internal RAM. Once the boot loader is in place the boot ROM code will perform a jump and execution continues in the boot loader.



A. The first boot loader stage will detect and set up external RAM.

B. Once external RAM is available and the system is ready the to run, the first stage will load the main boot loader and place it in external RAM.

C. The second stage of the boot loader is the first major program that will run. This may contain code to set up file systems, additional memory, network support and other things.

D. Once the boot loader is done with any special tasks it will look for a Linux kernel to boot. It will load this from the boot media and place it in the RAM. It will also place some boot parameters in memory for the kernel to read when it starts up.

E. Once the boot loader is done it will perform a jump to the Linux kernel, usually some decompression routine, and the kernel assumes system responsibility.



  • The Linux kernel sets up everything that is needed for the system to run. Initialize interrupt controllers, set up memory protections, caches and scheduling. The kernel will look in the root file system for the init process and launch it as the initial user space process.
  • The init process is the "grandmother" of all system processes. Every other process in the system will be launched from this process or one of its descendants. The init process will parse the init script and launch the system service processes.
  • The Zygote is launched by the init process and will basically just start executing and initialize the Dalvik VM.
  • The system server is the first java component to run in the system. It will start all the Android services such as telephony manager and bluetooth. Start up of each service is currently written directly into the run method of the system server. The system server source can be found in the file frameworks/base/services/java/com/android/server/SystemServer.java in the open source project.
  •  Once the System Server is up and running and the system boot has completed there is a standard broadcast action called ACTION_BOOT_COMPLETED. To start your own service, register an alarm or otherwise make your application perform some action after boot you should register to receive this broadcast intent.

Block Diagram of bootup



Share:

0 comments:

Post a Comment

Popular Posts

Contact Form

Name

Email *

Message *

Pages