LinuxCommandLibrary

fastboot

Flash images to Android devices

TLDR

Unlock the bootloader

$ fastboot oem unlock
copy

Relock the bootloader
$ fastboot oem lock
copy

Reboot the device from fastboot mode into fastboot mode again
$ fastboot reboot bootloader
copy

Flash a given image
$ fastboot flash [path/to/file.img]
copy

Flash a custom recovery image
$ fastboot flash recovery [path/to/file.img]
copy

List connected devices
$ fastboot devices
copy

Display all information of a device
$ fastboot getvar all
copy

SYNOPSIS

fastboot [options] command [arguments]

Common commands:
fastboot flash <partition> <[file]>
fastboot boot <kernel_image> [ramdisk_image]
fastboot erase <partition>
fastboot reboot [bootloader]
fastboot devices
fastboot getvar <variable>
fastboot oem ...

PARAMETERS

flash
    Writes the specified binary to the on the device. E.g., 'fastboot flash system system.img'.

boot [ramdisk_image]
    Boots the device using the provided kernel and optional ramdisk image, without permanently flashing it. Useful for testing custom recoveries or kernels.

erase
    Erases the contents of the specified on the device.

reboot [bootloader]
    Reboots the device. If 'bootloader' is specified, it reboots the device directly back into fastboot mode.

devices [-l]
    Lists all connected fastboot devices. The '-l' option provides a more verbose list with device paths.

getvar
    Reads and displays the value of a bootloader variable, such as 'version-bootloader' or 'product'.

oem
    Executes an OEM (Original Equipment Manufacturer) specific command. Commands and their functionalities vary significantly by device manufacturer.

flashing unlock / flashing lock
    Commands to unlock or relock the device's bootloader. Unlocking typically performs a factory reset, wiping all user data, and allows flashing unsigned images.

-w
    Wipes (erases) the 'userdata' and 'cache' partitions on the device, equivalent to a factory reset.

-s
    Specifies the device by its unique serial number when multiple fastboot devices are connected, ensuring commands are sent to the correct device.

DESCRIPTION

fastboot is a powerful command-line tool, part of the Android SDK Platform-Tools, that allows communication with an Android device when it is in bootloader mode (also known as fastboot mode). It's primarily used for flashing images (like custom ROMs, kernels, or recovery partitions) to the device's flash memory, unlocking or relocking the bootloader, and erasing partitions. Unlike adb, which interacts with a running Android system, fastboot operates at a lower level, making it essential for deep device customization, recovery from software issues, or development. It requires specific drivers on the host computer and the device to be connected via USB. Its capabilities are crucial for advanced users, developers, and for restoring devices to factory default images.

CAVEATS

Improper use of fastboot, especially flashing incorrect images or manipulating critical partitions, can permanently damage (brick) your device. Unlocking the bootloader typically performs a factory reset, wiping all user data. OEM-specific commands and procedures can vary significantly between device manufacturers and models. Ensure correct drivers are installed on your host machine for proper device recognition.

PREREQUISITES FOR USE

Before using fastboot, ensure you have the Android SDK Platform-Tools installed on your computer, appropriate USB drivers for your Android device, and that your device is booted into fastboot mode. This mode is typically accessed by holding specific button combinations during startup or via 'adb reboot bootloader' when the device is running Android.

HISTORY

fastboot was developed by Google as an integral part of the Android SDK Platform-Tools. It emerged as a low-level protocol for flashing and device management, complementing adb. Its development has been closely tied to the evolution of the Android ecosystem, providing a crucial interface for developers and advanced users to bypass the Android operating system and interact directly with the device's bootloader. It's continuously maintained and updated alongside new Android versions.

SEE ALSO

adb(1)

Copied to clipboard