Sebastian Siewior | 9d4471e | 2014-05-05 15:08:10 -0500 | [diff] [blame^] | 1 | Android Fastboot |
| 2 | ~~~~~~~~~~~~~~~~ |
| 3 | |
| 4 | Overview |
| 5 | ======== |
| 6 | The protocol that is used over USB is described in |
| 7 | README.android-fastboot-protocol in same directory. |
| 8 | |
| 9 | The current implementation does not yet support the flash and erase |
| 10 | commands. |
| 11 | |
| 12 | Client installation |
| 13 | =================== |
| 14 | The counterpart to this gadget is the fastboot client which can |
| 15 | be found in Android's platform/system/core repository in the fastboot |
| 16 | folder. It runs on Windows, Linux and even OSX. Linux user are lucky since |
| 17 | they only need libusb. |
| 18 | Windows users need to bring some time until they have Android SDK (currently |
| 19 | http://dl.google.com/android/installer_r12-windows.exe) installed. You |
| 20 | need to install ADB package which contains the required glue libraries for |
| 21 | accessing USB. Also you need "Google USB driver package" and "SDK platform |
| 22 | tools". Once installed the usb driver is placed in your SDK folder under |
| 23 | extras\google\usb_driver. The android_winusb.inf needs a line like |
| 24 | |
| 25 | %SingleBootLoaderInterface% = USB_Install, USB\VID_0451&PID_D022 |
| 26 | |
| 27 | either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64] |
| 28 | for 64bit Windows. VID and PID should match whatever the fastboot is |
| 29 | advertising. |
| 30 | |
| 31 | Board specific |
| 32 | ============== |
| 33 | The fastboot gadget relies on the USB download gadget, so the following |
| 34 | options must be configured: |
| 35 | |
| 36 | CONFIG_USBDOWNLOAD_GADGET |
| 37 | CONFIG_G_DNL_VENDOR_NUM |
| 38 | CONFIG_G_DNL_PRODUCT_NUM |
| 39 | CONFIG_G_DNL_MANUFACTURER |
| 40 | |
| 41 | The fastboot function is enabled by defining CONFIG_CMD_FASTBOOT and |
| 42 | CONFIG_ANDROID_BOOT_IMAGE. |
| 43 | |
| 44 | The fastboot protocol requires a large memory buffer for downloads. This |
| 45 | buffer should be as large as possible for a platform. The location of the |
| 46 | buffer and size are set with CONFIG_USB_FASTBOOT_BUF_ADDR and |
| 47 | CONFIG_USB_FASTBOOT_BUF_SIZE. |
| 48 | |
| 49 | In Action |
| 50 | ========= |
| 51 | Enter into fastboot by executing the fastboot command in u-boot and you |
| 52 | should see: |
| 53 | |GADGET DRIVER: usb_dnl_fastboot |
| 54 | |
| 55 | On the client side you can fetch the bootloader version for instance: |
| 56 | |>fastboot getvar bootloader-version |
| 57 | |bootloader-version: U-Boot 2014.04-00005-gd24cabc |
| 58 | |finished. total time: 0.000s |
| 59 | |
| 60 | or initiate a reboot: |
| 61 | |>fastboot reboot |
| 62 | |
| 63 | and once the client comes back, the board should reset. |
| 64 | |
| 65 | You can also specify a kernel image to boot. You have to either specify |
| 66 | the an image in Android format _or_ pass a binary kernel and let the |
| 67 | fastboot client wrap the Android suite around it. On OMAP for instance you |
| 68 | take zImage kernel and pass it to the fastboot client: |
| 69 | |
| 70 | |>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0 |
| 71 | | mem=128M" boot zImage |
| 72 | |creating boot image... |
| 73 | |creating boot image - 1847296 bytes |
| 74 | |downloading 'boot.img'... |
| 75 | |OKAY [ 2.766s] |
| 76 | |booting... |
| 77 | |OKAY [ -0.000s] |
| 78 | |finished. total time: 2.766s |
| 79 | |
| 80 | and on the gadget side you should see: |
| 81 | |Starting download of 1847296 bytes |
| 82 | |........................................................ |
| 83 | |downloading of 1847296 bytes finished |
| 84 | |Booting kernel.. |
| 85 | |## Booting Android Image at 0x81000000 ... |
| 86 | |Kernel load addr 0x80008000 size 1801 KiB |
| 87 | |Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M |
| 88 | | Loading Kernel Image ... OK |
| 89 | |OK |
| 90 | | |
| 91 | |Starting kernel ... |