之前一直没有时间折腾这个,最近由于要调试smali,需要源码调试,所以就。。。。
操作步骤如下:
Step1: repo 下载源码(http://source.android.com/source/downloading.html)
Step2: 下载相应的驱动(https://developers.google.com/android/nexus/drivers)
如我的需要下载6个zip包,然后解压后是相应的6个sh文件,复制到下载的源码根目录,并运行这些shell文件,会在生成一个vendor 驱动文件夹。
Step3: 初始化环境
$ source build/envsetup.sh
或
$ . build/envsetup.sh
Step4: 选择target
运行
lunch
PS:至于你怎么选其实可以参照(http://source.android.com/source/building-devices.html)
Nexus S 选择的是crespo。
Step5: 刷机 参照(http://source.android.com/source/building-devices.html)
主要是说下, google给的刷机的简单命令就是
fastboot -w flashall
在控制台下面直接运行fastboot, 可以看到相应的fastboot的参数命令如下:
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
format <partition> format a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
options:
-w erase userdata and cache (and format
if supported by partition type)
-u do not first erase partition before
formatting
-s <specific device> specify device serial number
or path to device port
-l with "devices", lists device paths
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address. default: 0x10000000
-n <page size> specify the nand page size. default: 2048
-S <size>[K|M|G] automatically sparse files greater than
size. 0 to disable
也就是说flashall 参数,把手机的boot, recovery, system 一起给刷进系统中,而-w参数 清除了手机userdata和cache的数据,明白了这个后,我顿时就犯贱了下, 写了下面的脚本,一个个慢慢刷进去系统中。
如下:
#!/bin/sh
fastboot devices
fastboot flash userdata userdata.img
fastboot reboot-bootloader
sleep 5
fastboot flash boot boot.img
fastboot reboot-bootloader
sleep 5
fastboot erase recovery
fastboot flash recovery recovery.img
fastboot reboot-bootloader
sleep 5
fastboot flash system system.img
参考:
http://source.android.com/source/building-devices.html
http://blog.csdn.net/june5253/article/details/8560557