blob: dea70669f1b2be3b3881c4f669b2ed0ddb217f29 [file] [log] [blame]
Sebastian Siewior9d4471e2014-05-05 15:08:10 -05001Android Fastboot
2~~~~~~~~~~~~~~~~
3
4Overview
5========
6The protocol that is used over USB is described in
7README.android-fastboot-protocol in same directory.
8
Dileep Kattab1228202015-02-17 18:48:23 +05309The current implementation is a minimal support of the erase command,the
10"oem format" command and flash command;it only supports eMMC devices.
Sebastian Siewior9d4471e2014-05-05 15:08:10 -050011
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
Paul Kocialkowski045d6052015-06-12 19:56:58 +020036CONFIG_USB_GADGET_DOWNLOAD
Sebastian Siewior9d4471e2014-05-05 15:08:10 -050037CONFIG_G_DNL_VENDOR_NUM
38CONFIG_G_DNL_PRODUCT_NUM
39CONFIG_G_DNL_MANUFACTURER
40
Barnes, Clifton A1f9f3212014-07-22 11:23:56 -040041NOTE: 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
Paul Kocialkowskid55acc02015-06-12 19:56:59 +020045The fastboot function is enabled by defining CONFIG_USB_FUNCTION_FASTBOOT,
46CONFIG_CMD_FASTBOOT and CONFIG_ANDROID_BOOT_IMAGE.
Sebastian Siewior9d4471e2014-05-05 15:08:10 -050047
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
Paul Kocialkowskif84f0912015-07-20 12:38:22 +020050buffer and size are set with CONFIG_FASTBOOT_BUF_ADDR and
51CONFIG_FASTBOOT_BUF_SIZE.
Sebastian Siewior9d4471e2014-05-05 15:08:10 -050052
Michael Scottced33492015-03-11 10:02:31 -070053Fastboot 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
Petr Kulhavy9f174c92016-09-09 10:27:16 +020062Partition Names
63===============
64The Fastboot implementation in U-boot allows to write images into disk
65partitions (currently on eMMC). Target partitions are referred on the host
66computer by their names.
67
68For GPT/EFI the respective partition name is used.
69
70For MBR the partitions are referred by generic names according to the
71following schema:
72
73 <device type> <device index letter> <partition index>
74
75Example: hda3, sdb1, usbda1
76
77The device type is as follows:
78
79 * IDE, ATAPI and SATA disks: hd
80 * SCSI disks: sd
81 * USB media: usbd
82 * Disk on chip: docd
83 * other: xx
84
85The device index starts from 'a' and refers to the interface (e.g. USB
86controller, SD/MMC controller) or disk index. The partition index starts
87from 1 and describes the partition number on the particular device.
88
89Writing Partition Table
90=======================
91Fastboot also allows to write the partition table to the media. This can be
92done by writing the respective partition table image to a special target
93"gpt" or "mbr". These names can be customized by defining the following
94configuration options:
95
96CONFIG_FASTBOOT_GPT_NAME
97CONFIG_FASTBOOT_MBR_NAME
98
Sebastian Siewior9d4471e2014-05-05 15:08:10 -050099In Action
100=========
101Enter into fastboot by executing the fastboot command in u-boot and you
102should see:
103|GADGET DRIVER: usb_dnl_fastboot
104
105On the client side you can fetch the bootloader version for instance:
106|>fastboot getvar bootloader-version
107|bootloader-version: U-Boot 2014.04-00005-gd24cabc
108|finished. total time: 0.000s
109
110or initiate a reboot:
111|>fastboot reboot
112
113and once the client comes back, the board should reset.
114
115You can also specify a kernel image to boot. You have to either specify
116the an image in Android format _or_ pass a binary kernel and let the
117fastboot client wrap the Android suite around it. On OMAP for instance you
118take zImage kernel and pass it to the fastboot client:
119
120|>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0
121| mem=128M" boot zImage
122|creating boot image...
123|creating boot image - 1847296 bytes
124|downloading 'boot.img'...
125|OKAY [ 2.766s]
126|booting...
127|OKAY [ -0.000s]
128|finished. total time: 2.766s
129
130and on the gadget side you should see:
131|Starting download of 1847296 bytes
132|........................................................
133|downloading of 1847296 bytes finished
134|Booting kernel..
135|## Booting Android Image at 0x81000000 ...
136|Kernel load addr 0x80008000 size 1801 KiB
137|Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
138| Loading Kernel Image ... OK
139|OK
140|
141|Starting kernel ...