1. Are you ready for the Galaxy S20? Here is everything we know so far!

[Guide]How to flash a Nexus Factory Image manually.

Discussion in 'Android Development' started by jhawkkw, Apr 3, 2013.

  1. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    This is a guide for all those who run into a circumstance that requires a complete return to stock. Most people who have windows can avoid this through the use of a toolkit like Wugs, but that still leaves those on Macs or Linux behind.

    Step 1: Make sure the fastboot drivers are installed & configured if your OS requires them. The easiest way is to use Koush's Universal drivers found here: Universal Driver

    Step 2: Make sure you have the fastboot files. You can get it from our mini-sdk here on the forums.

    Step 3: Download the factory image from Google Developer website. The latest builds are listed below:

    Once downloaded, extract the .tzg into the same folder you put the sdk files.

    Step 4: Make sure the device is connected to the computer while in fastboot mode. Different devices may require different commands to get into fastboot mode. Make sure the device is powered off and then use the following button commands:

    • Nexus S - Vol Up + Power
    • Galaxy Nexus - Vol Up + Vol Down + Power
    • Nexus 7 - Vol Down + Power
    • Nexus 4 - Vol Down + Power
    • Nexus 5 - Vol Down + Power
    • Nexus 10 - Vol Up + Vol Down + Power
    • Nexus 9 - Looking to Confirm
    • Nexus 6 - Vol Down + Power
    Step 5: Open up a command line terminal and navigate it to the location where the factory image and fastboot files are located. This can be done with the following command
    Windows users can take a shortcut by having the folder open with windows explorer and then using the combo of Shift + Ctrl + right click and then clicking on "Open session window here"

    Step 6: All commands are going to be executed through the fastboot binary.
    For simplicity, I'm only going to progress using windows commands because it's simpler. First we want to make sure the computer sees the device. Use the command:
    This should return a device ID if it's recognized. If nothing is returned, it means your device is not connected in fastboot mode, or the drivers aren't installed/configured correctly.

    *Note* Steps 7 and/or 8 will wipe the device completely. So if you wish to back anything up, do it now.

    Step 7: If your bootloader is already unlocked, skip this step. If it is not, it has to be unlocked in order to flash anything. To do this, use the command:
    Use the Vol Up to go up to yes and then use the power key to select. The device should now be unlocked

    Step 8: We now want to wipe the device. Use the following commands in order:
    Step 9: We will now flash the bootloader. It is important that you do not disconnect the device or mess with it during this step or else you hard brick the device.
    Step 10: If using a phone or data enabled tablet, we will now flash the mobile radios. Some phones have more than one radio file. Flash the CDMA radio after the LTE radio.
    Step 11: We will now flash the system, boot, and recovery all in one shot with the following command:
    Alternatively, you could extract all the .img files in the zip file and flash them manually one at a time. This makes things really handy if you're using the factory image to act as an update rather than a complete return to stock. If trying to update using the factory image, extract the .img from the zip file into the same directory as your bootloader and radio img files and execute the following commands in order:
    If going for a complete back to stock using the manual flashing of the zip file, execute the following commands after the above 4:
    Step 12: The device now has been flash back to stock. Only one thing left to do is reboot.
    Your device will now reboot and should be completely back to stock as well as be unrooted.


    #1 jhawkkw, Apr 3, 2013
    Last edited by a moderator: Dec 10, 2014
  2. Best Answer:
    Post #247 by codesplice, Apr 8, 2018 (3 points)
  3. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    Post Reserved :)
    Sepero likes this.
  4. jmar

    jmar Nexican

    For Linux, I've never typed ./fastboot-linux

    I've always typed ./fastboot

    sudo in front and rest of command after

    Just an FYI :)

    Great Guide :D
    EarlyMon and jhawkkw like this.
  5. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    It's because the name of the fastboot files provided in the sites mini-sdk for Linux had that file name. If you're using the official sdk, it probably would have a different name.
    Sepero, jmar and EarlyMon like this.
  6. jmar

    jmar Nexican

    My bad. Didn't realize the commands would be different. I use the bloated official SDK. :D
  7. DeepEmissions

    DeepEmissions Member

    I am stuck at Step 11.

    This is what it says:
    C:\ADB-SDK>fastboot -w update signed-toroplus-img-ga02.zip
    archive does not contain 'boot.sig'
    archive does not contain 'recovery.sig'
    archive does not contain 'system.sig'
    Bootloader Version...: PRIMELC03
    Baseband Version.....: L700.GA02
    Serial Number........: 0149B33B0A014012
    checking product...
    OKAY [ 0.008s]
    checking version-bootloader...
    OKAY [ 0.008s]
    checking version-baseband...
    OKAY [ 0.001s]
    checking version-cdma...

    Device version-cdma is 'L700.FH05'.
    Update requires 'L700.GA02'.

    finished. total time: 0.025s

    I had no problems during The other steps, but it seems I am missing files.
    I checked the download and even downloaded another package (Galaxy Nexus Sprint) to check it's files and everything seems the same.

    Any Ideas?
  8. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    How did you try and flash the two radios?
  9. DeepEmissions

    DeepEmissions Member

    I flashed
    fastboot flash radio radio-toroplus.img
    fastboot flash radio radio-cdma-toroplus.img

    I got the phone capable of booting with the exception of booting into recovery, this gives me the Android on it's back with a Caution Symbol above.
    I flashed each img one at a time starting with System, Boot, and then Recovery.

    So, phone will boot perfectly fine, but you can not get into recovery partition.
  10. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    You have recovery, but that Android laying on its back is a signal of the stock recovery. You'll have to manually flash custom recovery if you need to do anything with that. You are also unrooted and so you may also need to get that back.
    DeepEmissions likes this.
  11. DeepEmissions

    DeepEmissions Member

    Gotcha, that's all I needed then, as long as I am fully stock, then I'm good...
  12. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    Added Wifi Nexus 7
    scary alien likes this.
  13. cvkiid

    cvkiid Lurker

    i have been stuck on sending `system` for the past 3 hours i need some help please (wifi nexus 7)
  14. bagongo

    bagongo Lurker

    I there...I was tryng to use you precious guide to recover from a almost-bricked wifi nexus7...used my iMac. Averything was fine until bootloader flashing!

    I got this

    How can I go on?

    Please help.


    Attached Files:

  15. jhawkkw

    jhawkkw Chinchillin'
    Thread Starter

    Is the bootloader still locked by any chance? Could you provide a picture of what your device while in fastboot mode?
  16. bagongo

    bagongo Lurker

    Fixed...the issue was with 4.3 nakasi bootloader...I flashed 4.23 one and eveyything wasa fine. Now I'm on 4.3 stock rom. Thanks a lot. You're gave me a really great help!!!! Always grateful.
    jhawkkw likes this.
  17. Sharpe Man

    Sharpe Man Member

    Thanks for the great walkthrough! This seemed to work perfectly for the 2012 nexus 7 wifi. I used the factory image from Google. The only thing for me that was different is the device rebooted by itself after the fastboot -w command.

    Now to go to the manually root thread and use that guide!
    jhawkkw likes this.
  18. scotty85

    scotty85 Extreme Android User

    jhawkkw likes this.
  19. palmtree5

    palmtree5 Sunny Vacation Supporter!

    I tend to wonder if there's something wrong with the factory image I downloaded (despite the fact the the file's MD5 checksum matches the one on the page) because my 2012 N7 is choosing to not get past the boot animation

    EDIT: This is with the new images. Also, I went ahead and wiped cache and data via stock recovery

    EDIT: Just kept flashing and flashing until it finally worked
  20. llkj11

    llkj11 Lurker

    I keep getting an error when trying to flash the system image. It says
    could not allocate 721539744 bytes error: cannot load 'system.img'. All of the other images work fine though.
  21. palmtree5

    palmtree5 Sunny Vacation Supporter!

    Which device? What version are you flashing?
  22. llkj11

    llkj11 Lurker

    I'm trying to flash a Nexus 7 2013 with the stock 4.4.2 image.
  23. rachid

    rachid Member

    hi everybody, I need some help fast!
    I was trying to flash a nexus 4 4.2 to stock firmware hoping to fix a glitch with proximity sensor, but after flashing bootloader I stuck in step 10, it says: error : failed to load "file": no error.
    no matter how many times and how many variation of the command I did with no success. I even tried to skip to next step flashing system with no success either, I'm really STUCK and don't know what to do, any help will be much appreciated.
  24. palmtree5

    palmtree5 Sunny Vacation Supporter!

    Try rebooting to the bootloader (fastboot reboot-bootloader). Try a different USB cable. Try a different USB port.

    Edit: you may also want to consider flashing 4.3, then 4.4 and see if that helps
    rachid likes this.
  25. lunatic59

    lunatic59 Moderati ergo sum

    Let's make sure of a few things (sorry if it seems obvious).

    You have the correct radio file for your device. You are in the directory where the radio file is located when you issue the fastboot command. When you boot the phone into fastboot mode it displays locked state as "unlocked".

    Assuming your radio file is named "myradio.img", the correct syntax would be
    Code (Text):
    1. fastboot flash radio myradio.img
  26. rachid

    rachid Member

    I will try to do that'

    that's exactly what I did, cannot make mistake on image radio because, it comes in the same zip file as bootloader and system.
  27. codesplice

    codesplice Elite Recognized Moderator

    Hardware failures manifest in a variety of different ways. There's no easy guide to diagnosing such issues. Just because you can get to fastboot doesn't always mean that the hardware is fine. There were a huge number of Nexus 5X and 6P devices affected by bootloops. They were able to get into fastboot and reflash a factory image (assuming the OEM Unlocking option was enabled), but would inevitably bootloop again. The cause came down to cracks in the soldering joints for the SoC which only became a problem when the "big" CPU cores were working hard and generating heat. That's very different hardware, of course, but I mention it to illustrate that accessing the bootloader doesn't rule out hardware problems.

    Based on what you've described I would bet on a flash storage failure. You should not have to pass extra arguments in order to flash /system - the fact that you had to strongly suggests there is something wrong. And while you were able to work around the issue preventing the file system from being imaged you can't work around the underlying problem(s) causing the bootloop.

Share This Page