android:android booting

android booting分析 立即下载

android booting

http://elinux.org/Android_Booting#Bootloader

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), usinghttp://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. Seehttp://www.linuxfordevices.com/c/a/News/Ubiquitous-QuickBoot/?kc=LNXDEVNL032410 [March, 2010]

SAP中关于预测需求的重要载体:计划独立需求 预测,就是为了调节客户需求的波动、不平衡,使企业的生产计划、物料计划尽量平稳、有序的必备工具。计划独立需求,Planned Independent Requirement(PIR)是SAP系统中最常见的预测需求。 阅读详情

相关推荐

超级详细的H3C模拟器HCL的交换机Telnet服务配置过程(图文)

VC++2017 MFC关于一个电话机房配线架进线出线节点数据库管理的程序 机房数据库原来是一个EXCEL表,查询,输入数据不方便。现用access数据库ODBC访问。平常没编过程序,编个程序练练手。记录一下学习中的问题,和解决方法,供大家分享,讨论,以便共同进步。希望多提宝贵意见,携手提高代码水平。 程序写的很不规范,代码冗余,显得程序臃肿,代码重用性差。发表这篇博客的目的也是为了改进这个程序。CListCtrl 单元格可以编辑,有Combo Box下拉列表功能。使用PreTranslateMe

techcai的博客 1万+

Android Booting (Android 引导过程)

原文网址 Android Booting The bootup of an Android system consists of several phases, which are outlined here. Contents  [hide] 1 Key bootup components 1.1 Bootloader1

闲云野鹤话IT -- Enjoy IT 1962

新代永久解锁西门子smart S7-200PLC 上传程序步骤

西门子 SMART S7-200 PLC 程序上传步骤 打开编程软件 或左下角依次打开 程序 所有程序 Siemens Automation Simatic STEP 7-MicroWIN SMART V2.4 STEP 7-MicroWIN SMART 技术交流 plcjiesuo1 2. 确认plc电源端以及输入电压; 3.用网线连接plc与电脑技术交流 plcjiesuo1 4.plc通电; 5.打开编程软件,双击通讯 6.按照...

m0_60773720的博客 2万+

Android开机速度优化

问题描述 开机时间相对参考机过慢,大约慢15s左右。Android 系统7.0。 问题分析 开机问题涉及的层次较多,大致有bootloader-->kernel-->Zygote-->PMS-->AMS-->Launcher 可以借助bootchart来分析,也可以直接通过log分析。不幸的是本项目机器因未知原因导致无法抓取到bootchart。 幸好在我浏览源码时发现了一个神器perfboot工具。具体在system/core/init/perfboot.py。 运行该

Venus 的博客 7983

工业以太网通讯Profinet协议详解

Profinet是通过西门子控制系统被广泛使用的工业通信协议,是一种较新的,基于以太网的工业通讯协议。

mydatai的专栏 8852

2024最新超详细无痛安装PyTorch,包括下载地址、环境配置与各种避坑指南

PyTorch更新很快,2024最新下载安装经验贴,包括anaconda+CUDA+cuDNN+PyTorch四部分的下载和安装。文章详细介绍了下载地址、环境配置、虚拟环境建立的问题,还温馨提示了各种闭坑指南。有需要的友友快过来康康!

qq_43596278的博客 11万+

Android启动过程

SystemServer启动过程 1.设置时间、时区、语言等; 2.startBootstrapServices:读配置,启动开机必备的服务:AMS、PMS等等 startCoreServices:其他重要服务,DropBox、电池、应用使用情况服务等 startOtherServices:通知、蓝牙、wifi等设备相关服务。 3.在AMS的systemReady 中调用startHomeActivityLocked 启动launcher。 4.Launcher启动后,会在Activit...

风和先行的专栏 3609

Ubuntu 22.04 “软件与更新”装了NVIDIA驱动,WiFi等设备不见了

在Win10装了Ubuntu22.04的双系统,台式机里面有NVIDIA 3080Ti的独立显卡,Ubuntu默认使用的nouveau驱动,需要更换成NVIDIA相应的驱动,在软件和更新里面一键安装了NVIDIA-driver-535-server之后,发现wifi、蓝牙等设备消失了。这个问题的根源据说跟这个nouveau驱动有关,希望linux社区可以解决这个问题。命令安装后 sudo reboot就可以重新看到WiFi以及蓝牙等设备图标了。然后用U盘拷贝到不能上网的Ubuntu22.04系统上,利用。

me_ysd的博客 5855

Android开机速度优化(第三篇)

参考地址:https://www.jianshu.com/p/6dba42c022a9问题描述开机时间相对参考机过慢,大约慢15s左右。Android 系统7.0。问题分析开机问题涉及的层次较多,大致有bootloader--&gt;kernel--&gt;Zygote--&gt;PMS--&gt;AMS--&gt;Launcher可以借助bootchart来分析,也可以直接通过log分析。不幸的...

wd229047557的博客 1万+

自定义模型训练——打造专属OpenClaw模型(2026AI版)

本文介绍了OpenClaw自定义模型训练的核心流程,包括框架选择(PyTorch、TensorFlow、HuggingFace和原生OpenClaw框架)、训练环境搭建脚本、以及数据收集系统的设计。数据收集器支持从数据库、API、文件和网络等多种来源获取训练数据,并提供灵活的过滤机制确保数据质量。通过这套系统,开发者可以高效准备训练数据,为后续模型训练打下坚实基础。

博客 877

【实践】VECTOR AUTOSAR创建SWC读写CAN信号

