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.csdn.net/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]

解决Visual C++2008安装失败,error 1935 重装系统后Visual C++没了,其他都能装上但VC2008会报这个error 1935。鉴于我把网上所有的解决方法排了一遍错,我也不知道是哪一步起效,所以就都放上来了。特别注意:报error 1935的错误原因可能不尽相同,比如我的报错开头为An error occurred,结尾为HRESULT:0x80070005。80070005 拒绝访问通常是权限问题,安装Visual C++无法写入文件夹或注册表(直接跳转第7步) 阅读详情

相关推荐

calibre QRC提取寄生参数

typical将上面的文件QCI_flow里面的文件 在Cp 到当前 ,其实应该是某几个文件,但是我给忘记了 就全cp过来了 ,无影响,不过也希望大佬指正。

2202_75711937的博客 1545

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 1964

【iOS开发】dyld: Symbol not found: ___chkstk_darwin 问题解决

【iOS开发】dyld: Symbol not found: ___chkstk_darwin 问题解决 Xcode 13.2.1 运行到iOS12.x版本上崩溃报错如下:dyld: Symbol not found: ___chkstk_darwin dyld: Symbol not found: ___chkstk_darwin Referenced from: /private/var/containers/Bundle/Application/A424CEFD-51DB-450E-9D62-B8

wm9028的专栏 6571

Android开机速度优化

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

Venus 的博客 7996

如何给数据添加高斯白噪声?

首先测试集应该是加噪声的,至于训练集需不需要加噪声就见仁见智了。我个人测试的结果是,训练集如果不加噪声的话效果特别差,如果加噪声的话效果就比较好接受,大家可以自己试试看。在轴承故障研究中免不了要涉及到给数据主动加入噪声的情况,一般我们加的是高斯白噪声。由于热噪声是由大量自由电子的运动产生的,其统计特性服从高斯分布,故常将热噪声称为高斯白噪声。的频谱是均匀分布的,好像白光的频谱在可见光的频谱范围内均匀分布那样,所以热噪声又常称为。定义一:如果一个噪声,它的瞬时值服从。又是均匀分布的,则称它为高斯白噪声。

weixin_50642818的博客 5223

小梅哥Xilinx ZYNQ学习笔记2——38译码器

译码器(Decoder)是一种多输入多输出的组合逻辑电路,负责将二进制代码翻译为特定的对象(如逻辑电平等),功能与编码器相反。译码器一般分为通用译码器和数字显示译码器两大类。本设计的是通用译码器。三八译码器,即是 3 种输入状态翻译成 8 种输出状态。1.case开始开始,endcase结束;2.数字声明时,合法的基数格式有 4 中,包括:十进制('d 或 'D),十六进制('h 或 'H),二进制('b 或 'B),八进制('o 或 'O)。数值可指明位宽,也可不指明位宽。

m0_51430584的博客 1640

Android启动过程

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

风和先行的专栏 3610

Gmsh+OCC对应版本库编译

输入 GMSH_DLL_EXPORT值C:\LIB\OCCT-7_8_0-i;9、如果只是生成库文件编译gmesh工程即可生成文件在C:\LIB\Gmsh\gmsh-4.13.1-Windows64-B\Debug 下gmsh.dll、gmsh.lib、gmsh.h、gmshc.h文件;3、CMAK编译Gmsh对应OCC版本的,CMAK选择源文件路径C:\LIB\Gmsh\gmsh-4.13.1-source,生成构建文件路径C:\LIB\Gmsh\gmsh-4.13.1-Windows64-B。

u013401364的博客 417

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万+

国产系统(统信 UOS )漏洞修复方式

2.1 服务器版(单漏洞更新):服务器标准版:yum upgrade-minimal --cve “CVE编号”服务器 D 版:sudo apt update&&sudo apt install “受影响的软件包”1 统信 UOS 漏洞修复方式在线升级修复桌面专业版:通过以下步骤打开在线升级:控制中心–>更新–>更新设置–>打开系统更新、安全更新。安装过程中,请勾选“我已阅读并知晓”,然后点击“开始升级”。2 点击“检查更新”–“全部下载”,如果不想进行系统更新,可以选择只下载“安全更新”。

Reyn_观极 5053

【红外DDE算法】一种应用于高动态范围红外可视化的算法

【红外DDE算法】一种应用于高动态范围红外可视化的算法 - 这个算法背后的动机 - 展示这个算法的流程 - 然后讨论各个可调参数的意义。

sunwindl91181的博客 1687

Android系统服务 AMS 启动流程

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

bugyinyin的博客 1947

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

vue页面引入另一个页面

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

qq_31970227的博客 1万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Booting Android: bootloaders, fastboot and boot images

Booting Android: bootloaders, fastboot and boot images

tuhuolong的专栏 686

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 1630

Android白话启动篇(Android booting process)

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

Eliot_shao的专栏 8499

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

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

AdamShyly的博客 3538

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 1707

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的博客 2626

手机 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

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

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

learnframework的博客 1077

安卓开机启动阶段

安卓开机启动阶段

似霰的博客 2384

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

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

bestwu0666的博客 2181

Android 开机优化

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

azhengye的专栏 1万+

Android Booting (综述)

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

Bloom and Grow 1094
上一篇: 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、付费专栏及课程。

余额充值
⌂ 换网址