Android系统源代码编译—[4]运行构建

本文提供了在特定设备上运行构建的详细内容,同时也被设计扩充准备构建的信息。

构建fastboot和adb

如果你还没有fastboot和adb,你可以使用正规的构建系统构建他们。使用准备构建中的说明并使用下面命令来替换make命令:

$ make fastboot adb

引导到fastboot模式

在冷启动设备期间,使用下面的组合键引导进入fastboot模式,这个模式是一个用来flash设备的引导装载程序模式。

DeviceKeys
hikeyLink pins 1 - 2 and 5 - 6 of J15
anglerPress and hold Volume Down, then press and hold Power
bullheadPress and hold Volume Down, then press and hold Power
shamuPress and hold Volume Down, then press and hold Power
fuguPress and hold Power
volantisPress and hold Volume Down, then press and hold Power
hammerheadPress and hold both Volume Up and Volume Down, then press and hold Power
floPress and hold Volume Down, then press and hold Power
debPress and hold Volume Down, then press and hold Power
mantaPress and hold both Volume Up and Volume Down, then press and hold Power
makoPress and hold Volume Down, then press and hold Power
grouperPress and hold Volume Down, then press and hold Power
tilapiaPress and hold Volume Down, then press and hold Power
phantasmPower the device, cover it with one hand after the LEDs light up and until they turn red
maguroPress and hold both Volume Up and Volume Down, then press and hold Power
toroPress and hold both Volume Up and Volume Down, then press and hold Power
toroplusPress and hold both Volume Up and Volume Down, then press and hold Power
pandaPress and hold Input, then press Power
wingrayPress and hold Volume Down, then press and hold Power
crespoPress and hold Volume Up, then press and hold Power
crespo4gPress and hold Volume Up, then press and hold Power

不用组合键你也可以使用命令adb reboot bootloader 来重启直接进入引导装载程序。

解锁bootloader

只有手机的bootloader允许才能flash一个定制的系统,而且bootloader默认是锁定的。你可以解锁bootloader,但是需要意识到这样做会删除用户的隐私数据(解锁操作只需要运行一次)。解锁后,设备上的所有数据都会被擦除,i.e.应用的私有数据以及通过USB共享的数据,包括图片和电影。在解锁bootloader前请确保已备份了珍贵的文件。

当设备在fastboot模式下,使用下面命令来解锁bootloader:

$ fastboot oem unlock

在Nexus 10设备上,解锁bootloader后,内部存储是无格式的。你可以使用下面命令格式化设备:

$ fastboot format cache
$ fastboot format userdata

重新锁定bootloader,使用:

$ fastboot oem lock

Note: 在Motoroal Xoom设备上重新锁定bootloader或擦除用户数据(包括USB共享的数据)。

选择一个设备进行构建

当运行无参数的lunch命令时,建议通过lunch菜单中选择可用的build。你可以从developers.google.com为Nexus设备下载factory inages 和 二进制文件:

参见获取专有二进制文件了解更详细的信息以及通过设备二进制文件要求了解其他资源。

DeviceCode nameBuild configuration
HiKeyhikeyhikey-userdebug
Nexus 6Pangleraosp_angler-userdebug
Nexus 5Xbullheadaosp_bullhead-userdebug
Nexus 6shamuaosp_shamu-userdebug
Nexus Playerfuguaosp_fugu-userdebug
Nexus 9volantis (flounder)aosp_flounder-userdebug
Nexus 5 (GSM/LTE)hammerheadaosp_hammerhead-userdebug
Nexus 7 (Wi-Fi)razor (flo)aosp_flo-userdebug
Nexus 7 (Mobile)razorg (deb)aosp_deb-userdebug
Nexus 10mantaray (manta)full_manta-userdebug
Nexus 4occam (mako)full_mako-userdebug
Nexus 7 (Wi-Fi)nakasi (grouper)full_grouper-userdebug
Nexus 7 (Mobile)nakasig (tilapia)full_tilapia-userdebug
Galaxy Nexus (GSM/HSPA+)yakju (maguro)full_maguro-userdebug
Galaxy Nexus (Verizon)mysid (toro)aosp_toro-userdebug
Galaxy Nexus (Experimental)mysidspr (toroplus)aosp_toroplus-userdebug
PandaBoard (Archived)pandaaosp_panda-userdebug
Motorola Xoom (U.S. Wi-Fi)wingrayfull_wingray-userdebug
Nexus Ssoju (crespo)full_crespo-userdebug
Nexus S 4Gsojus (crespo4g)full_crespo4g-userdebug\

Flash到一个设备

你可以使用单一的命令来flash一个完整的Android系统到设备;这样做可以确定flash的系统和已经初始化的bootlodaer以及radio是兼容的,然后写入boot,还原,系统分区,然后重启系统。Flashing同样也会擦除所有用户数据,类似于fastboot oem unlock.

然设备进入fastboot模式既可以手动通过在boot过程中按组合键也可以通过下面的shell命令:

$ adb reboot bootloader

一旦设备处于fastboot模式,运行:

$ fastboot flashall -w

-w选项擦除了设备上的/data分区;当你第一次flash特定设备的时候是有用的但不是必须的。

Note: 通过在Motorola Xoom设备上 fastboot来创建的文件系统没有进行函数优化。我们建议通过recovery来re-creating 文件系统,使用$ adb reboot recovery.当在recovery这段时间里,打开菜单(按住 Power + Volume Up),清楚缓存分区,然后清楚数据。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值