前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >android 启动过程 booting process

android 启动过程 booting process

作者头像
平凡的学生族
发布2019-05-25 09:33:41
7910
发布2019-05-25 09:33:41
举报
文章被收录于专栏:后端技术后端技术

流程图

主要以下几个阶段

  • Step 1: Power On and System Startup
  • Step 2: Bootloader
  • Step 3: Kernel
  • Step 4: init process
  • Step 5: Zygote and Dalvik
  • Step 6: System service

step1: Power On and System Startup

When we press the power button, the Boot ROM code starts executing from a pre-defined location which is hardwired in ROM. It loads the Bootloader into RAM and starts executing.

Step 2: Bootloader

总的来说,bootloader是为了定位并加载linux kernal的。 Bootloader核心任务就是要初始化内存,把boot.img(kernel 和 ramdisk)从flash上copy到RAM上面,然后交出对CPU的控制权给kernel。当然,这个过程bootloader还会初始化一下LCM、串口、时钟神马的。什么是ramdisk(虚拟内存盘)


个人认为,step 1 和 step 2比较像是某种黑盒子,我们不太需要深究它的细节,只要大概清除它的作用是什么就好了。

当机器/芯片启动时,芯片上的写死的 bootloader会解压linux kernel(kernal以压缩方式存储在闪存上),把它加载到内存中,并把控制权交给linux

Step 4: init process

Init is the very first process, we can say it is a root process, or the grandfather of all processes. The init process has two responsibilities.

  • 1- 挂载目录。Mounts directories like /sys , /dev or /proc 什么是挂载目录
  • 2- 运行init.rc。Runs init.rc script

  • The init process can be found at /init :: <android source>/system/core/init
  • Init.rc file can be found at :: <android source>/system/core/rootdir/

Android has specific format and rules for init.rc files. More information about this rules can be found in: What is inside the init.rc and what is it used for.

At this stage, you can finally see the Android logo in your screen.


参考文献 什么是挂载目录 Digging Into Android Startup(youtube视频) Android白话启动篇(Android booting process) Android 应用进程启动流程 The Android Booting process

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.01.24 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • step1: Power On and System Startup
  • Step 2: Bootloader
  • Step 4: init process
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档