In this guide we’ll show you the different ways you can flash a ROM or system image to your Android phone or tablet. These include how to flash a custom ROM, how to manually flash an OTA zip file, and how to flash a factory image supplied by your phone’s manufacturer.
With Lollipop beginning to be rolled out to Nexus devices, as well as flagship phones from manufacturers such as Motorola and LG, many users will now be thinking about how they can update their device as quickly as possible.
You can wait for the over the air update to be delivered automatically, of course. But this can take up to a couple of week. If you cannot wait that long, there are other options you can explore.
Three ways to flash
The flexibility and openness of Android means it is possible to manually install and OS update, through a process called flashing. This replaces the entire system partition on your phone with a new one, overwriting all of the original OS files in the process.
There are three ways to do this, and we’ll explore each of them in this feature.
- The first is to flash a factory image. This is the full OS software, officially released by many manufacturers on their websites. By flashing this you can update your device to a newer version of the OS—or re-install the existing OS should you need to. Flashing a factory image will restore your device to its factory conditions.
- The second is to manually flash an over the air zip file. This is the file that your phone checks for and installs when an official OTA update is available. If you don’t want to wait for the notification to hit your phone you can download the OTA file—so long as you have the URL for it—and flash it manually.
- The third method is to flash a custom ROM. For many users this will be used to install a different version of the OS on their phone, or to update a device that is no longer getting OS updates direct from the manufacturer. It also enables you to play with the hundreds of custom ROMs available, including this such as CyanogenMod, Paranoid Android and OmniROM.
Most of these methods require that your phone is rooted. If you’re flashing an official update you will need to disable root through the Superuser app first, otherwise it will fail. You should also keep your phone plugged in, or at least have it fully charged, before you attempt to flash anything.
With that explained, let’s get going.
Flash a factory image
Factory images are released by many manufacturers. They contain the full software in the form it would installed when you first bought your phone.
Not all manufacturers release factory images, but you can find some at the following links:
The instructions for flashing a factory image may differ from one manufacturer to the next. They’re always well sign-posted, though, so be sure to check before you proceed.
Also, you need to ensure you download the correct version for your precise model, which may be listed under a codename rather than the consumer model number (for instance, the Nexus 5 is called hammerhead).
Our guide will focus on the Nexus 5 specifically.
Download the SDK
To begin, download the factory image to your desktop.
Next download and set up the Android SDK. The boot your phone into fast boot. We’ve got a full guide on how to do that. You’ll also need to unlock the bootloader if you haven’t already done so.
Flash the image
Now open a terminal or command line window and change the directory to the one containing your factory image, using the cd command in the terminal window.
Type flash-all to run the flash-all file in the folder you downloaded. The image will now begin being copied and installed on your device. Wait for it to finish then reboot your device.
Note that flashing a factory image will completely wipe your device and return it to a factory-like state. This includes all your data, photos and so on. Make sure you create a backup of all of this, so that you can restore it later.
It is possible to edit the downloaded files to remove the wipe command (-w), but when installing a whole new version of the OS it’s best not to do this.
Flash a factory image without wiping data
Update 14 Nov: A user on reddit, Mikuro, has posted instructions on how you can flash only parts of a factory image, meaning you don’t wipe your data. We’ve tested it and it works. The instructions are for the Nexus 5, but should be applicable to all factory images for Nexus, and possibly other devices too.
I personally don’t use the included shell scripts.
I do it this way:
Edit: You must have the Android SDK installed [or not, I’m told. Just get fastboot somehow]. It comes with the essential fastboot tool, as well as adb.
Expand image-hammerhead-lrx21o.zip Reboot phone to bootloader, connect via USB
fastboot flash bootloader bootloader-hammerhead-hhz12d.img
fastboot flash radio radio-hammerhead-m8974a-22.214.171.124.21.img
fastboot flash boot boot.img
fastboot flash system system.img
Done. I skip data, cache and recovery. If you use or want the stock recovery, flash that, too (I’d rather keep TWRP, myself). Clearing cache might be a good idea, and should be harmless.
These instructions are for Windows. If you’re using fastboot on Mac or Linux you need to precede the fastboot command with ./ (eg. ./fastboot flash boot boot.img)
Manually flash an OTA zip
If you have got the URL for a over the air update you can download the OTA file to your desktop and flash it manually. This way you won’t need to wait for your phone to have the update pushed to it by the manufacturer.
To do this you need to set up the Android SDK once again, as outlined above. Copy the OTA file into the platform-tools folder for easy access, then open a terminal or command line window and change the directory to the location of the file.
Sideload via ADB
Reboot your phone into Recovery. If you’re running the latest version of TWRP Recovery tap Advanced and select ADB Sideload. If not you may need to hold the Volume Up and Power buttons together to see a menu offering an ADB update option.
Connect your device to your desktop. In the terminal window type adb sideload [filename.zip]. The file will now begin flashing to your device, with a progress bar indicating how close it is to completion.
Once it has finished, reboot your device, and your update OS should launch.
Because this is the same update that would be applied automatically by your phone’s manufacturer it will not result in an data loss or wipe your device. That said, it’s always good practice to make a backup first.
Flash a custom ROM
The final method of flashing an update or new OS to your Android device is by flashing a custom ROM.
To do this you will need to have rooted your phone and installed a custom Recovery (this normally happens during the root procedure).
Download the ROM you wish to flash, making sure that it is compatible with your device. Some devices have multiple variants configured for different regions or networks, so double check that you’ve got the right one here, too.
The ROM will download in .zip form. Don’t unzip it. Copy the file into the internal storage on your device.
Flash through Recovery
Shut down your phone or tablet and reboot into recovery mode.
The first thing you should do is create a Nandroid backup, which you will be able to restore easily should there be any problems when flashing the ROM.
Navigate your way to the Backup section in Recovery and create a full backup. It’ll take a while to complete.
Now navigate your way through the menu systems to the Install section, and then locate where you saved the zip file and select it.
Follow the on-screen instructions when prompted, and then finally confirm that you are ready to flash the ROM. Once you begin you won’t be able to stop it.
The first boot after flashing may take a while, so be prepared to leave the phone for a good ten minutes or so while it boots. If ti doesn’t work after that the flash may have failed. Try repeating the process, or restoring your Nandroid to revert your device to its previous state.
The flashing process is relatively painless, but can be daunting the first time, and things can go wrong.
We recommend our guides on rooting Android, using TWRP Recovery, and using Fastboot for a more thorough introduction to flashing an hacking Android. We also take a look at how to solve common flashing problems, including how to unbrick your phone.