返回列表 发帖

Google手机另类刷机方法之Fastboot.

我们刷机通常都是按Alt+S的方法进行刷机,是否尝试其它方式呢,这里介绍一种利用DOS命令的方式刷机,其实这种方法可以帮助解决一些比较特殊的情况,如只能进fastboot模式情况下刷机.



Android是一个基于linux内核的嵌入式OS,以T-mobile G1为例,下面对用Nandroid备份工具生成的备份文件及其所对应的G1中的分区进行简单说明

splash1:是G1的开机画面(默认为白色"T-mobile G1"),Nandroid备份为splash1.img

recovery:设备序列号为mtd1,该分区是G1的恢复模式(即开机按Home+End进入的界面),Nandroid备份为recovery.img

boot:设备序列号为mtd2,G1的底层操作系统内核启动分区,挂载为/boot目录,Nandroid备份为boot.img

system:设备序列号为mtd3,G1的Android核心平台,挂载为/system目录,通常为只读,Nandroid备份为system.img

cache:设备序列号为mtd4,G1的缓存临时文件夹,挂载为/cache目录,事实上除了T-mobile的OTA更新外,别无用处,Nandroid备份为cache.img

userdata:设备序列号为mtd5,G1中用户安装的软件以及各种数据,挂载为/data目录,Nandroid备份为data.img

因此对于刷机一般可以这么理解:
1. 修改开机画面, 修改的是splash1
2. 破root时降级到RC29刷的是所有分区
3. 刷testkeys,更新的应该是recovery
4. 使用update.zip刷JF自制ROM版本应该更新的是boot、system和recovery
5. 恢复出厂设置, 清空的是userdata和cache

Nandroid是一个Android的系统级的备份工具,使用它之前必须刷有HardSPL或者开发版的Engineering SPL,参考:SPLs for Dream (G1Orig, Engineering HardSPL)

使用Nandroid备份的.img文件,可以使用Android源码中所包含的一个命令行工具fastboot来进行恢复,下载可以在相关论坛上找到的.



简单的fastboot命令:

1.重启G1:

$ fastboot reboot

2.刷所有分区:以下命令会在当前目录寻找各种所有的image文件,并且在刷完所有分区后重启手机

$ fastboot flashall

3.刷指定分区:

$ fastboot flash {partition} {file.img}

如:fastboot flash system /备份/system.img

4.擦除分区:

$ fastboot erase {partition}

如:fastboot erase system

5.刷完整的系统: (未测试!!). 创建一个包含boot.img, system.img和recovery.img的zip压缩包,并且运行:

$ fastboot update {update.zip}

6.刷自定义开机画面:(替代默认的白色"T-Mobile G1"画面):

$ fasboot flash splash1 mysplash.rgb565

注意开机画面文件需要一个特定格式,参考:Custom boot image

*通常需要完全恢复的操作是:

$ fastboot flash boot boot.img
$ fastboot flash system system.img
$ fastboot flash userdata data.img

$ fastboot flash recovery recovery.img

以下是完整的fastboot命令的使用说明:

usage: fastboot [ ]
commands:
update reflash device from update.zip
flashall "flash boot" + "flash system"
flash [ ] write a file to a flash partition
erase erase a flash partition
getvar display a bootloader variable
boot [ ] download and boot kernel
flash:raw boot [ ] create bootimage and flash it
devices list all connected devices
reboot reboot device normally
reboot-bootloader reboot device into bootloader

options:
-w erase userdata and cache
-s specify device serial number
-p specify product name
-c override kernel commandline
-i specify a custom USB vendor id

一般都是用recovery的,也可以用ruu

TOP

返回列表