Android Boot Sequence

In this post we will discuss about the boot process of Android operating system. As the Android is based on Linux Kernel , so its boot process will give good idea about Linux boot process also. Most android based systems run on ARM processors.

First of all we will see the meaning of various terms that is used in the android boot sequence.


  • BootROM- It is a hardwired code resided in CPU ASICS.
  • Bootloader- It is a small program which runs before the Android OS starts running.
  • Init process- It is the first process launched by Linux Kernel when it is finished with the setup.

Let's see what happens when a user presses power ON button--


Complete path the boot process takes when we press the power button on our android phones.


Step 1-System start-- Boot ROM code start execution from pre defined location. It load Bootloader into RAM and start execution.

  • A. The Boot ROM code will detect the boot media using a system register that maps to some physical balls on the ASIC. 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.
[Android_boot_1.png]



Step 2 : Bootloader--

  • Bootloader perform execution in two stages, first stage It to detect external RAM and load program which helps in second stage, In second stage bootloader setup network, memory, etc. which requires to run kernel, bootloader is able to provide configuration parameters or inputs to the kernel for specific purpose.  
  • Android bootloader can be found at 
<Android Source>\bootable\bootloader\legacy\usbloader
  • Legacy loader contain two important files viz. init.S and main.c 1. init.s - Initializes stacks, zeros the BSS segments, call _main() in main.c
    2. main.c - Initializes hardware (clocks, board, keypad, console), creates Linux tags.
  • In embedded Linux uBoot is often the boot loader of choice. Device manufacturers often use their own proprietary boot loaders.

[Android_boot_2.png]

  • 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 something more significant 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. On a mobile phone it may also be responsible for loading code for the modem CPU and setting up low level memory protections and security options.
  • 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 (or some other source depending on system configuration) 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.


3. The Linux kernel

The Linux kernel starts up in a similar way on Android as on other systems. It will set up everything that is needed for the system to run. Initialize interrupt controllers, set up memory protections, caches and scheduling.

[Android_boot_3.png]


  • A. Once the memory management units and caches have been initialized the system will be able to use virtual memory and launch user space processes.
  • B. The kernel will look in the root file system for the init process (found under system/core/init in the Android open source tree) and launch it as the initial user space process.

4. The init process



[Android_boot_4.png]
init it very first process, we can say it is root process or grandmother of all processes. init process has two responsibilities 1. mount directories like /sys, /dev, /proc and 2. run init.rc script.


init process can be found at init : <android source>/system/core/init init.rc file can be found in source tree at <android source>/system/core/rootdir/init.rc  This is a script that describes the system services, file system and other parameters that need to be set up. The init.rc script is placed in system/core/rootdir in the Android open source project.
5. Zygote and Dalvik -


[Android_boot_5.png]

  • In a Java, We know that separate Virtual Machine(VMs) instance will popup in memory for separate per app, In case of Android app should launch as quick as possible, If Android os launch different instance of Dalvik VM for every app then it consume lots of memory and time. so, to overcome this problem Android OS as system named “Zygote”. 
  • Zygote enable shared code across Dalvik VM, lower memory footprint and minimal startup time. 
  • Zygote is a VM process that starts at system boot time as we know in previous step.
  • Zygote preloads and initialize core library classes.  
  • Normally there core classes are read-only and part of Android SDK or Core frameworks. In Java VM each instance has it’s own copy of core library class files and heap objects.
  • In short, The Zygote is launched by the init process and will basically just start executing and and initialize the Dalvik VM.


6. The system server-

[Android_boot_6.png]


  • 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

Core Services:
1.     Starting Power Manager
2.     Creating Activity Manager
3.     Starting Telephony Registry
4.     Starting Package Manager
5.     Set Activity Manager Service as System Process
6.     Starting Context Manager
7.     Starting System Context Providers
8.     Starting Battery Service
9.     Starting Alarm Manager
10.   Starting Sensor Service
11.   Starting Window Manager
12.   Starting Bluetooth Service
13.   Starting Mount Service

Other services
1.    Starting Status Bar Service
2.     Starting Hardware Service
3.     Starting NetStat Service
4.     Starting Connectivity Service
5.     Starting Notification Manager
6.     Starting DeviceStorageMonitor Service
7.     Starting Location Manager
8.     Starting Search Service
9.     Starting Clipboard Service
10.   Starting Checkin Service
11.   Starting Wallpaper Service
12.   Starting Audio Service
13.   Starting HeadsetObserver
14.   Starting AdbSettingsObserver
 



7. Boot completed


Once System Services up and running in memory, Android has completed booting process, At this time “ACTION_BOOT_COMPLETED” standard broadcast action will fire.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 主板的BOOT SEQUENCE RETRY是指在计算机开机时,主板检测到启动顺序出现错误后自动进行重新尝试的功能。当主板在尝试按照预设的启动顺序依次检测硬件设备(例如硬盘、光驱、USB设备等)时,如果出现错误或设备无法启动,主板会自动重试该设备,直到该设备能够成功启动或全部设备都尝试完毕。这个功能可以帮助用户解决启动问题,提高系统的可靠性和稳定性。 ### 回答2: 主板的BOOT SEQUENCE RETRY是指在计算机开机启动过程中,如果系统检测到启动失败,则会自动尝试重试启动的操作。 当计算机开机时,主板会按照预先设定的启动顺序进行操作系统的加载。这个顺序通常是从硬盘、U盘、光盘等媒体中检索启动文件,并将其加载到内存中。 然而,在一些情况下,启动媒体可能无法被正确识别或读取,导致启动失败。这可能是由于文件损坏、硬件故障或其他原因引起的。 BOOT SEQUENCE RETRY的功能是,当系统检测到启动失败时,它会自动尝试重新启动。系统会进行几次的重试,希望能够重新识别并加载启动文件,从而成功启动操作系统。 这种重试机制的存在是为了提高系统的可靠性和启动成功率。通过多次尝试启动,系统有更多的机会识别和解决启动问题,减少了因启动失败而导致的用户干扰和操作延迟。 总而言之,主板的BOOT SEQUENCE RETRY指的是在计算机开机启动时,系统自动尝试多次重新启动以解决启动问题的机制。 ### 回答3: 主板的BOOT SEQUENCE RETRY(引导序列重试)是指当计算机在启动过程中遇到问题时,尝试重新执行引导序列的功能。引导序列是计算机启动时加载操作系统的步骤和顺序。 通常情况下,计算机在启动时会按照预定的引导序列逐步执行。这通常涉及硬件自检、加载BIOS(基本输入/输出系统)、检测其他外部设备和硬件的状态,最终加载操作系统并启动系统。 但有时候,由于各种原因,计算机在启动过程中可能会遇到问题,例如硬件故障、外部设备连接错误或操作系统崩溃等。当发生此类问题时,主板上的BOOT SEQUENCE RETRY功能可能会自动触发。 引导序列重试的主要目的是尝试解决或绕过导致计算机启动失败的问题。主板会尝试重新执行引导序列的步骤,希望能够找到问题的解决办法。通常,它会自动重试几次,如果问题仍然存在,系统可能会停止尝试并显示相关错误信息。 通过BOOT SEQUENCE RETRY功能,主板可以提高计算机启动的成功率,并帮助用户更容易地排除故障。它可以自动检测和修复一些常见的启动问题,而不需要用户手动干预。同时,BOOT SEQUENCE RETRY也可以帮助用户确定导致计算机启动失败的具体原因,例如哪个硬件设备引起了问题,以便采取相应的措施来解决。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值