Android Booting (Android 引导过程)

Android booting flow introduction 第一阶段:Android设备上电后,首先会从处理器片上ROM的启动引导代码开始执行,片上ROM会寻找Bootloader代码,并加载到内存。(这一步由“芯片厂商”负责设计和实现)第二阶段:Bootloader开始执行,首先负责完成硬件的初始化,然后找到Linux内核代码,并加载到内存。(这一步由“设备厂商”负责设计和实现)第三阶段:Linux内核开始启动,初始化各种软硬件环境,加载驱动程序,挂载根文 阅读详情

原文网址


Android Booting

The bootup of an Android system consists of several phases, which are outlined here.

Contents

  [hide]

Key bootup components

Bootloader

The first program which runs on any Android system is the bootloader. Technically, the bootloader is outside the realm of Android itself, and is used to do very low-level system initialization, before loading the Linux kernel. The kernel then does the bulk of hardware, driver and file system initialization, before starting up the user-space programs and applications that make up Android.

Often, the first-stage bootloader will provide support for loading recovery images to the system flash, or performing other recovery, update, or debugging tasks.

The bootloader on the ADP1 detects certain keypresses, which can be used to make it load a 'recovery' image (second instance of the kernel and system), or put the phone into a mode where the developer can perform development tasks ('fastboot' mode), such as re-writing flash images, directly downloading and executing an alternate kernel image, etc.

'init'

A key component of the Android bootup sequence is the program 'init', which is a specialized program for initializing elements of the Android system. Unlike other Linux systems (embedded or otherwise), Android uses its own initialization program. (Linux desktop systems have historically used some combination of /etc/inittab and sysV init levels - e.g. /etc/rc.d/init.d with symlinks in /etc/rc.d/rc.[2345]). Some embedded Linux systems use simplified forms of these -- such as the init program included in busybox, which processes a limited form of /etc/inittab, or a direct invocation of a shell script or small program to do fixed initialization steps.

