当前位置:   article > 正文

【android】Fastboot命令详解_fastboot查看分区

fastboot查看分区

文章出处:http://blog.csdn.net/geniusmen/article/details/7892398

1.Fastboot简介

Fastboot是Android快速升级的一种方法,Fastboot的协议fastboot_protocol.txt在源码目录./bootable/bootloader/legacy下可以找到。

Fastboot客户端是作为Android系统编译的一部分,编译后位于./out/host/linux-x86/bin/fastboot目录下。

Fastboot命令实例:sudo fastboot flash kernel path-to-kernel/uImage

烧写rootfs类似:sudo fastboot flash system path-to-system/system.img

2.命令

2.1 升级系统

sudo fastboot flash bootloader u-boot.bin
sudo fastboot flash kernel uImage
sudo fastboot flash system system.img
sudo fastboot flash userdata userdata.img
sudo fastboot flash ramdisk ramdisk-uboot.img
sudo fastboot erase cache

fastboot flash {partition} {*.img}   例:fastboot flash boot boot.img或fastboot flash system system.img等。

fastboot flashall   注意:此命令会在当前目录中查找所有img文件,将这些img文件烧写到所有对应的分区中,并重新启动手机。

一次烧写boot,system,recovery分区:

    (1)创建包含boot.img,system.img,recovery.img文件的zip包。

    (2)执行:fastboot update {*.zip}

烧写开机画面:

    fastboot flash splash1 开机画面

2.2 重启系统

sudo fastboot reboot

2.3 不烧写flash情况下调试

sudo fastboot boot uImage 或者u-boot.bin

2.4 查看版本号

sudo fastboot getver:version

2.5 复位到bootloader

sudo fastboot reboot-bootloader

2.6 命令格式

主机端发送字符串的命令,字符串小于等于64个字节,客户端首先返回四个字节的内容,是OKAY、FAIL、DATA、INFO之一,随后跟着是信息或数数据。

2.7 清空分区

fastboot erase {partition}   例:fastboot erase boot或fastboot erase system等。

fastboot erase boot

fastboot erase system

fastboot erase data

fastboot erase cache

上面的命令也可以简化成一条命令

fastboot erase system -w

2.8 获取客户端(手机端)变量信息

fastboot getvar version:version-bootloader:version-baseband:product:serialno:secure 

version 客户端支持的fastboot协议版本

version-bootloader  Bootloader的版本号

version-baseband    基带版本

product             产品名称

serialno             产品序列号

secure              返回yes 表示在刷机时需要获取签名

3.支持的参数

偏移和地址在u-boot中定义,要想使用好fastboot,就必须要知道参数名称与文件的对应关系。

 

name offset size
xloader 0x00000000 0x00080000
bootloader 0x00080000 0x00180000
environment 0x001C0000 0x00040000
kernel 0x00200000 0x01D00000
system 0x02000000 0x0A000000
userdata 0x0C000000 0x02000000
cache 0x0E000000 0x02000000

 

 

name type of file usual file
xloader xloader binary MLO
bootloader uboot binary u-boot.bin
environment text file list of variables to set
kernel kernel or kernel + ramdisk uImage, uMulti
system yaffs2 system.img
userdata yaffs2 userdata.img
cache yaffs2 ?

 

4.其他功能

4.1环境变量

fastboot支持环境变量文件,通常在fastboot烧写nand flash时,会将偏移量和大小写入环境变量中,命名格式为:

<partition name>_nand_offset
<partition name>_nand_size

例如,内核烧写完成后printenv可以看到:

kernel_nand_offset=0x140000
kernel_nand_size=0x1f70000

4.2查看USB设备

查看连接到OTG的USB设备情况,lsusb:

Bus 008 Device 030: ID 0451:cafe Texas Instruments, Inc. <----- fastboot

更多细节查看cat /proc/bus/usb/devices

4.3 静态模块地址

fastboot重用内核的nand地址分配方式,并且大部分是可以变化的,但是下面列出来的这些地址是不变的。

name                 offset                 size

xloader          0x00000000      0x00080000

bootloader     0x00080000      0x00180000

environment  0x001C0000      0x00040000

4.4 文件大小限制

最大下载文件大小为240M。

5 简单常用的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}
3
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 [ <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
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/327210?site=
推荐阅读
相关标签
  

闽ICP备14008679号