README.android-fastboot 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. Android Fastboot
  2. ~~~~~~~~~~~~~~~~
  3. Overview
  4. ========
  5. The protocol that is used over USB is described in
  6. README.android-fastboot-protocol in same directory.
  7. The current implementation is a minimal support of the erase command,the
  8. "oem format" command and flash command;it only supports eMMC devices.
  9. Client installation
  10. ===================
  11. The counterpart to this gadget is the fastboot client which can
  12. be found in Android's platform/system/core repository in the fastboot
  13. folder. It runs on Windows, Linux and even OSX. Linux user are lucky since
  14. they only need libusb.
  15. Windows users need to bring some time until they have Android SDK (currently
  16. http://dl.google.com/android/installer_r12-windows.exe) installed. You
  17. need to install ADB package which contains the required glue libraries for
  18. accessing USB. Also you need "Google USB driver package" and "SDK platform
  19. tools". Once installed the usb driver is placed in your SDK folder under
  20. extras\google\usb_driver. The android_winusb.inf needs a line like
  21. %SingleBootLoaderInterface% = USB_Install, USB\VID_0451&PID_D022
  22. either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64]
  23. for 64bit Windows. VID and PID should match whatever the fastboot is
  24. advertising.
  25. Board specific
  26. ==============
  27. The fastboot gadget relies on the USB download gadget, so the following
  28. options must be configured:
  29. CONFIG_USB_GADGET_DOWNLOAD
  30. CONFIG_G_DNL_VENDOR_NUM
  31. CONFIG_G_DNL_PRODUCT_NUM
  32. CONFIG_G_DNL_MANUFACTURER
  33. NOTE: The CONFIG_G_DNL_VENDOR_NUM must be one of the numbers supported by
  34. the fastboot client. The list of vendor IDs supported can be found in the
  35. fastboot client source code (fastboot.c) mentioned above.
  36. The fastboot function is enabled by defining CONFIG_USB_FUNCTION_FASTBOOT,
  37. CONFIG_CMD_FASTBOOT and CONFIG_ANDROID_BOOT_IMAGE.
  38. The fastboot protocol requires a large memory buffer for downloads. This
  39. buffer should be as large as possible for a platform. The location of the
  40. buffer and size are set with CONFIG_FASTBOOT_BUF_ADDR and
  41. CONFIG_FASTBOOT_BUF_SIZE.
  42. Fastboot partition aliases can also be defined for devices where GPT
  43. limitations prevent user-friendly partition names such as "boot", "system"
  44. and "cache". Or, where the actual partition name doesn't match a standard
  45. partition name used commonly with fastboot. Current implentation checks
  46. aliases when accessing partitions by name (flash_write and erase functions).
  47. To define a partition alias add an environment variable similar to:
  48. fastboot_partition_alias_<alias partition name>=<actual partition name>
  49. Example: fastboot_partition_alias_boot=LNX
  50. Partition Names
  51. ===============
  52. The Fastboot implementation in U-boot allows to write images into disk
  53. partitions (currently on eMMC). Target partitions are referred on the host
  54. computer by their names.
  55. For GPT/EFI the respective partition name is used.
  56. For MBR the partitions are referred by generic names according to the
  57. following schema:
  58. <device type> <device index letter> <partition index>
  59. Example: hda3, sdb1, usbda1
  60. The device type is as follows:
  61. * IDE, ATAPI and SATA disks: hd
  62. * SCSI disks: sd
  63. * USB media: usbd
  64. * MMC and SD cards: mmcsd
  65. * Disk on chip: docd
  66. * other: xx
  67. The device index starts from 'a' and refers to the interface (e.g. USB
  68. controller, SD/MMC controller) or disk index. The partition index starts
  69. from 1 and describes the partition number on the particular device.
  70. Writing Partition Table
  71. =======================
  72. Fastboot also allows to write the partition table to the media. This can be
  73. done by writing the respective partition table image to a special target
  74. "gpt" or "mbr". These names can be customized by defining the following
  75. configuration options:
  76. CONFIG_FASTBOOT_GPT_NAME
  77. CONFIG_FASTBOOT_MBR_NAME
  78. In Action
  79. =========
  80. Enter into fastboot by executing the fastboot command in u-boot and you
  81. should see:
  82. |GADGET DRIVER: usb_dnl_fastboot
  83. On the client side you can fetch the bootloader version for instance:
  84. |>fastboot getvar bootloader-version
  85. |bootloader-version: U-Boot 2014.04-00005-gd24cabc
  86. |finished. total time: 0.000s
  87. or initiate a reboot:
  88. |>fastboot reboot
  89. and once the client comes back, the board should reset.
  90. You can also specify a kernel image to boot. You have to either specify
  91. the an image in Android format _or_ pass a binary kernel and let the
  92. fastboot client wrap the Android suite around it. On OMAP for instance you
  93. take zImage kernel and pass it to the fastboot client:
  94. |>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0
  95. | mem=128M" boot zImage
  96. |creating boot image...
  97. |creating boot image - 1847296 bytes
  98. |downloading 'boot.img'...
  99. |OKAY [ 2.766s]
  100. |booting...
  101. |OKAY [ -0.000s]
  102. |finished. total time: 2.766s
  103. and on the gadget side you should see:
  104. |Starting download of 1847296 bytes
  105. |........................................................
  106. |downloading of 1847296 bytes finished
  107. |Booting kernel..
  108. |## Booting Android Image at 0x81000000 ...
  109. |Kernel load addr 0x80008000 size 1801 KiB
  110. |Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
  111. | Loading Kernel Image ... OK
  112. |OK
  113. |
  114. |Starting kernel ...