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