Fastboot

From Android Wiki
This page uses Creative Commons Licensed content from Wikipedia (view authors).

Fastboot is a communication protocol used primarily with Android devices. It is implemented in a command-line interface tool of the same name and as a mode of the bootloader of Android devices. The tool is included with the Android SDK package and used primarily to modify the flash filesystem via a USB connection from a host computer. It requires that the device be started in Fastboot mode. If the mode is enabled, it will accept a specific set of commands, sent through USB bulk transfers. Fastboot on some devices allows unlocking the bootloader, and subsequently, enables installing custom recovery image and custom ROM on the device. Fastboot does not require USB debugging to be enabled on the device. To use fastboot, a specific combination of keys must be held during boot.

A Nexus 5 (hammerhead) booted into its boot loader, with Android laying on its back with the door open. In this image, Start is selected.

Not all Android devices have fastboot enabled, and Android device manufacturers are allowed to choose if they want to implement fastboot or some other protocol.

Keys pressed[edit | edit source]

The keys that have to be pressed for fastboot differ for various vendors.

  • HTC, Google Pixel, and Xiaomi: Power and volume down
  • Zebra and symbol devices: Right scan/action button
  • Sony: Power and volume up
  • Google Nexus: Power, volume up and volume down

On Samsung devices, (excluding the Nexus S and Galaxy Nexus devices), power, volume down and home has to be pressed for entering ODIN mode. This is a proprietary protocol, and tool, as an alternative to fastboot. The tool has a partial alternative.

A text-based fastboot interface, presumably from a OnePlus 8T device, with Start selected as the option on the top.

Commands[edit | edit source]

Some of the most commonly used fastboot commands include:

  • flash – rewrites a partition with a binary image stored on the host computer.
  • flashing unlock/oem unlock *** – unlocks an OEM locked bootloader for flashing custom/unsigned ROMs. The *** is a device specific unlock key.
  • flashing lock/oem lock *** – locks an OEM unlocked bootloader.
  • erase – erases a specific partition.
  • reboot – reboots the device into either the main operating system, the system recovery partition or back into its boot loader.
  • devices – displays a list of all devices (with the serial number) connected to the host computer.
  • format – formats a specific partition; the file system of the partition must be recognized by the device.
  • oem device-info – checks the bootloader state.
  • getvar all – displays all information about device (IMEI, bootloader version, battery state etc.).

To select boot options in this mode, use the volume up and down keys and select the following with the power key...

Start/Normal Boot - Boots the phone into Android

The string called androidboot.mode= is set to androidboot.mode=normal if this option is selected.

Recovery Mode - Boots the phone into Android Recovery (a.k.a the /recovery partition)

androidboot.mode= is set to androidboot.mode=recovery.

Power off/Shut down - Shuts off the device from Aboot

Restart bootloader - Reboots the phone back into its bootloader, (a.k.a. the command fastboot reboot fastboot)

The next several options are only on certain devices:

BarCode - Shows the barcode of the device

Rescue Mode - Boots into Rescue Mode and waits for commands

Fastboot mode has various interfaces. On some phones, they have a menu where you can select what option you want; on other phones like the Xiaomi phones, they have text like "FASTBOOT" or "FASTBOOT mode...'" On ASUS phones, this is called "CSC FASTBOOT MODE".

The images for fastboot and the initial splash screen before bootanimation.zip (which is the OS's boot logo) are stored in a file located at /dev/block/by-name called logo.img or splash.img.