Difference between revisions of "Fastboot"

From Rockchip open source Document
Jump to: navigation, search
 
(41 intermediate revisions by one other user not shown)
Line 3: Line 3:
  
 
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 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 =
 
= 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.<br/> To list all the Rockchip devices attached to your USB port in fastboot mode.
 
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.<br/> To list all the Rockchip devices attached to your USB port in fastboot mode.
<pre><code>$ sudo fastboot -i 0x2207 devices
+
<pre>$ sudo fastboot -i 0x2207 devices
0123456789AB fastboot</code>
+
0123456789AB fastboot
 
</pre>
 
</pre>
  
 
To flash loader
 
To flash loader
<pre><code>$ sudo fastboot -i 0x2207 flash loader "path to your loader"</code>
+
<pre>$ sudo fastboot -i 0x2207 flash loader "path to your loader"
 +
</pre>
 +
 
 +
To flash android boot image
 +
<pre>$ sudo fastboot -i 0x2207 flash boot_a "path to your boot image"
 +
0123456789AB fastboot
 +
</pre>
 +
 
 +
To flash android system image
 +
<pre>$ sudo fastboot -i 0x2207 flash system_a "path to your system image"
 +
0123456789AB fastboot</pre>
 +
 
 +
To get version:
 +
<pre>fastboot getvar version</pre>
 +
 
 +
To get version:
 +
<pre>fastboot getvar version-bootloader
 
</pre>
 
</pre>
  
To flash Android boot image
+
To get unlocked:
<pre><code>$ sudo fastboot -i 0x2207 flash boot_a "path to your boot image"
+
<pre>fastboot getvar unlocked
0123456789AB fastboot</code>
 
 
</pre>
 
</pre>
  
To flash Android system image
+
To get&nbsp;locked:
<pre><code>$ sudo fastboot -i 0x2207 flash system_a "path to your system image"
+
<pre>fastboot getvar secure</pre>
0123456789AB fastboot</code></pre>
+
 
 +
To get product information:
 +
<pre>fastboot getvar product</pre>
 +
 
 +
To get serialno:
 +
<pre>fastboot getvar serialno</pre>
 +
 
 +
To get partition type:
 +
<pre>fastboot getvar partition-type:<partition_name>
 +
</pre>
  
{| border="1" cellpadding="0" cellspacing="0" width="760"
+
To get partition size:
|-
+
<pre>fastboot getvar partition-size:<partition_name>
| style="width:608px;" |
+
</pre>
fastboot getvar version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得版本
 
  
fastboot getvar version-bootloader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得版本
+
To get partition offset:
 +
<pre>fastboot getvar partition-offset:<partition_name>
 +
</pre>
  
fastboot getvar unlocked&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得解锁情况
+
&nbsp;
  
fastboot getvar secure&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得锁住情况(与unlock相反)
+
== Download the Image ==
  
fastboot getvar product&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得产品信息
+
To flash&nbsp;image:
 +
<pre>fastboot flash <partition_name> <filename>
 +
</pre>
  
fastboot getvar serialno&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得序列号
+
&nbsp;(For example:fastboot flash system system.img)
  
fastboot getvar partition-type:<partition_name>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得指定分区类型
+
When download the parameter or loader,you need assign the partition name as "<var>parameter</var>" or "<var>loader</var>"
  
fastboot getvar partition-size:<partition_name>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得指定分区大小
+
To update firmware:
 +
<pre>fastboot update <filename>
 +
</pre>
  
fastboot getvar partition-offset:<partition_name>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获得指定分区偏移
+
(The firmware package was generated from &nbsp;android source code <var>make updatepackage</var>)
  
|}
+
&nbsp;
  
=== [[镜像烧写|镜像烧写]] ===
+
== Reboot ==
  
fastboot flash <partition_name> <filename>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 烧写固件
+
&nbsp;To recovery:
 +
<pre>fastboot oem recovery </pre>
  
(如:fastboot flash system system.img。
+
&nbsp;To recovery and restore:
 +
<pre>fastboot oem recovery:wipe_data</pre>
  
烧写parameter/loader时,需指定分区名为”parameter”/”loader”)
+
To Reboot:
 +
<pre>fastboot reboot</pre>
  
fastboot update <filename>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 烧写升级包
+
To reboot and enter into rockusb loader mode
 +
<pre>fastboot reboot-bootloader</pre>
  
(升级包通过在android源码中make updatepackage生成)
+
To continue:
 +
<pre>fastboot continue </pre>
  
 +
&nbsp;
  
== 1.2 Reboot ==
+
=== Lock and Unlock the Device ===
  
{| border="0" cellpadding="0" cellspacing="0" width="760"
+
To unlock:
|-
+
<pre>fastboot oem unlock</pre>
| style="width:608px;" |
 
fastboot oem recovery&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 重启进recovery
 
  
fastboot oem recovery:wipe_data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 重启恢复出厂设置
+
To &nbsp;confirm unlock(input &nbsp;it in 5 minutes after typing <var>fastboot oem unlock command</var>):
 +
<pre>fastboot oem unlock_accep</pre>
  
fastboot reboot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 重启
+
To lock the device:
 +
<pre>fastboot oem lock
 +
</pre>
  
fastboot reboot-bootloader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 重启进入rockusb烧写模式
+
&nbsp;
  
fastboot continue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 重启
+
=== Special Command ===
  
|}
+
To boot from specifc firmware templately:
 +
