Fastboot

From Rockchip open source Document
Revision as of 12:24, 8 March 2017 by Kever (talk | contribs)
Jump to: navigation, search

Introduction

Fastboot is a protocol that can be used to re-flash partitions on your device (update the flash file system in your devices). It is this small tool that comes with the Android SDK (Software Developer Kit), which is an alternative to the Recovery Mode for doing installations and updates. It first comes with Android. Google have submit the fastboot code to mainline U-boot. So we can use this protocol to flash partition on your device. There are three way to enter fastboot mode

Fastboot command

Rockchip use 0x2207 as its USB vendor ID. This VID is not in Google's original fastboot code. So every fastboot command have to use "-i" parameter to specify vid to fastboot.
To list all the Rockchip devices attached to your USB port in fastboot mode.

<code>$ sudo fastboot -i 0x2207 devices
0123456789AB fastboot</code>

To flash loader

<code>$ sudo fastboot -i 0x2207 flash loader "path to your loader"</code>

To flash Android boot image

<code>$ sudo fastboot -i 0x2207 flash boot_a "path to your boot image"
0123456789AB fastboot</code>

To flash Android system image

<code>$ sudo fastboot -i 0x2207 flash system_a "path to your system image"
0123456789AB fastboot</code>

fastboot getvar version                                               获得版本

fastboot getvar version-bootloader                                   获得版本

fastboot getvar unlocked                                            获得解锁情况

fastboot getvar secure                                          获得锁住情况(与unlock相反)

fastboot getvar product                                              获得产品信息

fastboot getvar serialno                                              获得序列号

fastboot getvar partition-type:<partition_name>             获得指定分区类型

fastboot getvar partition-size:<partition_name>              获得指定分区大小

fastboot getvar partition-offset:<partition_name>                  获得指定分区偏移

镜像烧写

fastboot flash <partition_name> <filename>                   烧写固件

(如:fastboot flash system system.img。

烧写parameter/loader时,需指定分区名为”parameter”/”loader”)

fastboot update <filename>                                       烧写升级包

(升级包通过在android源码中make updatepackage生成)

1.2 重启

fastboot oem recovery                                          重启进recovery

fastboot oem recovery:wipe_data                               重启恢复出厂设置

fastboot reboot                                                     重启

fastboot reboot-bootloader                                         重启进入rockusb烧写模式

fastboot continue                                                  重启

1.2.1 解锁和锁住设备

fastboot oem unlock                                             解锁

fastboot oem unlock_accept                                        确认解锁

(需要在fastboot oem unlock命令后,5秒内输入)

fastboot oem lock                                                 锁住设备

1.2.2 特殊命令

fastboot boot <kernel> [ <ramdisk> ]                             临时从指定固件启动

(kernel目前支持Image/zImage,需要将dtb存于kernel末尾,或者resource分区中)

fastboot oem log                                                  获取串口log信息

fastboot oem ucmd <UBOOT cmds>                                 运行UBOOT命令

1.3 Fastboot解锁

fastboot锁住状态下,不允许烧写及执行oem命令,初始状态为锁住。

解锁流程大致如下:

1、执行fastboot oem unlock

2、5秒内继续执行fastboot oem unlock_accept

3、机器会重启进入recovery恢复出厂设置

4、再次进入fastboot,则fastboot getvar unlocked应该返回"yes"(设备已解锁)

 

如果设备进入fastboot状态后,fastboot命令提示未发现设备,则需要在命令中加入-i参数指定设备vid,例如fastboot -i 0x2207 getvar unlocked