四极管:FastBoot 协议源码

来源:互联网 发布:37周胎儿b超数据 编辑:程序博客网 时间:2024/06/05 03:12


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.




Basic Requirements
------------------


* Two bulk endpoints (in, out) are required
* Max packet size must be 64 bytes for full-speed and 512 bytes for 
  high-speed USB
* 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.


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.


   a. INFO -> the remaining 60 bytes are an informative message
      (providing progress or diagnostic messages).  They should 
      be displayed and then step #2 repeats


   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.


   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
      DATA00000000 where the 8 digit hexidecimal number represents
      the total data size to transfer.


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:00001234"     request to send 0x1234 bytes of data


Client:  "DATA00001234"          ready to accept data


Host:    < 0x1234 bytes >        send data


Client:  "OKAY"                  success


Host:    "flash:bootloader"      request to flash the data to the bootloader


Client:  "INFOerasing flash"     indicate status / progress
         "INFOwriting flash"
         "OKAY"                  indicate success


Host:    "powerdown"             send a command


Client:  "FAILunknown 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.


* 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.


 "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
on it.


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.

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 苹果hom键不灵了怎么办 平板电脑home键发烫怎么办 华为平板无法输入资料怎么办 安卓平板没声音怎么办? 平果手机充不了电怎么办 苹果6s用电太快怎么办 平板充不起电了怎么办 日本买的电器国内售后怎么办 海淘地址试投不成功怎么办 怀孕了吐得厉害怎么办 玩网页游戏好卡怎么办 网页游戏占cpu高怎么办 微信有余额绑定其他名下怎么办 银行卡绑定支付余额不对怎么办 可乐机不制冷了怎么办 被淘宝卖家威胁怎么办 征信不好想贷款怎么办 急用钱征信不好怎么办 急用钱逾期不还怎么办 急用钱借款不还怎么办 做b超按压疼痛怎么办 做b超没有尿怎么办 b超憋不到尿怎么办 做b超前没有尿意怎么办 肝胆b超前喝水了怎么办 肝胆彩超喝水了怎么办 胆囊b超喝了水怎么办 系统b超照不到怎么办 思维彩超宝宝不动怎么办 怀孕七个月胎儿缺氧怎么办 怀孕29周小孩偏小怎么办 孕29周胎儿臀位怎么办 刚怀孕有囊肿该怎么办 食杏中毒怎么办吃什么 猫吃了扁桃仁怎么办 夏天来了??点狐臭怎么办? 我有一小点狐臭怎么办 淘客网站被微信屏蔽怎么办 微信老是屏蔽网站怎么办 华帝售后没人理怎么办 新开的网店没生意怎么办