xref: /openbmc/u-boot/doc/README.android-fastboot (revision 8a41802f21cc270cb00ac7dc1263a4c136c9a31c)
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
363aab70afSSebastian SiewiorCONFIG_USBDOWNLOAD_GADGET
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
453aab70afSSebastian SiewiorThe fastboot function is enabled by defining CONFIG_CMD_FASTBOOT and
463aab70afSSebastian SiewiorCONFIG_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
503aab70afSSebastian Siewiorbuffer and size are set with CONFIG_USB_FASTBOOT_BUF_ADDR and
513aab70afSSebastian SiewiorCONFIG_USB_FASTBOOT_BUF_SIZE.
523aab70afSSebastian Siewior
53*8a41802fSMichael ScottFastboot partition aliases can also be defined for devices where GPT
54*8a41802fSMichael Scottlimitations prevent user-friendly partition names such as "boot", "system"
55*8a41802fSMichael Scottand "cache".  Or, where the actual partition name doesn't match a standard
56*8a41802fSMichael Scottpartition name used commonly with fastboot.  Current implentation checks
57*8a41802fSMichael Scottaliases when accessing partitions by name (flash_write and erase functions).
58*8a41802fSMichael ScottTo define a partition alias add an environment variable similar to:
59*8a41802fSMichael Scottfastboot_partition_alias_<alias partition name>=<actual partition name>
60*8a41802fSMichael ScottExample: fastboot_partition_alias_boot=LNX
61*8a41802fSMichael Scott
623aab70afSSebastian SiewiorIn Action
633aab70afSSebastian Siewior=========
643aab70afSSebastian SiewiorEnter into fastboot by executing the fastboot command in u-boot and you
653aab70afSSebastian Siewiorshould see:
663aab70afSSebastian Siewior|GADGET DRIVER: usb_dnl_fastboot
673aab70afSSebastian Siewior
683aab70afSSebastian SiewiorOn the client side you can fetch the bootloader version for instance:
693aab70afSSebastian Siewior|>fastboot getvar bootloader-version
703aab70afSSebastian Siewior|bootloader-version: U-Boot 2014.04-00005-gd24cabc
713aab70afSSebastian Siewior|finished. total time: 0.000s
723aab70afSSebastian Siewior
733aab70afSSebastian Siewioror initiate a reboot:
743aab70afSSebastian Siewior|>fastboot reboot
753aab70afSSebastian Siewior
763aab70afSSebastian Siewiorand once the client comes back, the board should reset.
773aab70afSSebastian Siewior
783aab70afSSebastian SiewiorYou can also specify a kernel image to boot. You have to either specify
793aab70afSSebastian Siewiorthe an image in Android format _or_ pass a binary kernel and let the
803aab70afSSebastian Siewiorfastboot client wrap the Android suite around it. On OMAP for instance you
813aab70afSSebastian Siewiortake zImage kernel and pass it to the fastboot client:
823aab70afSSebastian Siewior
833aab70afSSebastian Siewior|>fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0
843aab70afSSebastian Siewior|	mem=128M" boot zImage
853aab70afSSebastian Siewior|creating boot image...
863aab70afSSebastian Siewior|creating boot image - 1847296 bytes
873aab70afSSebastian Siewior|downloading 'boot.img'...
883aab70afSSebastian Siewior|OKAY [  2.766s]
893aab70afSSebastian Siewior|booting...
903aab70afSSebastian Siewior|OKAY [ -0.000s]
913aab70afSSebastian Siewior|finished. total time: 2.766s
923aab70afSSebastian Siewior
933aab70afSSebastian Siewiorand on the gadget side you should see:
943aab70afSSebastian Siewior|Starting download of 1847296 bytes
953aab70afSSebastian Siewior|........................................................
963aab70afSSebastian Siewior|downloading of 1847296 bytes finished
973aab70afSSebastian Siewior|Booting kernel..
983aab70afSSebastian Siewior|## Booting Android Image at 0x81000000 ...
993aab70afSSebastian Siewior|Kernel load addr 0x80008000 size 1801 KiB
1003aab70afSSebastian Siewior|Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
1013aab70afSSebastian Siewior|   Loading Kernel Image ... OK
1023aab70afSSebastian Siewior|OK
1033aab70afSSebastian Siewior|
1043aab70afSSebastian Siewior|Starting kernel ...
105