Android Fastboot

Revision as of 15:41, 1 August 2009 by Tim Bird (talk | contribs)
Jump to: navigation, search


Fastboot is the name of a tool used to manipulate the flash partitions of the Android developer phone. It can also boot the phone using a kernel image or root filesystem image which reside on the host machine rather than in the phone flash. In order to use it, it is important to understand the flash partition layout for the ADP1.

The fastboot program works in conjunction with firmware on the phone to read and write the flash partitions. It needs the same USB device setup between the host and the target phone as adb.

Flash partitions

Flash partitions on the ADP1

Partition name Device Size Contents/Notes
splash1 or misc /dev/mtd/mtd0 262K splash screen image. This partition is called 'splash1' by fastboot, but 'misc' by the Linux kernel
recovery /dev/mtd/mtd1 5.2M kernel, initrd with rootfs (for alternate boot)
boot /dev/mtd/mtd2 2.6M kernel, initrd with rootfs (for default boot)
system /dev/mtd/mtd3 70M yaffs2 file system, mounted read-only at /system - has the bulk of the Android system, including system libraries, Dalvik and pre-installed applications.
cache /dev/mtd/mtd4 70M yaffs2 file system, mounted at /cache - only used on G1 for over-the-air updates. This partition can be used to store temporary data.
userdata /dev/mtd/mtd5 78M yaffs2 file system, mounted at /data - contains user-installed applications and data, including customization data

Special boot mode

Phone in fastboot mode

To use fastboot, you have to reboot the phone into the special 'fastboot' mode. Do this by turning off the phone, then booting the phone, holding down the camera button on the side of the phone, while pressing the power button.

You can tell you are in 'fastboot' mode when you see a screen with drawings of 3 Androids riding skateboards, on a white background.

The yellow line in the middle of the screen will say "Serial0" until you plug in the USB cable, and press the "back" key. Once you do this, after a few seconds the yellow line will switch to saying "FASTBOOT".

At this point you are ready to send commands and/or data to the phone using the fastboot program on your host.


The fastboot command line usage is:

$ fastboot -h
usage: fastboot [ <option> ] <command>

  update <filename>                        reflash device from
  flashall                                 flash boot + recovery + system
  flash <partition> [ <filename> ]         write a file to a flash partition
  erase <partition>                        erase a flash partition
  getvar <variable>                        display a bootloader variable
  boot <kernel> [ <ramdisk> ]              download and boot kernel
  flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it
  devices                                  list all connected devices
  reboot                                   reboot device normally
  reboot-bootloader                        reboot device into bootloader
  -w                                       erase userdata and cache
  -s <serial number>                       specify device serial number
  -p <product>                             specify product name
  -c <cmdline>                             override kernel commandline
  -i <vendor id>                           specify a custom USB vendor id

Erase an individual partition

To erase an individual partition, use:

  • fastboot erase <partition>

E x: fastboot erase cache

Write to an individual partition

To write an image file to an individual partition, use:

  • fastboot flash <partition> [ <filename> ]

If writing to the 'splash1' partition, the file needs to be an image file in a special format. See Android Splash Image for details.

If writing to the 'recovery' or 'boot' partitions, the file consists of a Linux kernel and initrd file system image. This can be created with the 'mkbootimg' program.

If writing to the 'system', 'cache', or 'userdata' partitions, the file is a file system image formatted in yaffs2 format.

FIXTHIS - document how to create one of these.

To boot with a host-side kernel image (and rootfs image)

This command allows you to download a kernel image (and optional root filesystem image) and boot the phone with those, instead of using the kernel and rootfs in the boot flash partition. It is very useful while developing a kernel or modifying the rootfs.

  • fastboot boot <kernel> [ <ramdisk> ]
Ex: fastboot boot linux-2.6/arch/arm/boot/zImage root-image/recovery.img-ramdisk.cpio.gz


Good cheat sheet at:

You can download binaries of 'fastboot' from: (see the table about the 1/4 down the page)