Thursday, April 09, 2009

G1刷机需了解的分区及fastboot的使用

G1刷机需了解的分区及fastboot的使用 2009-02-12 16:55

分类:Android
字号:     

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 Cheat Sheet 下载地址:

fastboot-win32.zip
fastboot-osx-10_5.zip
fastboot-linux-i386.zip

简单的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命令的使用说明:

usage: fastboot [ <option> ] <command>
commands:
update <filename>   reflash device from update.zip
flashall    "flash boot" + "flash system"
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition>   erase 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
reboot     reboot device normally
reboot-bootloader   reboot device into bootloader

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

No comments: