Manipulate the non-volatile flash partitions
fastboot [options] [commands]
fastboot is a program used to manipulate (list, install, erase) the non-volatile memory such as flash filesystem partitions on devices that adhere to the fastboot protocol, via a USB connection from a host computer. It requires that the device be started in a boot loader mode with the fastboot protocol enabled. Once connected to the device, the program accepts a specific set of commands sent to it via the USB using the fastboot program on the host.
fastboot is primarily used for installing the operating system binary `images' into the non-volatile flash memory of the devices.
The partition should adhere to a specific layout. Fastboot was designed for use with phones and tablets running the Android operating system.
To allow non-root user access to the devices, one might needed to add udev rules file for the specific device and add the user to the appopriate group (typically the group is named plugdev).
If the device is not connected, certain fastboot commands display the output:
< waiting for the device >
and waits till it detects and establish a fastboot connection with the connected device. Otherwise, it prints a helpful list of commands and switches and exits.
-w
Erase userdata and cache and format, if supported by the partition type.
-u
Do not first erase partition before formatting.
-s device
Specify device serial number or path to device port.
The device serial number can also be set by setting the environment variable ANDROID_SERIAL.
-l
Lists device paths. Works only with the command devices.
-p product
Specify the device product name.
Normally `fastboot' binary is built when building Android from the source using the `Android Open Source Project' (AOSP) repositories. Assuming $aosp is the root of the AOSP source code, the output binaries and images are stored in the $AOSP/out directory. `fastboot' binary lives in `$AOSP/out/host/linux-x86/bin' directory. If run from this directory, the images are looked for in `../../../target/product/$product' directory where $product is specified with the `-p' switch.
If this switch is not set, the environment variable ANDROID_PRODUCT_OUT should be set to the directory containing the binary images.
This switch is generally specified with the flash and flashall commands.
-c commandline
Override linux kernel command line. This switch is typically used along with the command boot. See the EXAMPLES section for a typical usage.
-i VendorID
Specify a custom USB Vendor ID for the device.
-b base_addr
Specify a custom linux kernel base address.
-n pagesize
Specify page size for the flash device. Default value is 2048.
-S size[K|M|G]
Automatically sparse files greater than the specified size. Specify the size as 0 to disable sparse files.
update filename
Reflash the device from the give update file. The filename must be a zip file.
flashall
Reflash boot partition, recovery partition and the system partition.
flash partition [filename]
Write the given file to the specified partition.
erase partition
Erase a flash partition.
format partition
Format a flash partition.
getvar variable
Display a bootloader variable.
boot kernel [ramdisk]
Download and boot kernel.
flash:raw boot kernel [ramdisk]
Create boot image and flash it.
devices
List all connected devices.
continue
Continue with autoboot.
reboot-bootloader
Reboot device into bootloader.
reboot
Reboot the device normally..
help
Show a help message.
ANDROID_PRODUCT_OUT
This variable should be set to the root of the directory where the images for the specific product is stored.
ANDROID_SERIAL
Thie variable can be used to specify the device serial number.
1. Flashing the recovery image: fastboot flash recovery recovery.img 2. Flash the kernel and bootloader: fastboot flash boot boot.img 3. Erase a partition: fastboot erase cache 4. Reboot the phone: fastboot reboot 5. Boot with a custom built kernel and root filesystem (but not write them into the flash memory): fastboot boot linux-2.6/arch/arm/boot/zImage root-image/recovery.img-ramdisk.cpio.gz 6. Format partitions: fastboot format cache fastboot format userdata 7. Flash all partitions at once: fastboot -w flashall 8. Restoring from backed up images in the user's computer:: fastboot erase system fastboot erase data fastboot erase cache and then flash the images (starting with system): fastboot flash system system.img fastboot flash data data.img fastboot flash cache cache.img 9. Boot the phone with a specific linux kernel commandline argument: fastboot -c "console=ttyHSL0,115200,n8" boot boot.img
Make sure that the device is connected and is visible via lsusb. If the device is detected by `lsusb' and `adb devices' output shows `???????????? device', then try reloading udev rules or try disconnecting and connecting the cables.
The command name should have been chosen more carefully to reflect its purpose.
fastboot was written by engineers at Google for the Android project.
Ramakrishnan Muthukrishnan wrote this manual page, originally for the Debian Project, with a lot of suggestions from Raul Miller.