`
yidongkaifa
  • 浏览: 4061150 次
文章分类
社区版块
存档分类
最新评论

android boot 上电启动过程

 
阅读更多
Since mobile platforms and embedded systems has some differences compared to Desktop systems in how they initially start up and boot this post will discuss the initial boot stages of an Android phone in some detail. Since we have used theBeagle Boardas reference in some previous examples any specifics here are related to a similar system.

1. Power on and boot ROM code execution
At power on the CPU will be in a state where no initializations have been done. Internal clocks are not set up and the only memory available is the internal RAM. When power supplies are stable the execution will start with the Boot ROM code. This is a small piece of code that is hardwired in the CPU ASIC. For more information on boot ROM and configurations study the initalization chapter in
the Omap 3530 TRM.
  • 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.
2. The boot loader
The boot loader is a special program separate from the Linux kernel that is used to set up initial memories and load the kernel to RAM. On desktop systems the boot loaders are programs like GRUB and in embedded LinuxuBootis often the boot loader of choice. Device manufacturers often use their own proprietary boot loaders. The requirements on a boot loader for Linux running on an ARM system can be found in the Booting document under/Documentation/armin the kernel source tree.

  • 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 firstmajorprogram 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.
  • 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
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.

  • A. The init process in Android will look for a file called 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.
  • B. The init process will parse the init script and launch the system service processes.
5. Zygote and Dalvik
The Zygote is launched by the init process and will basically just start executing and and initialize the Dalvik VM.
6. The system server
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.


7. Boot completed
Added this part to the post on 20090831 since it is very useful and something I should not have left out from the beginning. 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.

The separate boot steps and possible places to add your own functionality are covered in more detail in separate posts.
分享到:
评论

相关推荐

    Android_开机启动流程

    Android的开机流程 1. 系统引导bootloader 1) 源码:bootable/bootloader/* ...c) 开机按Power,正常启动系统,加载boot.img,boot.img包含内核,基本文件系统,用于正常启动手机(以下只分析正常启动的情况)

    android 系统中的几乎所有广播接收者

    BOOT_COMPLETED_ACTION 在系统启动后,这个动作被广播一次(只有一次) "android.intent.action.BOOT_COMPLETED" CALL_FORWARDING_STATE_CHANGED_ACTION 语音电话的呼叫转移状态已经改变 "android.intent.action.CFF" ...

    MTK secure boot2020.zip

    MTK 安全启动文档介绍新版本。 主要介绍MT8735平台的安全启动设计。希望给到需要的人。全部英文内容。

    安卓usb充电自动开机的方法class_start charger

    安卓usb充电自动开机的方法 手机一个,要求已root,备份出boot.img, class_start charger

    新版Android开发教程.rar

    的 Android SDK 提供了在 Android 平台上使用 JaVa 语言进行 Android 应用开发必须的工具和 API 接口。 特性 • 应用程序框架 支持组件的重用与替换 • Dalvik Dalvik Dalvik Dalvik 虚拟机 专为移动设备优化 • ...

    2010年谢彦的android笔记

    4.1.3 android应用的启动过程 127 4.2 服务的原理与使用 128 4.3 键盘事件处理 130 4.4 包管理 131 4.5 传感器 132 4.6 浅析dalvik虚拟机JIT技术的实现 133 4.7 应用程序的签名(Signature) 135 4.8 应用的权限 138 ...

    android笔记.rar

    4.1.3 android应用的启动过程... ..127 4.2 服务的原理与使用... ..128 4.3 键盘事件处理... .130 4.4 包管理... .131 4.5 传感器... .132 4.6 浅析dalvik虚拟机JIT技术的实现... ...133 4.7 应用程序的签名...

    adb1.0.26包含fastboot.exe

    注意这个状态并不能标识 Android 系统已经完全启动和可操作,在设备启动过程中设备实例就可连接到 adb,但启动完毕后系统才处于可操作状态。 no device —— 没有设备/模拟器连接。 以上输出显示当前已经连接了...

    fcmserver:一个基本的Java Spring Boot应用程序,当通过Androidthings IOT设备上传图像时,该应用程序使用Firebase Cloud Messaging(FCM)向Android客户端发送通知。

    FCM Java服务器一个Java springboot应用程序,当通过Androidthings IOT设备上传...+}”) 通知控制器@PostMapping(path =“ / subscribe”) @GetMapping(路径=“ /全部”)安装安装依赖项和devDependencies并启动服

    ROM Toolbox Pro 6.5.1.0.apk

    重启恢复,掉电,引导程序等 ★字体安装程序★ ☆从巨大的列表或从您的SD卡安装自定义字体 ☆将字体设置为收藏夹并将其发送给朋友 ★启动动画安装程序★ ☆从巨大的集合或从你的SD卡安装自定义启动动画 ☆预览启动...

    usb_bootloader.zip

    系统开机上电后,Bootloader接管系统,初始化USB硬件,等待USB连接 Bootloader在启动后1秒内,检测USB是否连接PC:如果连接PC,则进入固件升级模式,执行第3步;超时则跳转第8步,尝试执行用户APP Bootloader模拟成...

    ap6181调通SSH和SCP+ap6212a0_r16_tinav2.1.7z

    就可以让tinav2.1在上电启动的时候,通过自动识别AP6181A2来加载其固件了。 1、使用AP6212原厂/代理商提供的固件在android4.4.2 parrotv1.1下调通AP6181: (如果没有这个文件,可以生成WLAN0节点,但是不能连网)...

Global site tag (gtag.js) - Google Analytics