如何把fastboot协议移植到uboot移植

Android的Fastboot通信协议 - 推酷
Android的Fastboot通信协议
Fastboot功能简介
FastBoot用于Android系统的系统升级和烧写,基于USB通信。通信协议比较简单,Android系统本身提供了上位机命令行工具和下位机Bootloader Demo。
Android系统的fastboot刷机模式
开机按”音量+“+Power启动到fastboot,即命令或SD卡烧写模式,不加载内核及文件系统,此处可以进行工厂模式的烧写;
开机按Home+Power启动到recovery模式,加载recovery.img,recovery.img包含内核,基本的文件系统,用于工程模式的烧写;
开机按Power,正常启动系统,加载boot.img,boot.img包含内核,基本文件系统,用于正常启动手机
fastboot功能概述
fastboot负责与Bootloader通信,将映像文件及其存储的分区名称等信息通过USB传输至Bootloader,然后由Bootloader自行决定具体烧写在哪里,以何种格式进行烧写。
fastboot协议有文件大小限制
。由于是先donwload数据,然后再flash,所以必须先有足够的RAM空间缓冲数据,所以这就限制了烧写的映像文件有所限制。具体的文件大小限制取决于底层的RAM空间和Bootloader实现。
是否可将一个映像文件分批下载下去,突破RAM限制
进入fastboot刷机模式
将手机关机
同时按住按音量上机键也即音量+键和电源键开机
当看到 界面上有fastboot选项时时,按音量上选择如何按电源键点击进入fastboot模式。
fastboot刷机命令
fastboot flash bootloader u-boot.bin
fastboot flash kernel uImage
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot flash ramdisk ramdisk-uboot.img
fastboot erase cache
fastboot reboot
情况下调试
fastboot boot uImage 或者u-boot.bin
查看版本号
fastboot getver:version
bootloader
fastboot reboot-bootloader
Fastboot协议
flash和erase中使用到了partition,协议只是指定了该partition的名称。具体partition的名称取值如何,对应哪些地址区域,如何进行读写操作,由Bootloader自行实现
如何限制一次传输的数据大小?不会超过底层RAM大小吗?
来源android系统源码目录./bootable/bootloader/legacyfastboot_protocol.tx。完整协议内容如下:
FastBoot& Version& 0.4
———————-
The fastboot protocol is a mechanism for communicating with bootloaders over USB.& It is designed to be very straightforward to implement, to allow it to be used across a wide range of devices and from hosts running Linux, Windows, or OSX.
(提供跨平台的与bootloader通过USB通信的机制)
Basic Requirements
——————
* Two bulk endpoints (in, out) are required(一个批量IN端点,一个批量OUT端点)
* Max packet size must be 64 bytes for full-speed and 512 bytes for high-speed USB(包大小:64B/全速、512B/高速)
* The protocol is entirely host-driven and synchronous (unlike the multi-channel, bi-directional, asynchronous ADB protocol)(主机驱动,同步传输)
Transport and Framing
———————
1. Host sends a command, which is an ascii string in a single& packet no greater than 64 bytes.
(主机在一个小于64B的包中发送ascii命令串)
2. Client response with a single packet no greater than 64 bytes.& The first four bytes of the response are &OKAY&, &FAIL&, &DATA&,
&& or &INFO&.& Additional bytes may contain an (ascii) informative&& message.
& (客户端在小于64B的包中发送 &OKAY&, &FAIL&, &DATA&,&& or &INFO&以及其它ascii串信息)
&& a. INFO -& the remaining 60 bytes are an informative message (providing progress or diagnostic messages).& They should be displayed and then step #2 repeats(其余60字节包含提示信息)
&& b. FAIL -& the requested command failed.& The remaining 60 bytes& of the response (if present) provide a textual failure message
&&&&& to present to the user.& Stop.(发生错误,其余60字节包含错误信息)
&& c. OKAY -& the requested command completed successfully.& Go to #5(命令执行完成)
&& d. DATA -& the requested command is ready for the data phase. A DATA response packet will be 12 bytes long, in the form of
&&&&& DATA where the 8 digit hexidecimal number represents& the total data size to transfer.
&&&& (指示可以开始命令传输,格式为DATAxxxxxxxx,xxxxxxxx表示传输数据大小,十进制字符串)
3. Data phase.& Depending on the command, the host or client will& send the indicated amount of data.& Short packets are always&& acceptable and zero-length packets are ignored.& This phase continues until the client has sent or received the number of bytes indicated in the &DATA& response above.
&&& (数据传输)
4. Client responds with a single packet no greater than 64 bytes. The first four bytes of the response are &OKAY&, &FAIL&, or &INFO&.
&& Similar to #2:(客户端返回数据包响应)
&& a. INFO -& display the remaining 60 bytes and return to #4
&& b. FAIL -& display the remaining 60 bytes (if present) as a failure reason and consider the command failed.& Stop.
&& c. OKAY -& success.& Go to #5
5. Success.& Stop.
Example Session
—————
Host:&&& &getvar:version&&&&&&&& request version variable
Client:& &OKAY0.4&&&&&&&&&&&&&&& return version &0.4&
Host:&&& &getvar:nonexistant&&&& request some undefined variable
Client:& &OKAY&&&&&&&&&&&&&&&&&& return value &&
Host:&&& &download:&&&&& request to send 0&1234 bytes of data
Client:& &DATA&&&&&&&&&& ready to accept data
Host:&&& & 0&1234 bytes &&&&&&&& send data(传送完成后才发回响应)
Client:& &OKAY&&&&&&&&&&&&&&&&&& success
Host:&&& &flash:bootloader&&&&&& request to flash the data to the bootloader
Client:& &INFO erasing flash&&&&& indicate status / progress(INFO显示当前操作状态及进度)
&&&&&&&& &INFO writing flash&
&&&&&&&& &OKAY&&&&&&&&&&&&&&&&&& indicate success
Host:&&& &powerdown&&&&&&&&&&&&& send a command
Client:& &FAIL unknown command&&& indicate failure
Command Reference
—————–
* Command parameters are indicated by printf-style escape sequences.
* Commands are ascii strings and sent without the quotes (which are for illustration only here) and without a trailing 0 byte.
&& 命令使用字符串形式,以ascii 0结束,类似于C语言中的结束
* Commands that begin with a lowercase letter are reserved for this specification.& OEM-specific commands should not begin with a
& lowercase letter, to prevent incompatibilities with future specs.
& (所有以小写字母开始的命令均为协议保留,ODE厂商必须使用大小字符开始)
&getvar:%s& :Read a config/version variable from the bootloader. The variable contents will be returned after the OKAY response.
&download:%08x&: Write data to memory which will be later used by &boot&, &ramdisk&, &flash&, etc. The client will reply with &DATA%08x& if it has enough space in RAM or &FAIL& if not. The size of the download is remembered.
&verify:%08x&:Send a digital signature to verify the downloaded data. Required if the bootloader is &secure& otherwise &flash& and &boot& will be ignored.
&flash:%s&: Write the previously downloaded image to the named partition (if possible).(具体说明见下边)
&erase:%s& :Erase the indicated partition (clear to 0xFFs)(具体说明见下边)
&boot&:The previously downloaded data is a boot.img and should be booted according to the normal procedure for a boot.img
&continue&: Continue booting as normal (if possible)
&reboot&:Reboot the device.
&reboot-bootloader&: Reboot back into the bootloader. Useful for upgrade processes that require upgrading the bootloader and then upgrading other partitions using the new bootloader.
&powerdown&:Power off the device.
Client Variables
—————-
The &getvar:%s& command is used to read client variables which
represent various information about the device and the software
The various currently defined names are:
& version&&&&&&&&&&&& Version of FastBoot protocol supported.& It should be &0.3& for this document.
& version-bootloader& Version string for the Bootloader.
& version-baseband&&& Version string of the Baseband Software
& product&&&&&&&&&&&& Name of the product
& serialno&&&&&&&&&&& Product serial number
& secure&&&&&&&&&&&&& If the value is &yes&, this is a secure bootloader requiring a signature before it will install or boot images.
Names starting with a lowercase character are reserved by this specification.& OEM-specific names should not start with lowercase
characters.
已发表评论数()
&&登&&&陆&&
已收藏到推刊!
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见1 Pages: 1/8& & &Go
主题 : u-boot中移植fastboot功能-可以刷手机一样刷开发板
级别: 骑士
金钱: 1480 两
威望: 296 点
贡献值: 5 点
综合积分: 592 分
&u-boot中移植fastboot功能-可以刷手机一样刷开发板
         (本文是针对s5pv210的u-boot移植分析文章,u-boot源码会在更新)         感谢@网友提出的BUG,现在在u-boot中已经实现了fastboot功能,就可以扔掉串口刷系统了。先来一个刷系统的截图: =700) window.open('http://www.arm9home.net/attachment/58_61588_cf9.png');" onload="if(this.width>'700')this.width='700';" > 然后是串口的反应:U-Boot 2013.01-rc2-g5654154-dirty (Sep 08 2013 - 22:39:50) for TINY210(Nand:K9GAG08U0F)CPU:    S5PC110@1000MHzBoard:   FriendlyARM-TINY210DRAM:  512 MiBWARNING: Caches not enabledPWM Moudle Initialized.GPD0CON  : 1111, GPD0DAT  : eNAND:  256 MiBMMC:   SAMSUNG SD/MMC: 0, SAMSUNG SD/MMC: 1In:    serialOut:   serialErr:   serialNet:   dm9000checking mode for fastboot ...fastboot_preboot() = 0checking mode for fastboot ...Hit any key to stop autoboot:  0 [Ver130726-TINY210v2]# fastbootFastboot: employ default partition information[Partition table on NAND]ptn 0 name='bootloader' start=0x0 len=0x24KB) (Uboot)ptn 1 name='kernel' start=0x400000 len=0x20KB) ptn 2 name='system' start=0xE00000 len=0xF7808KB) (Yaffs)Received 32 bytes: getvar:partition-type:bootloaderReceived 24 bytes: getvar:max-download-sizeReceived 17 bytes: download:00046b08Starting download of 289544 bytesdownloading of 289544 bytes finishedReceived 16 bytes: flash:bootloaderflashing 'bootloader'ptn-&length = 1048576cmd = nand erase 0 100000NAND erase: device 0 offset 0x0, size 0x100000Erasing at 0xe0000 -- 100% complete.OKcmd = nand erase 0 100000NAND write: device 0 offset 0x0, size 0x60000Writing at 0x40000 -- 100% is complete. 393216 bytes written: OKpartition 'bootloader' flashedReceived 28 bytes: getvar:partition-type:kernelReceived 24 bytes: getvar:max-download-sizeReceived 17 bytes: download:Starting download of 4809352 bytes....downloading of 4809352 bytes finishedReceived 12 bytes: flash:kernelflashing 'kernel'ptn-&length = 5242880cmd = nand erase 000NAND erase: device 0 offset 0x400000, size 0x500000Erasing at 0x8e0000 -- 100% complete.OKcmd = nand erase 000NAND write: device 0 offset 0x400000, size 0x4a0000Writing at 0x880000 -- 100% is complete. 4849664 bytes written: OKpartition 'kernel' flashedReceived 28 bytes: getvar:partition-type:systemReceived 24 bytes: getvar:max-download-sizeReceived 17 bytes: download:Starting download of
