ImageVerifierCode 换一换
格式:DOC , 页数:20 ,大小:140.54KB ,
资源ID:2954151      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/2954151.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(Android开机启动作业流程.doc)为本站上传会员【精***】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

Android开机启动作业流程.doc

1、Android开机流程   1.    系统引导bootloader 1)        源码:bootable/bootloader/* 2)        阐明:加电后,CPU将先执行bootloader程序,此处有三种选取 a)        开机按Camera+Power启动到fastboot,即命令或SD卡烧写模式,不加载内核及文献系统,此处可以进行工厂模式烧写 b)        开机按Home+Power启动到recovery模式,加载recovery.img,recovery.img包括内核,基本文献系统,用于工程模式烧写 c)        开机按Power,正

2、常启动系统,加载boot.img,boot.img包括内核,基本文献系统,用于正常启动手机(如下只分析正常启动状况) 2.    内核kernel 1)        源码:kernel/* 2)        阐明:kernel由bootloader加载 3.    文献系统及应用init 1)        源码:system/core/init/* 2)        配备文献:system/rootdir/init.rc, 3)        阐明:init是一种由内核启动顾客级进程,它按照init.rc中设立执行:启动服务(这里服务指linux底层服务,如adbd提供a

3、db支持,vold提供SD卡挂载等),执行命令和按其中配备语句执行相应功能 4.    重要后台程序zygote 1)        源码:frameworks/base/cmds/app_main.cpp等 2)        阐明:zygote是一种在init.rc中被指定启动服务,该服务相应命令是/system/bin/app_process a)        建立Java Runtime,建立虚拟机 b)        建立Socket接受ActivityManangerService祈求,用于Fork应用程序 c)        启动System Server 5. 

4、   系统服务system server 1)        源码:frameworks/base/services/java/com/android/server/SystemServer.java 2)        阐明:被zygote启动,通过System Manager管理android服务(这里服务指frameworks/base/services下服务,如卫星定位服务,剪切板服务等) 6.    桌面launcher 1)        源码:ActivityManagerService.java为入口,packages/apps/launcher*实现 2)     

5、   阐明:系统启动成功后SystemServer使用xxx.systemReady()告知各个服务,系统已经就绪,桌面程序Home就是在ActivityManagerService.systemReady()告知过程中建立,最后调用 ()启launcher 7.    解锁 1)        源码: frameworks/policies/base/phone/com/android/internal/policy/impl/*lock* 2)        阐明:系统启动成功后SystemServer调用wm.systemReady()告知WindowManagerService

6、进而调用PhoneWindowManager,最后通过LockPatternKeyguardView显示解锁界面,跟踪代码可以看到解锁界面并不是一种Activity,这是只是向特定层上绘图,其代码了存储在特殊位置 8.    开机自启动第三方应用程序 1)        源码: frameworks/base/services/java/com/android/server/am/ActivityManagerService.java 2)        阐明:系统启动成功后SystemServer调用ActivityManagerNative.getDefault().system

7、Ready()告知ActivityManager启动成功,ActivityManager会通过置变量mBooting,告知它另一线程,该线程会发送广播android.intent.action.BOOT_COMPLETED以告知已注册第三方程序在开机时自动启动。 9.    总结 综上所述,系统层次关于启动最核心某些是zygote(即app_process)和system server,zygote它负责最基本虚拟机建立,以支持各个应用程序启动,而system server用于管理android后台服务,启动环节及顺序。 10. 参照

8、 Android 启动过程详解 Android从Linux系统启动有4个环节; (1) init进程启动 (2) Native服务启动 (3) System Server,Android服务启动 (4) Home启动 总体启动框架图如:   第一步:initial进程(system/core/init)      init进程,它是一种由内核启动顾客级进程。内核自行启动(已经被载入内存,开始运营,并已初始化所有设备驱动程序和数据构造等)之后,就通过启动一种顾客级程序init方式,完毕引导进程。

9、init始终是第一种进程. Init.rc Init.marvell.rc Init进程一起来就依照init.rc和init.xxx.rc脚本文献建立了几种基本服务:  servicemanamger  zygote 。。。 最后Init并不退出,而是担当起property service功能。 1.1脚本文献 init@System/Core/Init Init.c: parse_config_file(Init.rc)   @parse_config_file(Init.marvel.rc) 解析脚本文献:Init.rc和Init.xxxx.rc(硬

10、件平台有关) Init.rc是Android自己规定初始化脚本(Android Init Language,System/Core/Init/readme.txt) 该脚本包括四个类型声明: Actions Commands Services Options. 1.2 服务启动机制 咱们来看看Init是这样解析.rc文献启动服务。 (1)打开.rc文献,解析文献内容@ system/core/init/init.c 将service信息放置到service_list中。@ system/core/init parser.c (2)restart_service()

11、@ system/core/init/init.c service_start execve(…).建立service进程。 第二步 Zygote Servicemanager和zygote进程就奠定了Android基本。Zygote这个进程起来才会建立起真正Android运营空间,初始化建立Service都是Navtive service.在.rc脚本文献中zygote描述: service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server 因此Zygote从

12、main(…)@frameworks/base/cmds/app_main.cpp开始。 (1) main(…)@frameworks/base/cmds/app_main.cpp 建立Java Runtime runtime.start("com.android.internal.os.ZygoteInit",startSystemServer); (2) 建立虚拟机 运营:com.android.internal.os.ZygoteInit:main函数。 (3)main()@com.android.internal.os.ZygoteInit//正真Zygote。

13、 registerZygoteSocket();//登记Listen端口 startSystemServer(); 进入Zygote服务框架。 通过这几种环节,Zygote就建立好了,运用Socket通讯,接受ActivityManangerService祈求,Fork应用程序。 第三步 System Server 在Zygote上fork了一种进程: com.android.server.SystemServer.于是SystemServer@(SystemServer.java)就建立了。Android所有服务循环框架都是建立SystemServer@(SystemServe

14、r.java)上。在SystemServer.java中看不到循环构造,只是可以看到建立了init2实现函数,建立了一大堆服务,并AddService到service Manager。 main() @ com/android/server/SystemServer { init1(); } Init1()是在Native空间实现(com_andoird_server_systemServer.cpp)。咱们一看这个函数就懂得了,init1->system_init() @System_init.cpp 在system_init()咱们看到了循环闭合管理框架。 { Cal

15、l "com/android/server/SystemServer","init2" ….. ProcessState::self()->startThreadPool();     IPCThreadState::self()->joinThreadPool(); } init2()@SystemServer.java中建立了Android中所有要用到服务。 这个init2()建立了一种线程,来New Service和AddService来建立服务 第三步 Home启动 在后半段,咱们可以看到系统在启动完所有Android服务后,做了这样某些动作: (1)

16、 使用xxx.systemReady()告知各个服务,系统已经就绪。 (2)  特别对于ActivityManagerService.systemReady(回调) Widget.wallpaper,imm(输入法)等ready告知。 Home就是在ActivityManagerService.systemReady()告知过程中建立。下面是ActivityManagerService.systemReady()伪代码: systemReady()@ActivityManagerService.java resumeTopActivityLocked() startHomeA

17、ctivityLocked();//如果是第一种则启动HomeActivity。 startActivityLocked(。。。)CATEGORY_HOME Android Booting: init is the first process after kernel started. The corresponding source code lies in:device/system/init. It does the following ta

18、sks step by step: 1.Initialize log system. 2.Parse /init.rc and /init.%hardware%.rc. 3. Execute early-init action in the two files parsed in step 2. 4. Device specific initialize. For example,make all device node in /dev and download firmwares. 5. Initialize property system. Actually the pr

19、operty system is working as a share memory. Logically it looks like a registry under Windows system. 6. Execute init action in the two files parsed in step 2. 7. Start property service. 8. Execute early-boot and boot actions in the two files parsed in step 2. 9. Execute property action in th

20、e two files parsed in step 2. 10. Enter into an indefinite loop to wait for device/property set/child process exit events. For example,if an SD card is plugined,init will receive a device add event,so it can make node for the device. Most of the important process is forked in init,so if any of the

21、m crashed,init will receive a SIGCHLD then translate it into a child process exit event,so in the loop init can handle the process exit event and execute the commands defined in *.rc(it will run command onrestart).   The .rc file is a script file defined by Android. The default is device/system/

22、rootdir/init.rc. We can take a loot at the file format(device/system/init/readme.txt is a good overall introduction of the script). Basically the script file contains actions and services. Actions Actions are named sequences of commands. Actions have a trigger which is used to determine when the

23、 action should occur.  When an event occurs which matches an action's trigger,that action is added to the tail of a to-be-executed queue (unless it is already on the queue). Each action in the queue is dequeued in sequence and each command in that action is executed in sequence.  Init handles othe

24、r activities (device creation/destruction,property setting,process restarting) "between" the execution of the commands in activities. Actions take the form of: on          ... Services Services are programs which init launches and (optionally) r

25、estarts when they exit.  Services take the form of: service [ ]*   

26、 kinds of events and used to cause an action to occur.   The builtin supported commands are defined in device/system/init/keywords.h. Commands are implementd in device/system/init/bultins.c.   The init program only executes five kinds of triggers:“early-init”,“init”,“early-boot”,“boot”,“prop

27、erty:*”. Take a look at the following line in default init.rc. class_start default This line is a command for the action corresponding to “boot” trigger. It will start all services whose class name equals to “default”. By default,if no class option is defined for a service,the service’s class na

28、me is “default”. So this line will start all the services in the order of position in the file by default. (BTW,you can start any service using start commands,if you like.) Any service is run as a forked process of init,take a look at the source code of service_start in device/system/init.c.   S

29、o according to the default init.rc,the following services will be executed step by step: console:star a shell. The source is in device/system/bin/ash. adbd:start adb daemon. The source is in device/tools/adbd. By default is disabled. servicemanager:start binder system. The source is in device/c

30、ommands/binder. mountd:mount all fs defined in /system/etc/mountd.conf if started,receive commands through local socket to mount any fs. The source is in device/system/bin/mountd. debuggerd:start debug system. The source is in device/system/bin/debuggerd. rild:start radio interface layer daemo

31、n. The source is in device/commands/rind. zygote:start Android Java Runtime and start system server. It’s the most important service. The source is in device/servers/app. media:start AudioFlinger,MediaPlayerService and CameraService. The source is in device/commands/mediaserver. bootsound:play

32、 the default boot sound /system/media/audio/ui/boot.mp3. The source is in device/commands/playmp3. dbus:start dbus daemon,it’s only used by BlueZ. The source is in device/system/Bluetooth/dbus-daemon. hcid:redirect hcid’s stdout and stderr to the Android logging system. The source is in device/s

33、ystem/bin/logwrapper. By default is disabled. hfag:start Bluetooth handsfree audio gateway,it’s only used by BlueZ. The source is in device/system/Bluetooth/bluez-utils. By default is disabled. hsag:start Bluetooth headset audio gateway,it’s only used by BlueZ. The source is in device/system/Blu

34、etooth/bluez-utils. By default is disabled. installd:start install package daemon. The source is in device/servers/installd. flash_recovery:load /system/recovery.img. The source is in device/commands/recovery/mtdutils.   Zygote service does the following tasks step by step: 1. Create JAVA V

35、M. 2. Register android native function for JAVA VM. 3. Call the main function in the JAVA class named com.android.internal.os.ZygoteInit whose source is device/java/android/com/android/internal/os/ZygoteInit.java. a)  Load ZygoteInit class b)  Register zygote socket c)  Load preload classe

36、s(the default file is device/java/android/preloaded-classes) d)  Load preload resources e)  Call Zygote::forkSystemServer (implemented in device/dalvik/vm/InternalNative.c) to fork a new process. In the new process,call the main function in the JAVA class named com.android.server.SystemServer,wh

37、ose source is in device/java/services/com/android/server.                          i.              Load libandroid_servers.so                        ii.              Call JNI native init1 function implemented in device/libs/android_servers/com_android_server_SystemServers. It only calls system_i

38、nit implemented in device/servers/system/library/system_init.cpp. l         If running on simulator,instantiate AudioFlinger,MediaPlayerService and CameraService here. l         Call init2 function in JAVA class named com.android.server.SystemServer,whose source is in device/java/services/com/an

39、droid/server. This function is very critical for Android because it start all of Android JAVA services. l         If not running on simulator,call IPCThreadState::self()->joinThreadPool() to enter into service dispatcher.   SystemServer::init2 will start a new thread to start all JAVA services

40、 as follows: Core Services: 1.       Starting Power Manager // 2.       Creating Activity Manager 3.       Starting Telephony Registry // 4.       Starting Package Manager // 5.       Set Activity Manager Service as System Process 6.       Starting Context Manager 7.       Starting System

41、 Context Providers 8.       Starting Battery Service // 9.       Starting Alarm Manager // 10.   Starting Sensor Service 11.   Starting Window Manager 12.   Starting Bluetooth Service // 13.   Starting Mount Service // Other services // 1.       Starting Status Bar Service 2.       Star

42、ting Hardware Service 3.       Starting NetStat Service 4.       Starting Connectivity Service 5.       Starting Notification Manager 6.       Starting DeviceStorageMonitor Service 7.       Starting Location Manager 8.       Starting Search Service 9.       Starting Clipboard Service

43、 10.   Starting Checkin Service 11.   Starting Wallpaper Service 12.   Starting Audio Service 13.   Starting HeadsetObserver 14.   Starting AdbSettingsObserver Finally SystemServer::init2 will call ActivityManagerService.systemReady to launch the first activity by senting Intent.CATEGORY_H

44、OME intent.   There is another way to start system server,which is through a program named system_server whose source is device/servers/system/system_main.cpp. It also calls system_init to start system services. So there is a question:why does Android have two methods to start system services?My

45、 guess is that directly start system_server may have synchronous problem with zygote because system_server will call JNI to start SystemServer::init2,while at that time zygote may not start JAVA VM yet. So Android uses another method. After zynote is initialized,fork a new process to start system se

46、rvices. Android 启动过程   1. Boot系统初始化, 详细过程参见(system\core\init\Init.c)中main函数,这时候,手机或者模仿器浮现画面是一种console,显示“ANDROID”msg。   2. 初始化成功后,就开始mounting系统,详细参见(system\core\mountd\Mountd.c)  中main函数。   3.接下来运营ndroidRuntime,并开始启动java虚拟机dalvikvm。  

47、 4. Java虚拟机启动成功后,开始系统初始化。系统初始第一步是用JNI方式实现,相应java代码为(frameworks\base\services\java\com\android\server\SystemServer.java) init1(Native)函数,相应JNI C++代码为(frameworks\base\core\jni\server\com_android_server_SystemServer.cpp),而实现C++代码为 (frameworks\base\cmds\system_server\library\ System_init.cpp)   中syst

48、em_init()函数。   5. system_init调用SurfaceFlinger,SurfaceFlingerreadyToRun()函数用BootAnimation来实现开机动画,这时候手机或者模仿器显示是一副背景图加一种动态小机器人。   6. 系统初始化第二步,将启动ServerThread进程,参见SystemServer.init2()。ServerThread将启动各种系统服务,如Power Manager、Activity Manager等等,详细参见ServerThreadrun函数,ServerThread同在SystemServer.java中。

49、   7.这之后事,应当就是进入系统了。(这某些没有调查过)。 对Android启动过程进一步研究 对于关注Android底层朋友来说,其详细启动过程应当是比较吸引咱们。但是诸多启动文献什么,都得adb push到host上来看,挺不以便,都怪Android自带Toolbox太简略了。因此在进一步理解Android启动流程之前,咱们来把Busybox安装到Android上去,这样,就有诸多工具供咱们使用了。   一方面去busybox主页 下载最新版本源代码,然后用arm交叉编译器编译出busybox可执行程序,编译时候需要注意某些设立选项,例如   Build O

50、ptions —>   Build BusyBox as a static binary (no shared libs) 这个要选上,因上这样子编译出来busyBox才是可以独立运营。   │Do you want to build BusyBox with a Cross Compiler?│ │   │ │(/HOME/toolchains/gcc-4.0.2-glibc-2.3.5/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu│ 这是交叉编译器途径,要依照详细状况来设立。   Installation Options —>   Don

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服