Android内核剖析
第 1 章 Linux基础.......................................................................................................................................2
1.1 Linux文件系统概述.................................................................................................................; ....... 2
1.2 Linux 启动过程 ............. . ........................................................................ .. ................................4
1.3 常用Linux命令.......................................................................................................................6
1.4 Shell脚本备忘.......................................................................... . .............................................. 9
1 .4 .1 获 取输入.........................................................................................................................................................10
1 .4 .2 变 量 定 义.........................................................................................................................................................10
1 .4 .3 条 件判断......................................................................................................................................................... 11
1.4.4 while []...do... done 语 句 ......................................... . .....................................................................................12
1.4.5 for 循环..........................................................................................................................................................13
1.4.6 酿 ...............................................................................................................................................................14
1 .4 .7 常用内置符号常量......................................................................................................................................... 15
1.5 Make脚本备忘................................................................................................. . ...................15
1.5.1 一个简单的Makefile文 件 ........................................................................................................................... 16
1 .5 .2 变量的定义与赋值 ........... ..............................................................................................................................18
1 .5 .3 条件控制语句.................................................................................................................................................18
1 .5 .4 宏 (函数) 定 义 .............................................................................................................................................19
1.5.5 内置符号和变量....................................................................................................... . ................................... 22
1.5.6 模 板 目 标 (Pattern target) ...................................... ....................................................................................23
1.5.7 目标特定的变量赋值(Target- specific variable) ........................................................................................24
1 .5 .8 常用选项........................................................................................................................................................25
第 2 章 Java基础...................................................................................................................................... 26
2.1 类装载器 DexClassLoader........................................................................................................26
2.1.1 DexClassLoader 的调用方法 ........................................................................................................ .................. 27
2 .1 .2 基于类装载器设计一种“ 插件” 架 构 ……… . ................................................................................................29
2.2 JNI 调用机制 ........ . ..................................................................... ..........................................32
2.2.1 Java i方问 C .................................................................................................................................................... 33
2.2.2 C i方 |句 Java.................................................................................................................................................... 35
2 .2 .3 在 C 中使用持久对象................................................................................................................................... 37
2 .3 异步消息处理线程................................................................................................................ 37
2 .3 .1 实现异步线程的一般思路.............................................................................................................................38
2.3.2 Android中异步线程的实现方法...................................................................................................................38
第 3 章 Android源码下载及开发环境配置.............................................................................................44
3.1 Mac系统的配置.....................................................................................................................44
3.1.1 硬盘格式的配置............................................................................................................................................44
3.1.2 port 的用法
.
....................................... ............................................................................................................. 46
3 .2 在 Linux中配置USB连接.................................................................................................... 46
3.3 在 Eclipse 中调试 Framework..................................................................................................46
3.3.1 —段防止下载异常的脚本............................................................................................................................ 47
3.3.2 调 试 Framework中的代码............................................................................................................................ 47
第 4 章 使 用 git......................................................................................................... ................................51
4.1 魏 git............................................................................................................................. . 52
4.2 git仓库管理............................................................................................................................ 52
4.2.1 仓库的组成....................................................................................................................................................52
4 .2 .2 创建仓库........................................................................................................................................................54
4 .2 .3 分支管理
.
........................................................................................................................................................55
4.3 git merge 用法........................................................................................................................ 57
4.4 git rebase 用法 ......................................... .............................................................................. 58
4.5 git cherry-pick 用法.................................................................................................................61
4.6 git reset 用法..........................................................................................................................62
4 .7 恢复到无引用提交................................................................................................................ 63
4.8 git remote 用法........................................................................................................................65
4.9 git 配置............................................................................ . .....................................................67
4 .9 .1 基本信息配置................................................................................................................................................ 68
4.9.2 merge、 diff 工具配置................................................................................................................................... 68
4.9.3 .gitignore 配置................................................................................................................................................70
4.10 同时使用git和 svn..........................................................................................................71
4.11 其他g it常用命令示例......................................... . ........................................ . ....................72
• VIII •
第 7 章 理 解 Context.................................................................................................................................98
7.1 Context 是什么........................................................................................................................ 98
7.2 一个应用程序中包含多少个Context对象............................................................................... 99
7.3 Context相关类的继承关系......................................................................................................99
7.4 创建 Context.......................................................................................................................... 100
7.4.1 Application 对应的 Context.......................................................................................................................... 101
7.4.2 Activity 对应的 Context................................................................................................................................102
7.4.3 Service 对应的 Context................................................................................................................................. 103
7.4.4 Context 之间的关系......................................................................................................................................104
第 8 章 创 建 窗 口 的 过 程 ......................................................................................................................... 106
8 .1 窗口的类型..........................................................................................................................106
8.2 token变量的含义..................................................................................................................108
8.2.1 Activity 中的 mToken....................................................................................................................................108
8.2.2 Window 中的 mAppToken............................................................................................................................109
8.2.3 WindowManager.LayoutParams 中的 token................................................................................................. 109
8.2.4 View 中的 token.............................................................................................................................................110
8 .3 创建应用窗口.......................................................................................................................111
8 .4 创建子窗口 ......... .. ................................................................................................................121
8.4.1 Dialog 的创建...............................................................................................................................................122
8.4.2 Popup Window 的仓键...................................................................................................................................126
8.4.3 ContextMenu 的仓键.....................................................................................................................................127
8.4.4 OptionMenu 的创建.......................................................................................................................................132
8.5 系统窗口 Toast的创建..........................................................................................................136
8.5.1 Toast 调用流程..............................................................................................................................................137
8.5.2 Toast 添加窗 P ..............................................................................................................................................139
8.6 创建窗口示例........................................................................................................................139
第 9 章 Framework的启动过程.............................................................................................................142
9.1 Framework 运行环境综述.......................... • • • ............ . .........................................................142
9.2 Dalvik虚拟机相关的可执行程序........................................................................................... 143
9.2.1 dalvikvm........................................................................................................................................................144
9.2.2 dvz.................................................................................................................................................................144
9.2.3 app_process....................................................................................................................................................145
9.3 zygote 的启动...................................................................................................... . .................147
9.3.1 在 init.rc中配置zygote启动参数................................................................................................................ 147
•X-
4.11.1 git branch...................................................................................................................................................... 72
4.11.2 git checkout....................................................................................................................................................72
4.11.3 git log.............................................................................................................................................................73
4.11.4 git commit - amend........................................................................................................................................73
4.11.5 git cherry- pick sha- 1......................................................................................................................................73
4.11.6 git merge- base................................................................................................................................................74
4.11.7 git diff master.. .dev.......................................................................................................................................74
4.11.8 git revert.........................................................................................................................................................75
4.11.9 git diff......................................................................................................... . .................................................. 75
4.11.10 git rm...........................................................................................................................................................75
4.11.11 git tag .............................. . ...........................................................................................................................76
第 2 部 分 内 核 篇
第 5 章 Binder................................................................................................................ ......................... 78
5.1 Binder 框架.............................................................................................................................78
5.2 设计 Sender 端 ....................................................................................................................... 80
5.3 Binder客户端设计..................................................................................................................81
5.4 使用 Service 类 ....................................................................................................................... 82
5.4.1 获取 Binder 对象...................... . .....................................................................................................................82
5 .4 .2 保证包裹内参数顺序a idl工具的使用.........................................................................................................83
5.5 系统服务中的Binder对象...................................................................................................... 88
5.5.1 ServiceManager 管理的月艮务......................................................................................................................... 88
5.5.2 理角军 Manager.................................................................................................................................................90
第 6 章 Framework 概述..........................................................................................................................92
6.1 Framework 框架..................................................................................................................... 92
6.1.1 服 务 端 ............................................................................................................................................................92
6.1.2 客 户 端 ......................................................... . ................................................................................................. 93
6.1.3 Linux 驱动......................................................................................................................................................94
6.2 APK程序的运行过程.............................................................................................................94
6.3 客户端中的线程..................................................................................................................... 94
6 .4 几个常见问题........................................................................................................................ 95
6.4.1 Acitivity之间如何传递消息(数据) ........................................................................................................ 95
6 .4 .2 窗口相关的概念............................................................................................................................................96
•IX*
9.3.2 启 动 Socket月艮务端口...................................................................................................................................148
9.3.3 力口载 preload- classes.......................................................................................................................... ............ 151
9.3.4 力口载 preload- resources..................................................................................................................................152
9 .3 .5 使 用 folk启动新的进程...............................................................................................................................152
9.4 SystemServer 进程的启动.....................................................................................................155
9 .4 .1 启动各种系统服务线程...............................................................................................................................156
9.4.2 启动第一个 Activity.....................................................................................................................................158
第 10章 Am S内部原理......................................................................................................................... 160
10.1 Activity 调度机制................................................................................................................ 160
10.1.1 几个重要概念 ................................................... ................................... . .................................................... 161
10.1.2 Am S 中的一些重要调度相关变量............................................................................................................163
10.1.3 startActivity()的流程.............................................................................. . .................. ................................ 165
10.1.4 stopActivityLocked()停止 Activity.............................................................................................................183
1 0 .1 .5 按 “ Home” 键回到桌面的过程 ................................. . ............................................................................. 186
10.1.6 按 “ Back” 键回到上一个 Activity.................................................................................... .......................187
10.1.7 长按 “ Home” 键 ................................................................ .......................................................................189
10.1.8 Activity生命期的代码含义...................................................................................................................... 190
1 0 .2 内存管理 .......... . .................................................................................................................192
10.2.1 关闭而不退出............................................................................................................................................ 192
10.2.2 Android 与 Linux 的配合........................................................................................................................... 194
10.2.3 各种关闭程序的过程................................................................................................................................ 196
1 0 .2 .4 释放内存详解.............................................................................................................................................197
1 0 .3 对 Am S中数据对象的理解..............................................................................................••••••• ...... 211
10.3.1 常见的对象操作........................................................................................................................ . .............. 212
10.3.2 理解 Activity..............................................................................................................................................213
10.3.3 Android多进程吗,是同时在运行多个应用程序吗…............................................................................ 213
10.4 ActivityGroup 的内部机制..................................................................................................214
10.4.1 TabActivity使用时的类关系结构............................................................................................................ 215
10.4.2 LocalActivityManager 的内部机制........................................................................................................... 217
10.4.3 ActivityGroup 内部的 Activity 生命期控制 .................................................. ...........................................220
第 11章从输入设备中获取消息.................................. . ..........................................................................221
11.1 Android消息获取过程概述................................................................................................221
1 1 .2 与消息处理相关的源码文件分布........................................................................................223
11.3 创建 InputDispatcher 线程..................................................................................................226
•XI-
1 1 .4 把窗口信息传递给InputDispatcher线程.............................................................................227
11.5 仓键 InputChannel............................................................................................................... 229
11.6 在 WmS 中注册 InputChannel..............................................................................................232
1 1 .7 在客户进程中注册InputChannel.........................................................................................233
11.8 WmS中处理消息的时机.................................................................................................... 234
1 1 .9 客户窗口获取消息的时机..................................................................................................235
第 12章 屏 幕 绘 图 基 础 ...........................................................................................................................237
12.1 绘制屏幕的软件架构..........................................................................................................237
12.2 Java客户端绘制调用过程.................................................................................................. 239
12.3 C 客户端绘制过程...............................................................................................................241
12.4 Java客户端绘制相关类的关系........................................................................................... 244
第 13章 View工作原理.........................................................................................................................247
13.1 导论................................................................................................................................... 247
1 3 .2 用户消息类型....................................................................................................................249
1 3 .2 .1 按键消息....................................................................................................................................................249
1 3 .2 .2 触摸消息....................................................................................................................................................250
1 3 .3 按键消息派发过程.............................................................................................................252
13.3.1 KeyEvent. Dispatcher State 中的长按监测................................................................................................. 252
1 3 .3 .2 按键消息总体派发过程 ............................................... . ............................................................................254
1 3 .3 .3 根视图内部派发过程................................................................................................................................ 256
13.3.4 Activity 内部派发过程................................................................................................... ..........................257
13.3.5 View 类内部的 onKeyDown()和 onKeyUp()............................................................................................260
13.3.6 Activity 中的 onKeyDown()和 onKeyUp()................................................................................................261
13.3.7 Phone Window内部消息派发过程........................................... . ............................................................... 262
1 3 .4 按键消息在WmS中的派发过程........................................................................................263
1 3 .5 触摸消息派发过程.............................................................................................................266
1 3 .5 .1 触摸消息总体派发过程............................................................................................................................ 266
1 3 .5 .2 根视图内部消息派发过程.........................................................................................................................267
13.5.3 ViewGroup内部消息派发过程.................................................................................;.............................268
1 3 .5 .4 各种消息监测的基本实现方法.................................................................................................................271
13.5.5 Vie w 内默认消息派发过程.......................................................................................................................272
1 3 .6 导致View树重新遍历的时机............................................................................................ 274
13.6.1 状态的分类................................................................................................................................................274
1 3 .6 .2 导 致 View树重新遍历的总体诱因图.......................................................................................................275
•XII.
13.6.3 refreshDrawableList()................................................................................................................................276
13.6.4 onF ocusedChanged()................................................................................................................................. 278
13.6.5 ensureTouchMode()................................................................................................................................... 279
13.6.6 setVisibility().............................................................................................................................................282
13.6.7 setEnable().................................................................................................................................................284
13.6.8 setSelected()...............................................................................................................................................285
13.6.9 invalidate().................................................................................................................................................286
13.6.10 requestFocus().......................................................................................................................................... 290
13.6.11 requestLayout().........................................................................................................................................292
13.7 遍历 View 树 performTraversals()的执行过程 ........................................................................ 293
13.8 计算视图大小(measure) 的过程.................................................................................296
13.8.1 measure 内部设计思路 ....................... ..................................................................................................... 297
13.8.2 ViewGroup 中的 measureChildWithMargins()..........................................................................................301
13.8.3 LinearLayout 中的 onMeasure()过程举例................................................................................................304
13.9 布 局 (layout) 过程 ........................................................................................... 308
13.9.1 layout过程的设计思路............................................................................................................................ 308
13.9.2 LinearLayout 中 onLayout()内部过程...................................................................................................... 309
13.9.3 TextView 中 gravity 与 layout 的关系 ................ ........................................................................................311
13.10 绘 制 (draw) 过程........................................................................................................... 313
13.10.1 视图中可绘制的元素 ............................................. . ................................................................................313
13.10.2绘制过程的设计思路..............................................................................................................................314
13.10.3 ViewRoot 中 draw()的内部流程.............................................................................................................. 315
13.10.4 View类 中 draw()函数内部流程.................................................................................................... .. 318
13.10.5 ViewGroup类中绘制子视图dispatchDraw()内部流程...................................................................…… 322
13.10.6 ViewGroup 类中 drawChild()过 程 ....................................... ...................................................................325
13.10.7 绘制滚动条..................................................................... ...................... . ................................................. 328
13.11 动画的绘制...................................................................................................................... 331
13.11.1 动画的设计思路.......................................................................................................................................332
13.11.2 ViewGroup类 中 drawChild()函数中视图动画绘制过程.......................................................................334
13.11.3 ViewGroup 中 dipsatchDraw()中布局动画绘制流程..............................................................................337
第 14章 WmS工作原理 ........... ....................................................................................... 340
14.1 職 … ........................ . . .... ...................................................................... 340
14.1.1 窗口的定义............................................................................................................................................... 340
1 4 .1 .2 窗口管理要解决的核心问题.................................................................................................................... 341
1 4 .1 .3 解决核心问题所使用的相关的变量列表.................................................................................................343
• XIII •
1 4 .1 .4 几个操作的概念.........................................................................................................................................346
1 4 .1 .5 什 么 是 Policy,以及其与W m S 的关系................................................................ ................................... 346
14.1.6 WmS 接 口结构..........................................................................................................................................347
14.2 WmS主要内部类................................................................................................................348
14.2.1 表示窗口的数据类....................................................................................................................................348
14.2.2 DimAnimator..............................................................................................................................................348
14.2.3 F adelnOutAnimation..................................................................................................................................349
14.2.4 InputMonitor 类 .........................................................................................................................................350
14.2.5 PolicyThread.............................................................................................................................................. 351
14.2.6 Session........................................................................................................................................................352
14.2.7 Watermark..................................................................................................................................................353
14.2.8 WMThread ................ . ............................................................................................................................... 354
14.3 窗口的创建和删除..............................................................................................................355
14.3.1 创建窗口的时机和过程............................................................................................................................ 355
14.3.2 assignLayersLocked()的执行过程............................................................................................................ 360
14.3.3 addWindowToListInOrderLocked()的执行过程.........................................................................................3 62
1 4 .3 .4 删除窗口的时机.........................................................................................................................................364
1 4 .3 .5 删除窗口的过程.........................................................................................................................................366
14.3.6 remove WindowInnerLocked()................................................................................................................... 367
1 4 .4 计算窗口的大小.................................................................................................................371
14.4.1 描述窗口尺寸的变量.................................................................................... ............................................ 371
14.4.2 窗口大小的变化过程................................................................................................................................ 372
14.4.3 Policy 中 layoutWindowLw()的执行过程.................................................................................................375
1 4 .4 .4 输入法窗口如何影响应用窗口的大小 ............ . ........................................................................................ 378
14.5 切换窗口........................................................................................................................... .379
14.5.1 切换要解决的问题....................................................................................................................................379
14.5.2 InputManager 和 WmS 的接口..................................................................................................................381
14.5.3 AmS 与 WmS 的接 P ................................................................................................................................383
1 4 .5 .4 从 A 到 B 的切换.......................................................................................................................................387
1 4 .5 .5 从 B 回到A 的过程...................................................................................................................................390
14.5.6 A 中 长 按 “ Home” 键切换到B................................................................................................................391
14.5.7 setAppVisiblity()与销毁 Surface................................................................................................................393
14.5.8 computeF ocusedWindowLocked()..............................................................................................................396
14.6 perforLayoutAndPlaceSurfacesLockedInner()的执行过程...................................................... 398
14.6.1 总体过程....................................................................................................................................................399
XIV •
16.3.4 mSettings.readLP().................................................................................................................................... 452
16.3.5 scanPackageLI()内部过程 ...................................... . . .... ............................................................................454
16.3.6 mSettings.writeLP().................................................................................................................................. 455
1 6 .4 应用程序的安装和卸载 ................... .. ...................................................... . ................. .. 455
1 6 .4 .1 各主要功能类关系.................................................................................................................................... 456
1 6 .4 .2 应用程序安装过程.................................................................................................................................... 457
1 6 .4 .3 应用程序的卸载过程.................................................................................................................................461
16.5 intent 匹配框架...................................................................................................................463
16.5.1 主要功能类的关系.................................................................................................................................... 463
16.5.2 主体调用过程........................................................................................................................................... 465
第 17章 输 入 法 框 架 ............... . ................................................................................................ ............. 467
17.1 输入法框架组成概述..........................................................................................................468
1 7 .2 输入法中各Binder对象的创建过程...................................................................................469
17.2.1 InputConnection........................................................................................................................................ 469
17.2.2 IlnputMethodClient....................................................................................................................................471
17.2.3 InputMethodSession.................................................................................................................................. 472
17.2.4 InputMethod....................................................................................................................... ....................... 475
1 7 .3 输入法主要操作过程.........................................................................................................477
1 7 .3 .1 输入法相关模块的启动过程.................................................................................................................... 477
1 7 .3 .2 切换输入法................................................................................................................................................478
1 7 .3 .3 启动输入法................................................................................................................................................480
1 7 .3 .4 显示输入法................................................................................................................................................485
1 7 .3 .5 输入法操作过程中的重要变量总结.........................................................................................................489
1 7 .4 输入法窗口内部的显示过程 . ............................................................................................. 490
17.4.1 IM S 中 的 showWindow()的内部执行过程.............................................................................................. 491
17.4.2 标准布局的IMS....................................................................................................................................... 496
17.4.3 自定义布局的IMS.................................................................................................................................... 502
1 7 .5 向编辑框传递字符........................................................ ......................................... . ......... 503
1 7 .6 输入法相关源码清单.........................................................................................................504
第 4 部 分 编 译 篇
第 18章 Android编译系统.................................................................................................................... 508
18.1 Android源码文件结构 ........................................................ ...............................................509
•XVI.
1 4 .6 .2 第一大步骤:计算窗口的大小.................................................................................................................401
1 4 .6 .3 第二大步骤:计算窗口的可视状态 ............. ............................................................................................401
1 4 .6 .4 第三大步骤:通 知 SurfaceFlinger进行窗口重绘....................................................................................404
14.7 窗 口动画......................................................... . ................................................................. 406
14.8 屏幕旋转及Configuration的变化过程............................................................................... 409
第 3 部 分 系 统 篇
第 15章资源 访 问 机 制 ..........................................................................................................................414
15.1 定义资源........................................................................................................................... 414
1 5 .2 存储资源............................................................................................................................415
15.3 styleable、style、attr、 theme 的意义................................................................................. 417
15.4 AttributeSet 与 Typed Array 类............................................................................................420
15.5 获取 Resources 的过程............................................................... . .......................................425
15.5.1 通过 Context 获取.....................................................................................................................................425
15.5.2 通过 PackageManager 获取...................................................................................................................... 429
15.6 Framework 资源................................................................................................................431
1 5 .6 .1 加载和读取................................................................................................................................................432
15.6.2 、 添力口.......................................................................................................................................................... 434
1 5 .6 .3 实现真正主题切换的两种思路................................................................................................................ 436
第 16 章 程 序 包 管 理 (Package Manager Service) ..........................................................................439
16.1 包管理概述....................................................................................................................... 439
16.2 packages.xml 文件格式......................................................................................................442
16.2.1 last- platform- version 标签......................................................................................................................... 443
16.2.2 permissions 标 签 .......................................................................................................................................443
16.2.3 cert 标 签 ................................. ..................................................................................................................444
16.2.4 sigs 标 签 .................................................................................................................................... ............... 444
16.2.5 perms 标签................................................................................................................................................ 444
16.2.6 package 标 签 ............................................................................................................................................ 444
16.2.7 shared- user 标 签 ........................................................................................................................................445
1 6 .3 包管理服务的启动过程 ........ . .................................. ......................................................... 446
1 6 .3 .1 各主要功能类的关系................................................................................................................................446
16.3.2 P mS主体启动过程...................................................................................................................................448
16.3.3 readPermission()内部过程 .................. . .....................................................................................................450
•XV*
18.2 从调用make命令开始说起...............................................................................................509
18.2.1 编译命令................................................................................................................................................... 510
1 8 .2 .2 编译结构猜想.................................................................... ........................................................................ 510
18.3 编译所需脚本文件之间的协同关系...................................................................................512
18.3.1 编译系统内部功能検块图........................................................................................................................ 512
1 8 .3 .2 脚本文件的包含关系................................................................................................................................ 514
1 8 .3 .3 从子项目中提取编译目标.........................................................................................................................518
18.3.4 生成编译规则............................................................................................................................................519
1 8 .3 .5 设置编译输出目录................................................ . ................................................................................... 521
1 8 .3 .6 生成最终的Image文 件 ....................................................... . .................................................................... 522
18.4 如何增加一个 product........................................................................................................523
18.4.1 什么是一个 product...................................................................................................................................523
18.4.2 如何增加一个 product...............................................................................................................................527
1 8 .5 如何增加一个项目........................................................................................................... 528
1 8 .5 .1 项目类别和项目路径................................................................................................................................ 529
18.5.2 添加一个C 项目....................................................................................................................................... 530
1 8 .5 .3 添加一个AP K项 目 ...................................................................................................................................531
18.6 APK编译过程 ......... ......................................................................................................... 533
1 8 .6 .1 总体编译过程概述.....................................................................................................................................533
18.6.2 生成 R.java.................................................................................................................................................535
18.6.3 编译 aidl 文 件 ............................................................................................................................................536
1 8 .6 .4 包 含 Java静态 库 ....................................................................................................................................... 536
18.6.5 编 译 Java源文件生成Jar包..................................................................................................................... 538
1 8 .6 .6 将 Jar包转换为dex文件 ............................ ..............................................................................................539
18 .6 .7 编译资源文件生成AP K包 .......................................................................................................................540
1 8 .6 .8 将 dex文件添加到AP K包中 ............................... *.................................................................................541
1 8 .6 .9 添 加 JN I所需的动态库文件......................................................................................................................541
18 .6.10对 AP K文件进行签名.............................................................................................................................543
18.6.11 使 用 zipalign优 化 A P K 内部存储............................................................................................................ 543
18.7 Framework 的编译 ............................................................................. . .............................. 544
1 8 .7 .1 总体编译过程 ...................................... . ....................... . ............................................................................544
18.7.2 framework/core/ext 三个 Jar 文件的区另(J..................................................................................................546
18.8 编译 android.jar.................................................................................................................547
1 8 .8 .1 资源文件 ............................... . ........................................................ .. .. . .................. . ........................... .. 547
18.8.2 aidl 文 件 ….................................. . ........................................................................ .................... . ................ 551
•XVII-
18.8.3 Java 文件 ................................ ....................................................................................................................551
18.9 编译adt插件.....................................................................................................................553
18.10 总结.................................................................................................................................554
第 19章 编 译 自 己 的 Rom......................................................................................................................555
1 9 .1 嵌入式系统的内存地址空间...............................................................................................555
1 9 .2 各种映像(Image) 文件的作用.........................................................................................559
19.3 编译 NexusS (NS) 的 Image 文件........................ .. ...................…….................. ............. 562
19.3.1 编译 Linux Kernel...................................................................................................................................... 562
1 9 .3 .2 提 取 N S 的私有驱动文件”........................................................................................................................ 563
19.3.3 编译 system.img 文件............................................ . .................................................................................. 564
19.3.4 创建 ramdisk.img.......................................................... . ...........................................................................565
19.3.5 创建 boot.img 文件 ................................................................. . ................................................ . ............... 566
19.4 使用 fastboot 写入 Image 文件 .......................................... ................................................. 566
19.5 最后验证........................................................................................................................... 567
1 9 .5 .1 解决触摸按键问题.....................................................................................................................................568
1 9 .5 .2 解决音量和电源键.....................................................................................................................................568
19.5.3 WIFI 问 题.................................................................................................................................................. 570
19.5.4 安装 Google Mobile Service (GMS) .......................................................................................................571
第 5 部分硬件驱动篇
第 20章 基 于 Tl OMAP处理器的Techshine开发板介绍.................................................................573
20.1 Techv- 35XX 开发板概述................................................................................................... 574
20.2 交叉编译环境配置.............................................................................................................575
20.3 x-loader 编译......................................................................................................................578
20.4 u-boot 编译........................................................................................................................ 578
20.5 Techv- 35XX Linux驱动和内核配置及编译........................................................................ 579
20.5.1 Touchscreen 驱动配置................................................................................................................................579
20.5.2 KeyBoard 驱动配置 ................................................. . ................................................................................ 580
20.5.3 Audio 驱动配置..........................................................................................................................................581
20.5.4 4MMC/SD 驱动配置..................................................................................................................................582
20.5.5 NandFlash 驱动配置.................................................................................................................................. 582
20.5.6 LCD 驱动配置........................................................................................................................................... 583
2 0 .5 .7 内核编译 ... ...... .. ....................................................................................................................................... 583
• XVIII •
20.6 Techv- 35XX Android 驱动编写.........................................................................................584
20.7 Techv- 35XX Android 开发环境建立 ................................................................................. 589
20.8 编译 Android Donut.......................................................................................................... 590
20.9 Android根文件系统的制作.............................................................................................. 591
2 0 .1 0 相关Image文件的烧写 ..................... ............................................................................ 591
20.11 Android根文件系统安装................................................................................................593
评论