The Android 'init' program processes two files, executing the commands it finds in them, called 'init.rc' and 'init.<machine_name>.rc', where <machine_name> is the name of the hardware that Android is running on. (Usually, this is a code word. The name of the HTC1 hardware for the ADP1 is 'trout', and the name of the emulator is 'goldfish'.

The 'init.rc' file is intended to provide the generic initialization instructions, while the 'init.<machine_name>.rc' file is intended to provide the machine-specific initialization instructions.

'init' resources

The syntax for these .rc files is documented in a readme file in the source tree. See the Android init language reference

Or, see also: http://www.kandroid.org/android_pdk/bring_up.html

See also http://www.androidenea.com/2009/08/init-process-and-initrc.html

Sequence of boot steps on ADP1

firmware

  • first-stage bootloader runs
    • it detects if a special key is held, and can launch the recovery image, or the 'fastboot' bootloader
  • eventually, a kernel is loaded into RAM (usually with an initrd)
    • normally, this will be the kernel from the 'boot' flash partition.

kernel

  • the kernel boots
    • core kernel initialization
      • memory and I/O areas are initialized
      • interrupts are started, and the process table is initialized
    • driver initialization
    • kernel daemons (threads) are started
    • root file system is mounted
    • the first user-space process is started
      • usually /init (note that other Linux systems usually start /sbin/init)

user space

  • the kernel runs /init
    • /init processes /init.rc and /init.<machine_name>.rc
    • dalvik VM is started (zygote). See Android Zygote Startup
    • several daemons are started:
      • rild - radio interface link daemon
      • vold - volume daemon (media volumes, as in file systems - nothing to do with audio volume)
  • the system_server starts, and initializes several core services
  • the activity manager starts core applications (which are themselves dalvik applications)
    • com.android.phone - phone application
    • android.process.acore - home (desktop) and a few core apps.
  • other processes are also started by /init, somewhere in there:
    • adb
    • mediaserver
    • dbus-daemon
    • akmd

Tools for analyzing Android Bootup

01-01 00:00:08.396 I/boot_progress_start(  754): 12559
01-01 00:00:13.716 I/boot_progress_preload_start(  754): 17879
01-01 00:00:24.380 I/boot_progress_preload_end(  754): 28546
01-01 00:00:25.068 I/boot_progress_system_run(  768): 29230
01-01 00:00:25.536 I/boot_progress_pms_start(  768): 29697
01-01 00:00:25.958 I/boot_progress_pms_system_scan_start(  768): 30117
01-01 00:00:40.005 I/boot_progress_pms_data_scan_start(  768): 44171
01-01 00:00:45.841 I/boot_progress_pms_scan_end(  768): 50006
01-01 00:00:46.341 I/boot_progress_pms_ready(  768): 50505
01-01 00:00:49.005 I/boot_progress_ams_ready(  768): 53166
01-01 00:00:52.630 I/boot_progress_enable_screen(  768): 56793
    • or this: 'adb logcat -d | grep preload'
10-15 00:00:17.748 I/Zygote  (  535): ...preloaded 1873 classes in 2438ms.
10-15 00:00:17.764 I/Zygote  (  535): ...preloaded 0 resources in 0ms.
10-15 00:00:17.772 I/Zygote  (  535): ...preloaded 15 resources in 7ms.
  • Bootchart - see Using Bootchart on Android
  • strace is pretty handy also, to see the timings for system calls from a process as it runs
    • You can use strace as a wrapper for a program in init.rc, and save the results to a file
    • Use -f to follow sub-processes
    • Use -tt to get detailed timestamps for syscalls
    • Use -o to output the data to a file

Here is an example of using strace to follow the startup of zygote, and the apps that are forked from it.

Replace:

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server

with

service zygote /system/xbin/strace -f -tt -o /cache/debug/boot.strace /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server

Here is some sample data:

$ head boot.strace
571   00:00:11.389939 execve("/system/bin/app_process", ["/system/bin/app_process", "-Xzygote", "/system/bin", "--zygote", "--start-system-server"], [/* 15 vars */]) = 0
571   00:00:11.658878 brk(0)            = 0x804b000
571   00:00:11.659048 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77f9a000
571   00:00:11.659169 readlink("/proc/self/exe", "/system/bin/app_process", 4096) = 23
571   00:00:11.659339 access("/etc/ld.so.preload", R_OK) = 0
571   00:00:11.659440 open("/etc/ld.so.preload", O_RDONLY) = 3
571   00:00:11.659548 fstat64(0x3, 0x7fa76650) = 0
571   00:00:11.659887 mmap2(NULL, 36, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x77f99000
571   00:00:11.659970 close(3)          = 0
571   00:00:11.660071 open("/lib/libc_sse.so", O_RDONLY) = 3

Please note that writing the strace data takes extra time. For long sequences of very fast syscalls (such as when the timezone file is being read) the overhead of strace itself exaggerates the timings in the trace. Use the timing information with caution.

Notes on the Android startup procedure

Overview

See "Android Initialization Process" at: http://blog.chinaunix.net/u2/85805/showart_1421736.html (this address is not work), using http://blog.chinaunix.net/space.php?uid=7788581&do=blog&id=2558375 instead.

strace

http://benno.id.au/blog/2007/11/18/android-runtime-strace

Interaction of different processes on application initialization

Talking about Android Process - http://blog.youkuaiyun.com/mawl2002/archive/2009/06/24/4295905.aspx

Improving Bootup Time presentation

See Improving Android Boot Time - notes and material for a talk at LinuxCon North America, 2010 by Tim Bird

News

1-second boot of Android

Ubiquitous Corporation has announced boot of ARM-based Android system in 1 second. Actually, it's more like a suspend and resume than a boot. See http://www.linuxfordevices.com/c/a/News/Ubiquitous-QuickBoot/?kc=LNXDEVNL032410 [March, 2010]


纯Web前端实现怀旧卡带插入效果:状态机与安卓兼容实战 打造高传播力的前端交互,往往不在于复杂框架,而在于对浏览器原生能力的深度挖掘。卡带插拔动画本质上是一个由状态驱动的用户界面交互流程。借助状态机来管理动画状态,可以避免异步事件导致的界面混乱;利用 Web Audio API 实时合成音效,则能在不加载额外资源的前提下增强操作反馈。当目标平台是安卓系统时,开发者需要关注浏览器的能力边界,合理选择 API 子集并做好能力降级,从而确保不同 WebView 下的稳定运行。这类交互设计可广泛应用于游戏收藏夹、模拟器导航页、开源掌机启动界面等场景,有效提升用户打开页面 阅读详情

相关推荐

安卓虚拟机跑老系统:Vectras VM 中的 NT 4.0 与 ME 兼容性实践

虚拟化技术通过软件模拟完整硬件环境,让不同架构与时代的操作系统在同一设备上运行。QEMU 作为经典的系统模拟器,能够抽象出 CPU、内存、磁盘控制器等设备模型,其价值在于打破硬件绑定,却也对兼容性设计提出严苛要求。当在安卓设备上借助 Vectras VM 尝试安装 Windows NT 4.0 与 Windows ME 这类老系统时,内存大小、磁盘类型、ACPI 开关等参数都会成为启动成败的关键。这种看似复古的实验,恰恰是理解现代虚拟机工作原理和硬件抽象层的绝佳途径。从 BIOS 引导顺序到设备驱动代差,每

weixin_30443075的博客 414

Android系统启动流程分析

title: Android系统启动流程分析 date: 2021-09-27 23:35:00 tags: - 系统启动 - Android - Framework categories: Framework keywords: ‘Android,系统启动,Framework’ description: 此笔记记录分析Android系统启动过程的分析。 cover: https://upload-images.jianshu.io/upload_images/13838098-709a95ad43e71.

u010248147的博客 5695

Android 系统启动过程

本文完整拆解 Android 从按下电源键到桌面出现的七阶段启动链路,涵盖 BootROM、BootLoader、Linux Kernel、init、Zygote、SystemServer 及 Launcher 各阶段的核心职责与耗时分解。提供 preload 裁剪、服务延迟启动、bootchart 分析等开机优化实战,以及卡 Logo 问题的串口与 logcat 调试方法。

weixin_44081096的博客 646

android:android booting

android booting http://elinux.org/Android_Booting#Bootloader Contents  [hide] 1 Key bootup components 1.1 Bootloader 1.2 'init' 1.2.1 'init' resources 2 Seq...

hunter 408

android booting分析

Android 开机流程,是个很值得详细讨论的主题

Bootmenu1.0.5

安装bootmenu-A953.V.1.0.5.apk,并打开,提示授权时选择允许,然后依次选择安装bootmenu和进入恢复模式。

配有 1TB 驱动器的 Surface Pro 5 设备显示两个驱动器

症状 在配有 1TB 驱动器的某些 Surface 设备上遇到以下症状: Diskpart 显示两个 512 GB 驱动器而不是一个 1 TB 驱动器。 Windows 资源管理器显示两个 512 GB 驱动器而不是一个 1 TB 驱动器。 裸机恢复 (BMR) 映像表示“在恢复您的电脑时出现问题”,或者在尝试恢复 BMR 映像时报告其他错误。 原因 出现此问题的原因是,某些配有 1TB 驱动器的 Surface 设备使用存储空间技术将两个 512GB 驱动器合并.

loveinfall_wyc的博客 1889

黑科技已上线|Lazada数据分析软件,一键式搞定你的店铺!

工欲利其事,必先利其器。在lazada跨境电商的整个流程中,适当的使用一些工具,不仅能大大的简化工作流程,而且可以提高实施效率。Mengla专为lazada电商卖家行业精细化分析lazada数据分析软件都有哪些强大功能! 一、两大优势: 1.海量数据: 数据覆盖面积大;数据分析维度逛;精确算法抓取海量数据;亿万数据秒级响应多种数据来源; 2.技术成熟: 深耕SaaS大数据挖掘;提供一站式数据分析服务;拥有领先的采集技术和运算模型架构; 二、Lazada数据分析软件的功能: 1.各国站点一键分析: 马来西亚

Menglakeji的博客 1146

Android Booting (综述)

Android 開機流程,是一個很值得詳細討論的主題;近期,也正在進行相關的技術工作,因此簡單整理一些相關資料,和大家分享。了解「整體開機流程」,是最重要的第一門課。我們將開機劃分為三大階段: 1. OS-Level,由 Bootloader 載入 Linux kernel 後,開始進行 kernel 本身的初始化,並載入 built-in 的驅動程式。Kernel 完成開機後,載入 init

Bloom and Grow 1093

Python控制tek示波器(1)

如何使用Python来控制tek示波器

m0_47441496的博客 3379

window下迁移SVN仓库到新的windows服务器

window下迁移SVN仓库到新的windows服务器

Bertram的博客 4692

android booting 启动过程

原文http://elinux.org/Android_Booting#Bootloader Android 系统的启动过程分为若干个阶段,本文主要介绍一下内容 Contents [hide] 1Key bootup components 1.1Bootloader 1.2'init' 1.2.1'init' resources 2Se...

移动开发记录 340

PyTorch复现PSMNet踩坑全记录:从环境配置到KITTI数据集训练

本文详细记录了使用PyTorch复现CVPR经典立体匹配模型PSMNet的全过程,从环境配置到KITTI数据集训练,特别针对2023年主流软硬件环境中的常见问题提供解决方案。文章重点介绍了PSMNet的金字塔池化模块和堆叠沙漏结构,帮助研究者和工程师快速实现工业级深度估计,节省大量试错时间。

weixin_30897233的博客 328

无法引导 Android x86,Android-x86 9.0-r2 稳定版发布 修复在UEFI模式下iso无法引导问题...

Android-x86 9.0-r2 已发布,此版本是基于 Android-x86 9.0 (pie-x86) 的第二个稳定版。9.0-r2 基于最新的 Android 9.0.0 Pie 版本(android-9.0.0_r54),与 9.0-r1 相比,此版本进行了重大升级,例如对Mesa Vulkan 的初始支持、在 Mesa 上支持 OpenGL ES 3.x、升级至 Linux 4.19...

weixin_42508185的博客 1132

Unity 接入 Steam 平台

Unity 接入 steam sdk 的登录和应用内购买功能

MarinaTsang的博客 3904

CTFshow MISC入门实战:010Editor+TweakPNG解决PNG隐写难题(附完整脚本)

本文详细介绍了在CTFshow MISC比赛中,如何利用010Editor和TweakPNG两款专业工具构建高效的PNG隐写分析工作流。文章从PNG文件结构解析入手,通过实战案例演示了如何协同使用010Editor进行二进制侦察与结构分析,以及使用TweakPNG进行数据块的精准编辑与删除,并最终提供了自动化分析脚本,帮助选手系统性地解决PNG隐写难题。

weixin_29252171的博客 75

android x86 安装it,Android X86 虚拟机安装手册

自从安卓手机操作系统诞生以来,一时间在手机市场可谓是风声水起,诺基亚王朝的败落,摩托的再次崛起,国产手机的发展方向可以说都和Android,这个小机器人有着千丝万缕的关系。随着android在手机市场上的普及,有些人既然试着将android移植到X86的电脑上,这也就是android-x86项目。我也试着在虚拟机中安装了一些,我想一些经验还是值得和大家分享的。首先新建虚拟机,种类要选择other中...

weixin_35453718的博客 645

dji psdk开发 关于SDK认证芯片的使用

Payload SDK V3.10.0 于 2025-1-8 发布,增加了 Matrice 4T/4E 机型支持,同时也增加了 DJI SDK 认证芯片(DJI SDK CC)功能支持。关于认证芯片的介绍大疆 SDK 认证芯片(DJI SDK Certified Chip),简称 DJI SDK CC,用于认证基于 DJI Eport/Eport-Lite 接口开发的第三方负载设备,确保设备能够正常工作并与无人机可以进行有效通信,起到负载安全认证和功能授权的作用。

热爱生活,忠于自己 2146

Booting Android: bootloaders, fastboot and boot images

Booting Android: bootloaders, fastboot and boot images

tuhuolong的专栏 686

如何懂固高卡以及滚筒轴+平移轴配合运动?

🏆本文收录于专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家!持续更新中,up!up!up!!

**My Coding Family** 849

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Building and booting Nexus 5 kernel

Date 06/05/2014 Tags english / master's thesis / linux My description of building process will be strongly based on this article which was a great help in whole process:http://pete.akeo.ie/2013

Fly20141201. 的专栏 1311

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

3分钟解锁安卓自动开机:Magisk Autoboot模块让设备告别手动启动

你是否厌倦了每次设备关机后都要寻找电源键?或者需要频繁重启设备进行测试却觉得手动操作太麻烦?今天,我将向你介绍一个改变游戏规则的Magisk模块——Magisk Autoboot。这个智能模块能让你的安卓设备在连接充电器时自动开机,真正实现"即插即用"的智能化体验。**安卓自动开机**功能从此不再需要复杂的硬件改造或专业的技术知识。 ## 你的设备为什么需要自动启动功能? 想象一下这些场景,你

gitblog_00809的博客 776

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

终极指南:Magisk Autoboot模块如何实现安卓设备智能自动启动

你是否曾为每次设备关机后都要手动按电源键而烦恼?或者在进行自动化测试时,频繁的设备重启让你效率低下?今天,我将为你深入解析一个革命性的Magisk模块——Magisk Autoboot,它能让你的安卓设备在连接充电器时自动开机,真正实现"即插即用"的智能化体验。这个**Magisk自动启动模块**通过巧妙的技术手段,解决了安卓设备无法自动启动的长期痛点。 ## 核心价值:为什么你需要Magisk

gitblog_01139的博客 875

安卓自动开机终极指南:Magisk Autoboot模块完整使用教程

你是否厌倦了每次给手机充电都要手动按电源键?是否希望设备能像智能家居一样"即插即用"?今天我要介绍的Magisk Autoboot模块,正是解决这一痛点的完美方案。这个神奇的模块能让你的安卓设备在连接充电器时自动开机,实现真正的零操作启动体验。 ## 🤔 为什么你需要自动开机功能? 想象这些场景: - 家庭媒体中心设备断电后需要手动重启 - 自动化测试设备需要频繁重启 - 展示设备意外关机后

gitblog_00030的博客 413

深入解析TMS320F2837xS引导机制:从原理到实战配置

微控制器的引导机制是嵌入式系统开发的基础,它决定了系统上电后的初始执行路径。其核心原理在于芯片复位后,由固化的Boot ROM代码接管,根据预设的启动配置(如GPIO引脚状态或寄存器值)决定从何处加载并跳转用户程序。理解这一机制的技术价值在于,它不仅是系统可靠启动的保障,更是实现固件远程升级、多版本切换等高级功能的基础。在电机控制、数字电源等实时性要求高的应用场景中,稳定的引导流程能有效避免系统“变砖”风险。本文以德州仪器C2000系列中的TMS320F2837xS为例,深入剖析其Boot ROM的工作流程

weixin_34214500的博客 435
上一篇: Ten potential of mobile Internet business and profit model
下一篇: Android Custom UI: Making a Vintage Thermometer
AutoAsm
博客等级 码龄27年 27粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值