在AUTOSAR开发中最必要的功能就是读写CAN信号,本文通过一步步说明,介绍如何开发SWC来读写CAN信号,可以说在AUTOSAR中实现读写CAN信号的实践过程,是一个非常基础且典型的练习。在本篇文章阅读之前,推荐阅读AUTOSAR RTE介绍,本篇文章介绍了RTE的比较全面的介绍了AUTOSAR RTE。理解了RTE之后,才能对SWC的设计更加清楚。话不多说,接着上一篇内容VECTOR DaVinci从0到1搭建工程,此篇文章我们介绍如何在DaVinci Developer中开发SWC访问CAN信号。为

酒无忧的博客 1231

Android系统服务 AMS 启动流程

AMS为 system 创建环境:创建 AMS 对象,注册一系列的服务,如:管理四大组件、内存、CPU使用监控等为 system 进程创建,加入到AMS的进程管理中启动,拉起launch进程。

bugyinyin的博客 1946

InVEST模型 | HAbitat quality模块计算生境质量

 本文详细介绍使用InVEST模型中HAbitat quality模块计算生境质量,包含各个参数的含义、所需数据、数据处理以及需要各个参数注意的地方等过程。

地理空间科学的博客 1万+

vue页面引入另一个页面

需求描述 定时任务管理页面,在页面里点击查看日志按钮,弹框显示该任务执行的日志 有单独的日志页面,该页面可以查看所有任务执行的日志记录 为了避免写重复代码,在定时任务页面的查看日志弹窗里引入日志页面 实现思路 日志页面要想被引入,首先要导出,所以要在export default里面添加name属性,引入的时候通过导出的name查找组件 export default { name: 'lamlog' } 在任务页面引入日志页面 import lamlog from '@v

qq_31970227的博客 1万+

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

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

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

Booting Android: bootloaders, fastboot and boot images

Booting Android: bootloaders, fastboot and boot images

tuhuolong的专栏 686

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Android boot sequence (ANDROID-LEVEL :after kernel booting)

android 启动流程 In this topic you will learn some information about Android process management. First let’s take a look at the launched processes during Android booting. USER PID PPID VSIZE RSS W

Bloom and Grow 1627

计算机控制技术及应用

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

Android白话启动篇(Android booting process)

今天我们将深入Android的启动流程,从用户按下开机键到Android界面的过程。在谷歌上搜索“Android boot process”会得到很多很好英文文章,讲解Android启动这一过程,每个人讲述的角度不一样,通过阅读,对于Android的理解将会更加深刻。下面是链接,打不开的请翻墙!谢谢! https://www.google.com.hk/search?q=The+Android+

Eliot_shao的专栏 8496

Genymotion Booting 安卓虚拟机 一直加载问题

而后我将“以太网2”禁用,发现能成功运行安卓模拟器了,这里推测由于两个网卡处于同一网段,安卓模拟器不能确定需将哪一个网卡作为网关导致连接冲突,且此时能够ping通192.168.1.101,起初在通过 Genymotion(github最新release版本) 启动安卓ova镜像时,发现一直卡在Starting virtual device界面,等了十分钟还是如此。查看vbox下的虚拟机发现一直卡在第二阶段,而后查阅各种资料,排除内存不够原因,将问题锁定在网络。整个加载安卓模拟器的时间大约为。

AdamShyly的博客 3524

Android 系统启动时间分析

执行命令 adb logcat -d -b events | grep boot I/boot_progress_start(   71): 2000 I/boot_progress_preload_start(   71): 2133 I/boot_progress_preload_end(   71): 2730 I/boot_progress_system_run(  263): 277...

cjwsimple 1706

Android开机各个阶段(Android R)

Android开机各个阶段(Android R) 目录开机各个阶段描述boot_progress_startboot_progress_preload_startboot_progress_preload_endboot_progress_system_runboot_progress_pms_startboot_progress_pms_system_scan_startboot_progress_pms_data_scan_startboot_progress_pms_scan_endboo...

weixin_43215068的博客 2623

手机 bootprof 与 系统log 时间大致换算 eventlog 原理

public void systemReady(final Runnable goingCallback, TimingsTraceLog traceLog) { /// M: Boot time profiling @{ sMtkSystemServerIns.addBootEvent("AMS:systemReady"); /// M: @} 。。。。。Slog.i(T...

lei7143的专栏 1627

安卓开机启动阶段

安卓开机启动阶段

似霰的博客 2374

开机性能优化时间对比法-通过events日志部分实战

在很多同学做开启时间性能优化相关工作时候,经常用的比较多的方法肯定是抓取开机的perfetto或者systrace方法,这种方法当然是比较准确,一般抓取这个时候都是开始准备比较细微的局部优化。AMS启动完成后开始屏幕,从此以后屏幕才能响应用户的触摸,它在WindowManagerService发出退出开机动画的时间节点之前,而真正退出开机动画还会花费少许时间,具体依赖animation zip 包中的desc.txt。上面都是毫秒为单位,有了这个时间指标就可以拿来作为优化前后对比,或者各个机器之间的䶏。

learnframework的博客 1066

如何排查开机/重启时间长问题

如何查看kernel启动耗时在ylog的开机log(在poweron的目录中)中, 在0-kernel.log中搜索"init first stage started!",看看kernel log时间戳,得到kernel启动时间是多长

bestwu0666的博客 2179

Android 开机优化

本文阐述开机优化的解决过程

azhengye的专栏 1万+

Android Booting (综述)

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

Bloom and Grow 1093
上一篇: ffos:NuwaTemplateProcess
下一篇: .jsm files
nedwons
博客等级 码龄9年 311粉丝 572原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值