0% found this document useful (0 votes)
297 views7 pages

How To Flash A Nexus 5 (Or 4) With A Factory Image

This document provides step-by-step instructions for flashing a factory image onto a Nexus 5 or 4 device to install the latest software version. It warns to read all instructions fully before proceeding and not to interrupt the flashing process. The steps include downloading factory image files and USB drivers, putting the device into fastboot mode, and using fastboot commands to flash partitions individually. Care is advised to avoid issues and check each step completes successfully.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
297 views7 pages

How To Flash A Nexus 5 (Or 4) With A Factory Image

This document provides step-by-step instructions for flashing a factory image onto a Nexus 5 or 4 device to install the latest software version. It warns to read all instructions fully before proceeding and not to interrupt the flashing process. The steps include downloading factory image files and USB drivers, putting the device into fastboot mode, and using fastboot commands to flash partitions individually. Care is advised to avoid issues and check each step completes successfully.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

How To Flash A Nexus 5 (or 4) With A Factory Image

Here are the steps needed to flash a factory image on a Nexus 5 (or 4). It may appear rather long but, in
an effort to make it as clear as possible to those who may be technically challenged, there are lots of
screen shots that take up a fair bit of space.

WARNING: Read this document completely from start to finish before trying to perform this
procedure. If you are uncomfortable with any of the steps, seek out the assistance of someone
with the skills to perform them. If you decide to proceed, look at the results of each step. If
something doesn’t seem right, do not proceed on blindly. Back up and recheck or seek
clarification in order to avoid a catastrophe. I have tried to be as thorough as possible;
however, you proceed further at your own risk!

I will assume that the computer being used is a Windows PC running 10. It would make this document
even longer than it currently is if I were to try to cover doing the process from a computer running Mac
and various Linux distributions. If you have one of these other devices, you hopefully are aware of how to
make adjustments for the differences.

I will be focusing on flashing a Nexus 5 to version 6.0.1 (M4B30X) as this is the latest version applicable to
the Nexus 5 device. (If you have a Nexus 4 make adjustments as needed to the files and filenames as
indicated – 5.1.1 LMY48T is the last release).

Flashing a device can take time, depending on the amount of data to be written. However, no flashing
operation should take more than 30 minutes to complete. Keeping this upper limit in mind, be patient
and:

Rule #1: Never interrupt a Nexus flashing procedure.

Also be sure that your battery is more than 50% or better, and that your Nexus is connected to a power
source before performing any update. Loss of power during the update process can have the same
negative effects as not being patient.

Rule #2: Ensure your Nexus has sufficient power before initiating any update.

Phase 1: Preparations

Before flashing, a number of preparatory steps are needed, like getting the tools and files you will need on
your computer.

1.1 In order to flash a Factory Image, you need a tool called fastboot.exe. It is usually packed
together with another tool called adb.exe, but all we really need is fastboot.exe. The easiest way to get
this utility is to download and install it. Use this guide to get fastboot and adb installed on your system.

Note: USB debugging is not required to be enabled as only the fastboot.exe utility will be used.

1 of 7
Techno Bill
2016-12-06
1.2 Download the Factory Image. Factory Images for the Nexus 5 are located here. The latest one for
Nexus 5 is located here. (The latest one for Nexus 4 is located here.) For now store this in a different
working directory. I will be using c:\Nexus.

1.3 Extract the files from the Factory Image. Using Windows Explorer go to the directory c:\Nexus.
Right click on the entry for hammerhead-m4b30z-factory-625c027b.zip, drag the mouse down to Extract
All, and left click to select it. Then click on Browse, find the c:\Nexus folder, then click Select Folder
followed by Extract. This will extract a directory named hammerhead- m4b30z (for Nexus 4, it is occam-
lmy48t) from the zip file. Use Windows Explorer to go to this directory in c:\Nexus.

Copy the file bootloader-hammerhead-hhz20h.img to c:\flash. (For Nexus 4 copy bootloader-mako-


makoz30f.img to c:\flash.)

Copy the file radio-hammerhead-m8974a-2.0.50.2.30.img to c:\flash. (For Nexus 4 copy radio-mako-


m9615a-cefwmazm-2.0.1701.07.img to c:\flash.)

Right click on the file image- hammerhead- m4b30x.zip (for Nexus 4 it is image-occam-lmy48t.zip), drag
the mouse down to Extract All, and left click to select it. Then click on Browse, find the c:\flash folder,
then click Select Folder followed by Extract.

The directory c:\flash should now contain the following files for a Nexus 5:

The directory c:\flash should now contain the following files for a Nexus 4:

2 of 7
Techno Bill
2016-12-06
Phase 2: Ensuring USB Drivers are on the Computer

From observation, this seems to be an area where a lot of people report problems, but it should really be
fairly straight forward. The easiest way to ensure the drivers are working OK is to bring up Device
Manager.

On the Windows 10 computer, drag the mouse to the lower left corner of the screen, click on the window
icon and click on All apps, then scroll down the list and click on Windows System, then Control Panel.

After clicking Control Panel, if you see a screen like this, click the drop down arrow next to Category and
select Small Icons.

3 of 7
Techno Bill
2016-12-06
When you see a screen like this, click on Device Manager.

