It’s an inevitable part of the Android hacking process that you will ‘soft brick’ your device from time to time. Normally these are pretty trivial problems, the device gets stuck in a boot loop for example. And normally you can fix them by wiping your data and cache and then reflashing your ROM, or just by restoring your Nandroid backup.
But sometimes the problem can be harder to diagnose.Maybe your custom Recovery was accidentally overwritten with the stock one, which has no advanced features. Or maybe you can’t boot into Recovery at all.
Well, there’s still a solution for most devices. It’s called Fastboot. This is a feature of the Android software development (SDK) and enables you to communicate with your device when it is connected to your desktop computer via USB. In Fastboot you can flash a new custom Recovery, or flash a new ROM itself and wipe the device completely and return it to stock if needed.
Fastboot is available on most Android devices, excluding Samsung where it is not implemented. For a Galaxy device you need to use the Odin tool to flash a new ROM or Recovery (the unofficial site samsung-updates.com normally has the latest version available to download). On Nexus and HTC devices Fastboot is an invaluable tool, and can be a phone saver.
Get the SDK
Download the Android SDK from http://developer.android.com/sdk. There are versions for Windows, Mac and Linux so your desktop platform of choice is supported. There’s no need to install the SDK since we’re not using it to develop apps, we simply want to use one of its associated tools.
Boot device to Fastboot
Now boot your device into Fastboot. This is done using the key combination used to boot into Recovery – power and volume down on a Nexus 7, for example. Don’t boot to Recovery, though. Fastboot is either the screen prior to Recovery or available through a separate menu.
Locate Fastboot on desktop
Return to the desktop and locate the Android Software Development Kit folder. We will be using the Fastboot tool which is stored in the platform-tools sub-folder of the Android SDK. To use it first, simply open a command line on Windows or Terminal on Mac.
Check your commands
Double clicking the Fastboot icon in the platform-tools folder will also give you a list of the various commands you can now use. Once you’re more experienced using the tool you will be able to use multiple commands at the same time, adding the various options to configure more powerful functions.
Now change the directory to that of the platform-tools folder in the Android SDK. All you need to do this is type the command cd followed by the full path to the platform-tools folder. For example, cd/Users/name/Desktop/android-sdk-mac_x86/platform-tools. That will change the directory.
Check fastboot mode
Connect your device – already in Fastboot – to your desktop computer via USB. check that the device is recognised by typing fastboot devices in the command line. On Mac and Linux all Fastboot commands need to be preceded by./ (so type ./fastboot devices). Your connected device’s serial number should now be listed.
How to wipe
In some instances if data or other files are causing problems with your Android device you may need to wipe it completely in order to be able to get it working again. Luckily, it’s a really straightforward procedure. To do this type fastboot -w in the terminal window and your device’s storage will be cleared.
Flash a Recovery
To flash a new custom Recovery, first download the recovery image (for example, from www.clockworkmod.com) and then place it in the platform-tools folder for easy access. Begin flashing the Recovery with the command: fastboot flash recovery [recoveryimage.img]. Do not disconnect the device while it is in progress.
Flash a ROM
Once you’ve flashed a custom Recovery you can use that to flash a ROM. Alternatively you can flash through Fastboot. Download the ROM and place it in the platform-tools folder. To start flashing, type fastboot update [romfile.zip]. This will take a few minutes to complete, so do not touch the device while it is working.
Your device may reboot once the flashing process is completed, but if not, you can also reboot via our friend Fastboot. Simply type fastboot reboot and the device will restart. Remember that after flashing a new ROM the first boot may take longer – give it a good ten minutes to allow it to do its thing.
usage: fastboot [ <option> ] <command>
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash 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 bootimage and flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
-w erase userdata and cache (and format
if supported by partition type)
-u do not first erase partition before formatting
-s <specific device> specify device serial number or path to device port
-l with “devices”, lists device paths
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default: 2048
-S <size>[K|M|G] automatically sparse files greater than size. 0 to disable