xref: /openbmc/u-boot/doc/README.android-fastboot (revision b6dd69a4d6b20862a2075f402f9edfb0de6d14ed)
13aab70afSSebastian SiewiorAndroid Fastboot
23aab70afSSebastian Siewior~~~~~~~~~~~~~~~~
33aab70afSSebastian Siewior
43aab70afSSebastian SiewiorOverview
53aab70afSSebastian Siewior========
63aab70afSSebastian SiewiorThe protocol that is used over USB is described in
73aab70afSSebastian SiewiorREADME.android-fastboot-protocol in same directory.
83aab70afSSebastian Siewior
989792381SDileep KattaThe current implementation is a minimal support of the erase command,the
1089792381SDileep Katta"oem format" command and flash command;it only supports eMMC devices.
113aab70afSSebastian Siewior
123aab70afSSebastian SiewiorClient installation
133aab70afSSebastian Siewior===================
143aab70afSSebastian SiewiorThe counterpart to this gadget is the fastboot client which can
153aab70afSSebastian Siewiorbe found in Android's platform/system/core repository in the fastboot
163aab70afSSebastian Siewiorfolder. It runs on Windows, Linux and even OSX. Linux user are lucky since
173aab70afSSebastian Siewiorthey only need libusb.
183aab70afSSebastian SiewiorWindows users need to bring some time until they have Android SDK (currently
193aab70afSSebastian Siewiorhttp://dl.google.com/android/installer_r12-windows.exe) installed. You
203aab70afSSebastian Siewiorneed to install ADB package which contains the required glue libraries for
213aab70afSSebastian Siewioraccessing USB. Also you need "Google USB driver package" and "SDK platform
223aab70afSSebastian Siewiortools". Once installed the usb driver is placed in your SDK folder under
233aab70afSSebastian Siewiorextras\google\usb_driver. The android_winusb.inf needs a line like
243aab70afSSebastian Siewior
253aab70afSSebastian Siewior   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451&PID_D022
263aab70afSSebastian Siewior
273aab70afSSebastian Siewioreither in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64]
283aab70afSSebastian Siewiorfor 64bit Windows. VID and PID should match whatever the fastboot is
293aab70afSSebastian Siewioradvertising.
303aab70afSSebastian Siewior
313aab70afSSebastian SiewiorBoard specific
323aab70afSSebastian Siewior==============
333aab70afSSebastian SiewiorThe fastboot gadget relies on the USB download gadget, so the following
343aab70afSSebastian Siewioroptions must be configured:
353aab70afSSebastian Siewior
3601acd6abSPaul KocialkowskiCONFIG_USB_GADGET_DOWNLOAD
373aab70afSSebastian SiewiorCONFIG_G_DNL_VENDOR_NUM
383aab70afSSebastian SiewiorCONFIG_G_DNL_PRODUCT_NUM
393aab70afSSebastian SiewiorCONFIG_G_DNL_MANUFACTURER
403aab70afSSebastian Siewior
41183cbff7SBarnes, Clifton ANOTE: The CONFIG_G_DNL_VENDOR_NUM must be one of the numbers supported by
42183cbff7SBarnes, Clifton Athe fastboot client. The list of vendor IDs supported can be found in the
43183cbff7SBarnes, Clifton Afastboot client source code (fastboot.c) mentioned above.
44183cbff7SBarnes, Clifton A
4517da3c0cSPaul KocialkowskiThe fastboot function is enabled by defining CONFIG_USB_FUNCTION_FASTBOOT,
4617da3c0cSPaul KocialkowskiCONFIG_CMD_FASTBOOT and CONFIG_ANDROID_BOOT_IMAGE.
473aab70afSSebastian Siewior
483aab70afSSebastian SiewiorThe fastboot protocol requires a large memory buffer for downloads. This
493aab70afSSebastian Siewiorbuffer should be as large as possible for a platform. The location of the
50a588d99aSPaul Kocialkowskibuffer and size are set with CONFIG_FASTBOOT_BUF_ADDR and
51a588d99aSPaul KocialkowskiCONFIG_FASTBOOT_BUF_SIZE.
523aab70afSSebastian Siewior
538a41802fSMichael ScottFastboot partition aliases can also be defined for devices where GPT
548a41802fSMichael Scottlimitations prevent user-friendly partition names such as "boot", "system"
558a41802fSMichael Scottand "cache".  Or, where the actual partition name doesn't match a standard
568a41802fSMichael Scottpartition name used commonly with fastboot.  Current implentation checks
578a41802fSMichael Scottaliases when accessing partitions by name (flash_write and erase functions).
588a41802fSMichael ScottTo define a partition alias add an environment variable similar to:
598a41802fSMichael Scottfastboot_partition_alias_<alias partition name>=<actual partition name>
608a41802fSMichael ScottExample: fastboot_partition_alias_boot=LNX
618a41802fSMichael Scott
62*b6dd69a4SPetr KulhavyPartition Names
63*b6dd69a4SPetr Kulhavy===============
64*b6dd69a4SPetr KulhavyThe Fastboot implementation in U-boot allows to write images into disk
65*b6dd69a4SPetr Kulhavypartitions (currently on eMMC). Target partitions are referred on the host
66*b6dd69a4SPetr Kulhavycomputer by their names.
67*b6dd69a4SPetr Kulhavy
68*b6dd69a4SPetr KulhavyFor GPT/EFI the respective partition name is used.
69*b6dd69a4SPetr Kulhavy
70*b6dd69a4SPetr KulhavyFor MBR the partitions are referred by generic names according to the
71*b6dd69a4SPetr Kulhavyfollowing schema:
72*b6dd69a4SPetr Kulhavy
73*b6dd69a4SPetr Kulhavy  <device type> <device index letter> <partition index>
74*b6dd69a4SPetr Kulhavy
75*b6dd69a4SPetr KulhavyExample: hda3, sdb1, usbda1
76*b6dd69a4SPetr Kulhavy
77*b6dd69a4SPetr KulhavyThe device type is as follows:
78*b6dd69a4SPetr Kulhavy
79*b6dd69a4SPetr Kulhavy  * IDE, ATAPI and SATA disks: hd
80*b6dd69a4SPetr Kulhavy  * SCSI disks: sd
81*b6dd69a4SPetr Kulhavy  * USB media: usbd
82*b6dd69a4SPetr Kulhavy  * Disk on chip: docd
83*b6dd69a4SPetr Kulhavy  * other: xx
84*b6dd69a4SPetr Kulhavy
85*b6dd69a4SPetr KulhavyThe device index starts from 'a' and refers to the interface (e.g. USB
86*b6dd69a4SPetr Kulhavycontroller, SD/MMC controller) or disk index. The partition index starts
87*b6dd69a4SPetr Kulhavyfrom 1 and describes the partition number on the particular device.
88*b6dd69a4SPetr Kulhavy
89*b6dd69a4SPetr KulhavyWriting Partition Table
90*b6dd69a4SPetr Kulhavy=======================
91*b6dd69a4SPetr KulhavyFastboot also allows to write the partition table to the media. This can be
92*b6dd69a4SPetr Kulhavydone by writing the respective partition table image to a special target
93*b6dd69a4SPetr Kulhavy"gpt" or "mbr". These names can be customized by defining the following
94*b6dd69a4SPetr Kulhavyconfiguration options:
95*b6dd69a4SPetr Kulhavy
96*b6dd69a4SPetr KulhavyCONFIG_FASTBOOT_GPT_NAME
97*b6dd69a4SPetr KulhavyCONFIG_FASTBOOT_MBR_NAME
98*b6dd69a4SPetr Kulhavy
993aab70afSSebastian SiewiorIn Action
1003aab70afSSebastian Siewior=========
1013aab70afSSebastian SiewiorEnter into fastboot by executing the fastboot command in u-boot and you
1023aab70afSSebastian Siewiorshould see:
1033aab70afSSebastian Siewior|GADGET DRIVER: usb_dnl_fastboot
1043aab70afSSebastian Siewior
1053aab70afSSebastian SiewiorOn the client side you can fetch the bootloader version for instance:
1063aab70afSSebastian Siewior|>fastboot getvar bootloader-version
1073aab70afSSebastian Siewior|bootloader-version: U-Boot 2014.04-00005-gd24cabc
1083aab70afSSebastian Siewior|finished. total time: 0.000s
1093aab70afSSebastian Siewior
1103aab70afSSebastian Siewioror initiate a reboot:
1113aab70afSSebastian Siewior|>fastboot reboot
1123aab70afSSebastian Siewior
1133aab70afSSebastian Siewiorand once the client comes back, the board should reset.
1143aab70afSSebastian Siewior
1153aab70afSSebastian SiewiorYou can also specify a kernel image to boot. You have to either specify
1163aab70afSSebastian Siewiorthe an image in Android format _or_ pass a binary kernel and let the
1173aab70afSSebastian Siewiorfastboot client wrap the Android suite around it. On OMAP for instance you
1183aab70afSSebastian Siewiortake zImage kernel and pass it to the fastboot client:
1193aab70afSSebastian Siewior
1203aab70afSSebastian Siewior|>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0
1213aab70afSSebastian Siewior|	mem=128M" boot zImage
1223aab70afSSebastian Siewior|creating boot image...
1233aab70afSSebastian Siewior|creating boot image - 1847296 bytes
1243aab70afSSebastian Siewior|downloading 'boot.img'...
1253aab70afSSebastian Siewior|OKAY [  2.766s]
1263aab70afSSebastian Siewior|booting...
1273aab70afSSebastian Siewior|OKAY [ -0.000s]
1283aab70afSSebastian Siewior|finished. total time: 2.766s
1293aab70afSSebastian Siewior
1303aab70afSSebastian Siewiorand on the gadget side you should see:
1313aab70afSSebastian Siewior|Starting download of 1847296 bytes
1323aab70afSSebastian Siewior|........................................................
1333aab70afSSebastian Siewior|downloading of 1847296 bytes finished
1343aab70afSSebastian Siewior|Booting kernel..
1353aab70afSSebastian Siewior|## Booting Android Image at 0x81000000 ...
1363aab70afSSebastian Siewior|Kernel load addr 0x80008000 size 1801 KiB
1373aab70afSSebastian Siewior|Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
1383aab70afSSebastian Siewior|   Loading Kernel Image ... OK
1393aab70afSSebastian Siewior|OK
1403aab70afSSebastian Siewior|
1413aab70afSSebastian Siewior|Starting kernel ...
142