2.1 (NOTE: If your Nexus will not boot into the full system OS, then skip
to section 2.2.) You are now ready for your first test. With your Nexus on
the home screen in normal operating mode, attach it to the computer
with a USB cable. After a few seconds (keep in mind that if the computer
needs to download and install USB drivers, it could be a bit longer), the
Device Manager window should look like this:

Under the entry for Portable Devices, there should be an entry called
Nexus 5 (or Nexus 4).

If you see an entry with a yellow question mark under Other Devices,
right click on it and choose "Update Driver Software", then choose
"Browse my computer", then "Let me pick from a list". If you see
categories, select "Android Device", then select "MTP USB Device", then
click Next to complete the driver installation.

At this stage you should be able to use Windows Explorer to access your
Nexus and backup files you want to keep (if your Nexus 5 has Android 6.0
or later installed, you will need to swipe down the notification shade, tap
USB for charging and select the MTP option to access files from your
computer).

4 of 7
Techno Bill
2016-12-06
Pay particular attention to folders like DCIM, Movies, Music, Pictures, Documents, Download, etc where
you may have files stored that you want to keep. Copy these files/folders to a safe place on your
computer so that you can restore them after you finish flashing the new factory image.

2.2 Disconnect the USB cable and the Nexus entry under Portable Devices should disappear.

Power off your Nexus by holding the Power switch until the Power Off notice appears on the screen and
then tap the Power Off notice.
Boot your Nexus into Fastboot Mode by doing the following:

Press & hold the Volume Down button, then also press &
hold the Power button until the device turns on, and
immediately release all buttons. (Note: The screen will be
similar to this one, but not exactly the same as this is for a
Nexus 6)

You'll see one of the phrases "Start", “Restart bootloader”,


“Recovery mode”, “Power off” with an arrow drawn around
it.

DO NOT press the Power button to select any of these


options.

At this point you should be in Fastboot Mode

Attach the USB cable to your computer.

If you go back to the Device Manager window on your computer, it


should now have an entry Android Device and under it an entry
called Android Bootloader Interface.

Again, if you see an entry with a yellow question mark under Other
Devices, right click on it and choose "Update Driver Software", then
choose "Browse my computer", then "Let me pick from a list". If
you see categories, select "Android Device", then select "Android
Bootloader Interface". Click Next to complete the driver
installation. (Note: There might be a couple of version of Android
Bootloader Interface. Try the one with the latest version number.
If it doesn’t work try another.)

Unplug the USB cable, then plug it in again. Don’t continue until
you see Android Bootloader Interface in Device Manager.

NOTE: If you are still having trouble, there have been reports of
success after installing these drivers.

5 of 7
Techno Bill
2016-12-06
2.3 You are now ready for the final test to be sure everything is working OK.

Open a Command Prompt on the computer. You do this in a similar way to starting Control Panel –
Command Prompt is the entry just before Control Panel under Windows System in the All apps list. On
the Command Prompt screen, enter the following two commands:
fastboot devices

The response should be similar to the line below; however, the serial number of your Nexus would be the
first value.
ZX1G224NBN fastboot

If you make it to here all is in good shape to proceed to flashing your Nexus with the Factory Image.

Phase 3: Flashing your Nexus

Warning: Up until this point everything has been very benign. Starting here is where you are treading
into the modification of your Nexus.

In the steps below I recommend flashing each partition individually. There is a batch file called flash-
all.bat that is intended to automate the entire process for you. However, I have found this to be
problematic on many devices. It may fail if you do not have sufficient cache space available to expand
the partition images on the device as opposed to on your computer.

Examine the responses from each command. Do not proceed further if there is any indication of an
error or write/erase failure.

Now unlock the boot loader on your Nexus. This will put a message on the screen of your Nexus indicating
that this will void your device warranty. You must acknowledge this on the screen in order to proceed.
cd c:\flash
fastboot oem unlock

On a Nexus 5 you enter these commands:


fastboot flash bootloader .\bootloader-hammerhead-hhz20h.img
fastboot reboot-bootloader

fastboot flash radio .\radio-hammerhead-m8974a-2.0.50.2.30.img


fastboot reboot-bootloader

On a Nexus 4 you enter these commands:


fastboot flash bootloader .\bootloader-mako-makoz30f.img
fastboot reboot-bootloader

fastboot flash radio .\radio-mako-m9615a-cefwmazm-2.0.1701.07.img


fastboot reboot-bootloader

6 of 7
Techno Bill
2016-12-06
Now you enter these commands to flash the common image files to their respective partitions:
fastboot flash boot .\boot.img
fastboot flash recovery .\recovery.img
fastboot flash system .\system.img
fastboot flash userdata .\userdata.img
fastboot flash cache .\cache.img

NOTE: userdata.img may potentially reduce the size of your


available memory. If you have more memory than the base model or
you are unsure, then do the following command:

fastboot format userdata

Now reboot your Nexus:

fastboot reboot

After your Nexus reboots you will have to go through the initialization steps as you did when you first got
your Nexus. Be sure to sign in with the same Google account that you were using previously.

Attach the USB cable to your computer and use Windows Explorer to restore files you previously saved.

If your Nexus successfully boots and you are satisfied with its operation, reboot your Nexus into Fastboot
Mode and lock your bootloader so that your Nexus is back to full factory state but with the new factory
image installed.
fastboot oem lock

Now reboot your Nexus:

fastboot reboot

Best of luck and I hope this has helped get your Nexus back into tip top operation.

7 of 7
Techno Bill
2016-12-06

You might also like