<pre>fastboot boot <kernel> [ <ramdisk> ]</pre>
  
=== 1.2.1 Lock and Unlock ===
+
(Kernel supports Image/zImage,and you should&nbsp;keep <var>dtb</var> in the last part of kernel,or <var>resource partition</var>)
  
fastboot oem unlock&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 解锁
+
To generate a&nbsp;log file:
 +
<pre>fastboot oem log </pre>
  
fastboot oem unlock_accept&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 确认解锁
+
To execute u-Boot command:
 +
<pre>fastboot oem ucmd <UBOOT cmds></pre>
  
(需要在fastboot oem unlock命令后,5秒内输入)
+
&nbsp;
  
fastboot oem lock&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 锁住设备
+
&nbsp;
  
=== 1.2.2 Special Command ===
+
&nbsp;
  
fastboot boot <kernel> [ <ramdisk> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 临时从指定固件启动
+
&nbsp;
  
(kernel目前支持Image/zImage,需要将dtb存于kernel末尾,或者resource分区中)
+
== Unlock your Device via Fastboot ==
  
fastboot oem log&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 获取串口log信息
+
Initially,it is not allow you perform flash or&nbsp;oem command with locked fastboot.
  
fastboot oem ucmd <UBOOT cmds>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 运行UBOOT命令
+
'''To relock''':
  
== 1.3&nbsp;'''Fastboot'''解锁 ==
+
1、Executing <var>fastboot oem unlock</var>
  
fastboot锁住状态下,不允许烧写及执行oem命令,初始状态为锁住。
+
2、Then executing&nbsp;<var>fastboot oem unlock_accept in 5 seconds,</var>
  
解锁流程大致如下:
+
3、You device will reboot and recovery
  
1、执行fastboot oem unlock
+
4、Now push&nbsp;your device into fastboot mode again and <var>fastboot getvar unlocked will return to&nbsp;</var>"yes"
  
2、5秒内继续执行fastboot oem unlock_accept
+
(Congraduations you have unlock your device finished!)
  
3、机器会重启进入recovery恢复出厂设置
+
What if the device have entered into fastboot mode with indicates that <var>NOT found your device</var>, you need put '''<var>-i&nbsp;</var>'''into your command in order to assign device ID.
  
4、再次进入fastboot,则fastboot getvar unlocked应该返回"yes"(设备已解锁)
+
For example:fastboot -i 0x2207 getvar unlocked
  
 
&nbsp;
 
&nbsp;
 
如果设备进入fastboot状态后,fastboot命令提示未发现设备,则需要在命令中加入-i参数指定设备vid,例如fastboot -i 0x2207 getvar unlocked
 

Latest revision as of 11:20, 16 March 2017

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.

$ sudo fastboot -i 0x2207 devices
0123456789AB fastboot

To flash loader

$ sudo fastboot -i 0x2207 flash loader "path to your loader"

To flash android boot image

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

To flash android system image

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

To get version:

fastboot getvar version

To get version:

fastboot getvar version-bootloader

To get unlocked:

fastboot getvar unlocked 

To get locked:

fastboot getvar secure

To get product information:

fastboot getvar product

To get serialno:

fastboot getvar serialno

To get partition type:

fastboot getvar partition-type:<partition_name>

To get partition size:

fastboot getvar partition-size:<partition_name>

To get partition offset:

fastboot getvar partition-offset:<partition_name>

 

Download the Image

To flash image:

fastboot flash <partition_name> <filename>

 (For example:fastboot flash system system.img)

When download the parameter or loader,you need assign the partition name as "parameter" or "loader"

To update firmware:

fastboot update <filename> 

(The firmware package was generated from  android source code make updatepackage

 

Reboot

 To recovery:

fastboot oem recovery 

 To recovery and restore:

fastboot oem recovery:wipe_data

To Reboot:

fastboot reboot

To reboot and enter into rockusb loader mode

fastboot reboot-bootloader

To continue:

fastboot continue 

 

Lock and Unlock the Device

To unlock:

fastboot oem unlock

To  confirm unlock(input  it in 5 minutes after typing fastboot oem unlock command):

fastboot oem unlock_accep

To lock the device:

fastboot oem lock

 

Special Command

To boot from specifc firmware templately:

fastboot boot <kernel> [ <ramdisk> ]

(Kernel supports Image/zImage,and you should keep dtb in the last part of kernel,or resource partition

To generate a log file:

fastboot oem log 

To execute u-Boot command:

fastboot oem ucmd <UBOOT cmds>

 

 

 

 

Unlock your Device via Fastboot

Initially,it is not allow you perform flash or oem command with locked fastboot.

To relock

1、Executing fastboot oem unlock

2、Then executing fastboot oem unlock_accept in 5 seconds,

3、You device will reboot and recovery

4、Now push your device into fastboot mode again and fastboot getvar unlocked will return to "yes"

(Congraduations you have unlock your device finished!)

What if the device have entered into fastboot mode with indicates that NOT found your device, you need put -i into your command in order to assign device ID.

For example:fastboot -i 0x2207 getvar unlocked