1*3aab70afSSebastian SiewiorFastBoot Version 0.4 2*3aab70afSSebastian Siewior---------------------- 3*3aab70afSSebastian Siewior 4*3aab70afSSebastian SiewiorThe fastboot protocol is a mechanism for communicating with bootloaders 5*3aab70afSSebastian Siewiorover USB. It is designed to be very straightforward to implement, to 6*3aab70afSSebastian Siewiorallow it to be used across a wide range of devices and from hosts running 7*3aab70afSSebastian SiewiorLinux, Windows, or OSX. 8*3aab70afSSebastian Siewior 9*3aab70afSSebastian Siewior 10*3aab70afSSebastian SiewiorBasic Requirements 11*3aab70afSSebastian Siewior------------------ 12*3aab70afSSebastian Siewior 13*3aab70afSSebastian Siewior* Two bulk endpoints (in, out) are required 14*3aab70afSSebastian Siewior* Max packet size must be 64 bytes for full-speed and 512 bytes for 15*3aab70afSSebastian Siewior high-speed USB 16*3aab70afSSebastian Siewior* The protocol is entirely host-driven and synchronous (unlike the 17*3aab70afSSebastian Siewior multi-channel, bi-directional, asynchronous ADB protocol) 18*3aab70afSSebastian Siewior 19*3aab70afSSebastian Siewior 20*3aab70afSSebastian SiewiorTransport and Framing 21*3aab70afSSebastian Siewior--------------------- 22*3aab70afSSebastian Siewior 23*3aab70afSSebastian Siewior1. Host sends a command, which is an ascii string in a single 24*3aab70afSSebastian Siewior packet no greater than 64 bytes. 25*3aab70afSSebastian Siewior 26*3aab70afSSebastian Siewior2. Client response with a single packet no greater than 64 bytes. 27*3aab70afSSebastian Siewior The first four bytes of the response are "OKAY", "FAIL", "DATA", 28*3aab70afSSebastian Siewior or "INFO". Additional bytes may contain an (ascii) informative 29*3aab70afSSebastian Siewior message. 30*3aab70afSSebastian Siewior 31*3aab70afSSebastian Siewior a. INFO -> the remaining 60 bytes are an informative message 32*3aab70afSSebastian Siewior (providing progress or diagnostic messages). They should 33*3aab70afSSebastian Siewior be displayed and then step #2 repeats 34*3aab70afSSebastian Siewior 35*3aab70afSSebastian Siewior b. FAIL -> the requested command failed. The remaining 60 bytes 36*3aab70afSSebastian Siewior of the response (if present) provide a textual failure message 37*3aab70afSSebastian Siewior to present to the user. Stop. 38*3aab70afSSebastian Siewior 39*3aab70afSSebastian Siewior c. OKAY -> the requested command completed successfully. Go to #5 40*3aab70afSSebastian Siewior 41*3aab70afSSebastian Siewior d. DATA -> the requested command is ready for the data phase. 42*3aab70afSSebastian Siewior A DATA response packet will be 12 bytes long, in the form of 43*3aab70afSSebastian Siewior DATA00000000 where the 8 digit hexidecimal number represents 44*3aab70afSSebastian Siewior the total data size to transfer. 45*3aab70afSSebastian Siewior 46*3aab70afSSebastian Siewior3. Data phase. Depending on the command, the host or client will 47*3aab70afSSebastian Siewior send the indicated amount of data. Short packets are always 48*3aab70afSSebastian Siewior acceptable and zero-length packets are ignored. This phase continues 49*3aab70afSSebastian Siewior until the client has sent or received the number of bytes indicated 50*3aab70afSSebastian Siewior in the "DATA" response above. 51*3aab70afSSebastian Siewior 52*3aab70afSSebastian Siewior4. Client responds with a single packet no greater than 64 bytes. 53*3aab70afSSebastian Siewior The first four bytes of the response are "OKAY", "FAIL", or "INFO". 54*3aab70afSSebastian Siewior Similar to #2: 55*3aab70afSSebastian Siewior 56*3aab70afSSebastian Siewior a. INFO -> display the remaining 60 bytes and return to #4 57*3aab70afSSebastian Siewior 58*3aab70afSSebastian Siewior b. FAIL -> display the remaining 60 bytes (if present) as a failure 59*3aab70afSSebastian Siewior reason and consider the command failed. Stop. 60*3aab70afSSebastian Siewior 61*3aab70afSSebastian Siewior c. OKAY -> success. Go to #5 62*3aab70afSSebastian Siewior 63*3aab70afSSebastian Siewior5. Success. Stop. 64*3aab70afSSebastian Siewior 65*3aab70afSSebastian Siewior 66*3aab70afSSebastian SiewiorExample Session 67*3aab70afSSebastian Siewior--------------- 68*3aab70afSSebastian Siewior 69*3aab70afSSebastian SiewiorHost: "getvar:version" request version variable 70*3aab70afSSebastian Siewior 71*3aab70afSSebastian SiewiorClient: "OKAY0.4" return version "0.4" 72*3aab70afSSebastian Siewior 73*3aab70afSSebastian SiewiorHost: "getvar:nonexistant" request some undefined variable 74*3aab70afSSebastian Siewior 75*3aab70afSSebastian SiewiorClient: "OKAY" return value "" 76*3aab70afSSebastian Siewior 77*3aab70afSSebastian SiewiorHost: "download:00001234" request to send 0x1234 bytes of data 78*3aab70afSSebastian Siewior 79*3aab70afSSebastian SiewiorClient: "DATA00001234" ready to accept data 80*3aab70afSSebastian Siewior 81*3aab70afSSebastian SiewiorHost: < 0x1234 bytes > send data 82*3aab70afSSebastian Siewior 83*3aab70afSSebastian SiewiorClient: "OKAY" success 84*3aab70afSSebastian Siewior 85*3aab70afSSebastian SiewiorHost: "flash:bootloader" request to flash the data to the bootloader 86*3aab70afSSebastian Siewior 87*3aab70afSSebastian SiewiorClient: "INFOerasing flash" indicate status / progress 88*3aab70afSSebastian Siewior "INFOwriting flash" 89*3aab70afSSebastian Siewior "OKAY" indicate success 90*3aab70afSSebastian Siewior 91*3aab70afSSebastian SiewiorHost: "powerdown" send a command 92*3aab70afSSebastian Siewior 93*3aab70afSSebastian SiewiorClient: "FAILunknown command" indicate failure 94*3aab70afSSebastian Siewior 95*3aab70afSSebastian Siewior 96*3aab70afSSebastian SiewiorCommand Reference 97*3aab70afSSebastian Siewior----------------- 98*3aab70afSSebastian Siewior 99*3aab70afSSebastian Siewior* Command parameters are indicated by printf-style escape sequences. 100*3aab70afSSebastian Siewior 101*3aab70afSSebastian Siewior* Commands are ascii strings and sent without the quotes (which are 102*3aab70afSSebastian Siewior for illustration only here) and without a trailing 0 byte. 103*3aab70afSSebastian Siewior 104*3aab70afSSebastian Siewior* Commands that begin with a lowercase letter are reserved for this 105*3aab70afSSebastian Siewior specification. OEM-specific commands should not begin with a 106*3aab70afSSebastian Siewior lowercase letter, to prevent incompatibilities with future specs. 107*3aab70afSSebastian Siewior 108*3aab70afSSebastian Siewior "getvar:%s" Read a config/version variable from the bootloader. 109*3aab70afSSebastian Siewior The variable contents will be returned after the 110*3aab70afSSebastian Siewior OKAY response. 111*3aab70afSSebastian Siewior 112*3aab70afSSebastian Siewior "download:%08x" Write data to memory which will be later used 113*3aab70afSSebastian Siewior by "boot", "ramdisk", "flash", etc. The client 114*3aab70afSSebastian Siewior will reply with "DATA%08x" if it has enough 115*3aab70afSSebastian Siewior space in RAM or "FAIL" if not. The size of 116*3aab70afSSebastian Siewior the download is remembered. 117*3aab70afSSebastian Siewior 118*3aab70afSSebastian Siewior "verify:%08x" Send a digital signature to verify the downloaded 119*3aab70afSSebastian Siewior data. Required if the bootloader is "secure" 120*3aab70afSSebastian Siewior otherwise "flash" and "boot" will be ignored. 121*3aab70afSSebastian Siewior 122*3aab70afSSebastian Siewior "flash:%s" Write the previously downloaded image to the 123*3aab70afSSebastian Siewior named partition (if possible). 124*3aab70afSSebastian Siewior 125*3aab70afSSebastian Siewior "erase:%s" Erase the indicated partition (clear to 0xFFs) 126*3aab70afSSebastian Siewior 127*3aab70afSSebastian Siewior "boot" The previously downloaded data is a boot.img 128*3aab70afSSebastian Siewior and should be booted according to the normal 129*3aab70afSSebastian Siewior procedure for a boot.img 130*3aab70afSSebastian Siewior 131*3aab70afSSebastian Siewior "continue" Continue booting as normal (if possible) 132*3aab70afSSebastian Siewior 133*3aab70afSSebastian Siewior "reboot" Reboot the device. 134*3aab70afSSebastian Siewior 135*3aab70afSSebastian Siewior "reboot-bootloader" Reboot back into the bootloader. 136*3aab70afSSebastian Siewior Useful for upgrade processes that require upgrading 137*3aab70afSSebastian Siewior the bootloader and then upgrading other partitions 138*3aab70afSSebastian Siewior using the new bootloader. 139*3aab70afSSebastian Siewior 140*3aab70afSSebastian Siewior "powerdown" Power off the device. 141*3aab70afSSebastian Siewior 142*3aab70afSSebastian Siewior 143*3aab70afSSebastian Siewior 144*3aab70afSSebastian SiewiorClient Variables 145*3aab70afSSebastian Siewior---------------- 146*3aab70afSSebastian Siewior 147*3aab70afSSebastian SiewiorThe "getvar:%s" command is used to read client variables which 148*3aab70afSSebastian Siewiorrepresent various information about the device and the software 149*3aab70afSSebastian Siewioron it. 150*3aab70afSSebastian Siewior 151*3aab70afSSebastian SiewiorThe various currently defined names are: 152*3aab70afSSebastian Siewior 153*3aab70afSSebastian Siewior version Version of FastBoot protocol supported. 154*3aab70afSSebastian Siewior It should be "0.3" for this document. 155*3aab70afSSebastian Siewior 156*3aab70afSSebastian Siewior version-bootloader Version string for the Bootloader. 157*3aab70afSSebastian Siewior 158*3aab70afSSebastian Siewior version-baseband Version string of the Baseband Software 159*3aab70afSSebastian Siewior 160*3aab70afSSebastian Siewior product Name of the product 161*3aab70afSSebastian Siewior 162*3aab70afSSebastian Siewior serialno Product serial number 163*3aab70afSSebastian Siewior 164*3aab70afSSebastian Siewior secure If the value is "yes", this is a secure 165*3aab70afSSebastian Siewior bootloader requiring a signature before 166*3aab70afSSebastian Siewior it will install or boot images. 167*3aab70afSSebastian Siewior 168*3aab70afSSebastian SiewiorNames starting with a lowercase character are reserved by this 169*3aab70afSSebastian Siewiorspecification. OEM-specific names should not start with lowercase 170*3aab70afSSebastian Siewiorcharacters. 171