Doc: fastboot intro

From CyanogenMod
Jump to: navigation, search

A brief introduction to fastboot

fastboot is a small tool that comes with the Android SDK (software developer kit) that can be used to re-flash partitions on your device. It is an alternative to the recovery mode for doing installations and updates.

Because fastboot mode can start on your device even before Android loads (and can even run when Android isn't installed at all), fastboot mode is useful for updating the firmware quickly, without having to use a recovery mode. In fact, it's frequently the preferred way to initially install the recovery image on many devices. Fastboot can also be used for developer operations like unlocking the bootloader of Google's Nexus devices.

Not all devices support fastboot, but many do.

There are two "sides" to using fastboot-- the computer side and the device side. Typically your device first is connected to your computer via a USB cable. Then you boot to the "fastboot mode" on the device. On your computer, you then run the fastboot tool to issue commands. Please note that fastboot commands will ONLY work while the device is in fastboot mode.

Getting fastboot

See here for instructions on downloading the latest Android SDK, and thus fastboot, for your computer.

Helpful Tip

On some GNU/Linux distributions, like Debian Sid, you can install fastboot just with this command:

sudo apt-get install android-tools-fastboot

Or on Fedora, you can install android-tools package (which contains fastboot) with this command:

sudo yum install android-tools

Running fastboot

Windows

Open a command prompt with Administrator privlidges

Navigate to the directory that contains the fastboot command. If you installed the Android SDK, this will usually be located in <path to SDK>\sdk\platform-tools\fastboot.exe

  • Example of path for Android SDK installed in root C: directory - C:\adt-bundle-windows-x86_64-2013xxxx\sdk\platform-tools

Verify that your phone is in fastboot mode and is being seen by fastboot by issuing fastboot devices. The output should show your device's serial number:

C:\adt-bundle-windows-x86_64-2013xxxx\sdk\platform-tools>fastboot devices

062a032c001025f0s fastboot

The serial number listed should match the serial number displayed on the phone fastboot screen.

If nothing appears, double check your connection. If an error displays, refer to the below sections.

Troubleshooting fastboot

Template:Paths

<waiting for device> errors

If you see <waiting for device> at any point when executing fastboot command, the PC is not configured to use fastboot properly. Most typically, this is because you are not running fastboot with elevated privileges. It may also be that you do not have the drivers correctly installed, which may happen under Windows 8 because of its insistence on signed drivers.

Linux/OSX

Run fastboot as root or with sudo.

Windows

Run fastboot in command prompt as an Administrator.

Make sure the output of fastboot devices returns your device serial number or you will never get past this error message.

If you have verified that you are running fastboot as Administrator and are still receiving <waiting for device>, there may be an issue with the drivers not being installed.

With the phone in fastboot mode and plugged in via USB cable:

  • Open the Devices and Printers menu of the Control Panel.
  • Verify that your phone is showing up as a device. Typically it will show up under the Unspecified section.
  • If the phone is showing up with a yellow exclamation point, then the drivers will need to be manually installed.
    • The Android SDK includes USB drivers under <path to SDK>\sdk\extras\google\usb_driver
  • If the phone does not show up at all, reboot the phone into fastboot mode while the USB cable is still plugged in. If still no luck, try changing USB cables or ports on your computer. Do NOT use a USB hub.

Installing Sony drivers in Windows 8

If you have a Sony device (eg Xperia), you can easily install the drivers for you device by downloading Androxyde's Flashtool from http://www.flashtool.net/. Use the auto-installer in the .../drivers directory.

To install these drivers in Windows 8, you will need to disable driver signing.

Common fastboot commands

fastboot flash recovery recovery.img

fastboot flash boot boot.img

fastboot flash cache cache.img

fastboot flash userdata userdata.img

fastboot flash system system.img

fastboot reboot

fastboot oem unlock (for all Google-branded Nexus devices)

Installing recovery using fastboot

You can use fastboot to install a recovery image to the device.

Installing recovery on the device

  1. Download recovery -- visit Unstable Apps Recovery Downloader to check for the latest version of ClockworkMod recovery (if your device can be found there). Be careful to select the right image!
  2. Connect the device to the computer via USB.
  3. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  4. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  5. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don't see your device serial number, and instead see "<waiting for device>", fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see "no permissions fastboot", make sure your UDEV rules are setup correctly.
  6. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  7. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Alternatives to fastboot

Some Samsung devices use a program called heimdall, which offers functionality similar to fastboot. You can learn more about installing and compiling Heimdall here.