bytes......................downloading of
bytes finishedReceived 12 bytes: flash:systemflashing 'system'ptn-&length = cmd = nand erase e0NAND erase: device 0 offset 0xe00000, size 0xf200000Skipping bad block at  0x00f4;                                         Skipping bad block at  0x04de;                                         Skipping bad block at  0x08b2;                                         Skipping bad block at  0x0ab4;                                         Skipping bad block at  0x0b0;                                         Skipping bad block at  0x0e0c;                                         Skipping bad block at  0x0f0;                                         Skipping bad block at  0x0f0;                                         Erasing at 0xffe0000 -- 100% complete.OKcmd = nand erase e0NAND write: device 0 offset 0xe00000, size 0x1672200Writing at 0xf20000 -- 6% is complete.Skip bad block 0x00f40000Writing at 0x2480000 -- 100% is complete.
bytes written: OKpartition 'system' flashed。更有趣的是,MiniTools+SuperBoot也是基于fastboot来实现的。当u-boot进入fastboot模式的时候,如果PC上打开MiniTools的时候,MiniTools会以为开发上是SuperBoot,并显示为usb 已经连接,从串口还可以看到MiniTools和&SuperBoot&(这里是u-boot)通信信息。(为了正常使用,如果要用在u-boot进入fastboot的时候,PC上关闭MiniTools) =700) window.open('http://www.arm9home.net/attachment/58_61588_8aeae37f692fe63.png');" onload="if(this.width>'700')this.width='700';" >也就是说如果友善提供MiniTools的API,就可以用开源的u-boot实现与MiniTools对接烧写系统。为了方便大家实验,我把所用到的镜像都打包了,这里(本部分内容设定了隐藏,需要回复后才能看到)。还有目前移植的是一个beta版本,还调试语句都没有去掉,还没有向主线版本中合并。大家也先来找找这个fastboot有没有bug。今天就不分析文章了,再有半个小时就又周一了。另:关于安装fastboot:我这边没有windows测试,你可以baidu一下。ubuntu12.10安装是:sudo apt-get install android-tools-fastboot关于简单的更新系统:fastboot flash bootloader tiny210v2-uboot.binfastboot flash kernel /work/tftpboot/uImage_softeccfastboot flash system /work/tftpboot/rootfs_qtopia_qt4.img更多关于fastboot的使用请见.[ 此帖被kangear在 00:13重新编辑 ]
畅游在知识的海洋...
级别: 论坛版主
金钱: 3055 两
威望: 611 点
贡献值: 5 点
综合积分: 1190 分
好好学习,天天鲁管
自由,自强,共享,共创。
级别: 论坛版主
发帖: 8883
金钱: 46340 两
威望: 9268 点
贡献值: 27 点
综合积分: 18306 分
我们早已说明Superboot采用了fastboot底层驱动。所不同的是,我们更加充分的发挥了fastboot驱动:- 可以下载到指定内存运行- 可以烧写ext3/4, yaffs2和ubi格式的系统,大多数安卓rom是ext3/4格式的- 突出的特色,可以烧写裸机程序- 更突出的特色,Superboot已经支持Mini2440了- 更更突出的特色,可以烧写WindowsCE还有很多方便的特色,需要你慢慢发掘了,总之在刷机更新和调试系统方面,Superboot比u-boot强很多。
新手如何向我们反馈有效的信息,以便解决问题,见此贴: [注]: 此处签名链接仅为指引方向,而非解答问题本身.
级别: 新手上路
金钱: 40 两
威望: 8 点
贡献值: 0 点
综合积分: 16 分
谢谢。。。。这个值得一看
级别: 骑士
金钱: 1480 两
威望: 296 点
贡献值: 5 点
综合积分: 592 分
&回 2楼(mindee) 的帖子
MiniTools可以不开源,通信协议能不能公布。我让u-boot也能配合MiniTools刷系统。
级别: 新手上路
金钱: 50 两
威望: 10 点
贡献值: 0 点
综合积分: 20 分
太棒了太棒了
级别: 骑士
金钱: 1480 两
威望: 296 点
贡献值: 5 点
综合积分: 592 分
&回 2楼(mindee) 的帖子
我的u-boot也会一步步实现如下功能:- 可以下载到指定内存运行- 可以烧写ext3/4, yaffs2和ubi格式的系统,大多数安卓rom是ext3/4格式的- 突出的特色,可以烧写裸机程序- 更突出的特色,Superboot已经支持Mini2440了- 更更突出的特色,可以烧写WindowsCE
级别: 新手上路
金钱: 80 两
威望: 16 点
贡献值: 0 点
综合积分: 32 分
级别: 新手上路
金钱: 190 两
威望: 38 点
贡献值: 0 点
综合积分: 76 分
级别: 论坛版主
发帖: 5438
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11116 分
支持!功能再强的软件如果不开源,就等于没有自由。
&If you have an apple and I have an apple and we exchange apples, then you and I willstill each have one apple. But if you have an idea and I have an idea and we exchangethese ideas, then each of us will have two ideas.&
1 Pages: 1/8& & &Go
Powered by查看: 1196|回复: 4
最后登录在线时间0 小时机票153 大叔币0 注册时间阅读权限20主题精华0积分305UID162219
玩机二段, 积分 305, 距离下一级还需 595 积分
机票153 大叔币0 最后登录注册时间主题精华0UID162219
新机上手做了各种测试,发现FASTBOOT功能无法使用& waiting for device &,检查驱动全部正常。然后sp烧录了移动版的全包,基带不对,所以认不了网络。但是发现装上w版1.5的驱动后可以正常使用fastboot功能,遂思考原因。把机子sp烧回联通版后,提取移动版uboot(lk.bin)尝试烧入,结果开机不认卡,然后测试fastboot功能正常使用。
思考结果:
1.uboot(lk.bin)可能存在fastboot功能代码。
2uboot(lk.bin)可能存在调用fastboot功能地址。
3.uboot(lk.bin)可能存在基带驱动文件。(由于文件较小,可能性低。)
4.uboot(lk.bin)存在基带分区地址。
望有心人继续深入研究。
望联通版能正常使用fastboot功能的机油提供一下驱动。造福机油。
移动叔叔论坛 - 论坛版权
1、发帖作者在本主题帖中的所有言论和图片纯属个人意见,与立场无关
2、发帖作者在本站发表的所有标注为原创的主题帖,其相关版权归发帖作者和所有
3、其他单位或个人若进行使用、转载或引用本文时,需同时征得该发帖作者和的同意
4、发帖作者必须承担一切因本文的发表而直接或者间接导致的民事或刑事法律责任
5、本主题帖的部分内容可能来源于网络,但并不代表本站赞同其观点和对其真实性负责
6、如本帖侵犯到任何版权问题,请提供有效证明材料联系本站,本站将及时删除并致以最深的歉意
7、管理员和版主有权不事先通知随时删除本文
最后登录在线时间0 小时机票224 大叔币0 注册时间阅读权限20主题精华0积分395UID1655429
玩机二段, 积分 395, 距离下一级还需 505 积分
机票224 大叔币0 最后登录注册时间主题精华0UID1655429
支持啊,一直不能用fastboot,郁闷死了
最后登录在线时间0 小时机票21 大叔币0 注册时间阅读权限1主题精华0积分34UID1559886
新注册用户, 积分 34, 距离下一级还需 16 积分
机票21 大叔币0 最后登录注册时间主题精华0UID1559886
最后登录在线时间0 小时机票11 大叔币0 注册时间阅读权限1主题精华0积分15UID2210355
新注册用户, 积分 15, 距离下一级还需 35 积分
机票11 大叔币0 最后登录注册时间主题精华0UID2210355
本帖最后由 franktangamen 于
04:14 编辑
最近剛買了8297W,試了好久才成功.發現要指定vendor id 才能連接:
fastboot -i 0x1ebf devices
更正:最後發現與fastboot版本有關,用這版就可以了
本帖子中包含更多资源
才可以下载或查看,没有帐号?
最后登录在线时间0 小时机票153 大叔币0 注册时间阅读权限20主题精华0积分305UID162219
玩机二段, 积分 305, 距离下一级还需 595 积分
机票153 大叔币0 最后登录注册时间主题精华0UID162219
franktangamen 发表于
最近剛買了8297W,試了好久才成功.發現要指定vendor id 才能連接:
fastboot -i 0x1ebf devices
好的!!!!!!
站长推荐 /2
YOU能量,续航+!移动叔叔联合铁粉俱乐部招募TCL续航+P618L电信4G全网通手机免费试用啦!
TCL ono手机,狂野来袭。TCL ono手机主打出彩、有声、有摄,带给消费者超乎想象的美好体验!
移动叔叔. 版权所有,专业的网络售后平台 (
商务合作||||求教,刷入uboot的问题_百度知道
求教,刷入uboot的问题
提问者采纳
你的错误提示是拒绝刷入俯迹碘克鄢久碉勋冬魔boot,你没有权限,无法写入boot方法详解第一就是WIPE。有可能是当初没有WIPE干净,有残留,所以刷机后再WIPE一遍。刷机前尽量把内存卡中运行自动生成的文件夹删掉,因为这些文件也可能影响系统的稳定运行。第2就是刷入BOOT.IMG重点方法下面是重点方法2,就是刷入BOOT.IMG。下载adb,之后解压到D盘。把你下载的ROM包解压,提取里面的BOOT.IMG文件,放到adb文件夹里。重启手机,进入fastboot模式(就是按住音量-和开机键,手机左上角出现一堆英文,即代表进入hboot模式;再按电源键,进入fastboot模式)。把手机连电脑,FASTBOOT红字的后面会多出来一个USB字样,这就表示连接成功了。点电脑桌面的【开始】-》【运行】在弹出的框内,输入cmd 回车,会弹出命令提示符的窗口,在提示符下输入d:(回车)在命令提示符窗口输入cd adb(回车);再输入fastboot flash boot boot.img回车;提示回到提示符下就完成了。这就是刷BOOT.IMG的全过程
其他类似问题
uboot的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 s5pv210 uboot移植 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信