Mobiles Motorola

How to restore stock firmware on Motorola Moto G

Motorola Moto G

This is tutorial on how to restore stock firmware on Motorola Moto G. Carefully follow the directions for successful restoration of the stock firmware.

Pre-requisites:

a) Download and install Motorola Drivers:
http://www.mymotocast.com/download/MDM?platform=windows

b) Download and extract the stock firmware of your choosing from:
http://sbf.droid-developers.org/phone.php?device=14
The firmwares with ‘_umtsds’ in the file name are for the ‘dual-sim’ versions of the Moto G, it’s probably not a good idea to flash these onto single sim phones, or vice-versa.

Edit: More firmwares for international retail and carrier devices can be found here:
http://www.filefactory.com/folder/c6cdedc45a775d27

Edit: The firmware files have been updated most of the firmware archives are now in .tar.gz archives which include Motorola fastboot and flashing scripts for OSX, Linux and Windows.

On windows the .tar.gz archives need to be opened and extracted using a 3rd party archive manager. e.g. 7-zip, or PeaZip, Windows cannot extract these files natively, Linux and OSX can.

We used the retail British firmware (fastboot_falcon_retgb_user_4.3_14.10.0Q3.X-76-LGG-8_54_release-keys-cid7-Retail_GB.tar.gz), extracted to c:\

c) If the firmware file you downloaded is a .xml.zip file then download Motorola Fastboot mfastboot-v2.zip (attached to this post) and extract the .exe into the same folder as the stock firmware files (the same folder as the .bin and .img files). If your firmware is a .tar.gz file then skip this step.

d) Get ADB (if you don’t already have this, we suggest downloading and installing Minimal ADB and Fastboot by shimp208:
https://docs.google.com/file/d/0B1S0LCuXCnnmSWh6NGJmSE1BUWc

Steps to restore stock firmware:

1) Reboot the phone into bootloader mode. There are 2 ways to do this.

I) The ‘hardware’ way.

a) Unplug the USB cable and power off the phone.
b) Press and hold ‘Volume down’ then power on the phone.
c) Connect USB cable to your computer.

II) The ‘software’ way.

a) Enable developer mode on the Moto G (Settings-> ‘About Phone’. Tap 7 times on ‘Build Number’)
b) Enable USB debugging. (Settings -> ‘Developer options’ -> ‘USB Debugging’ -> check)
c) Connect phone to computer via USB, you should see a new ADB device detected and drivers installed.
d) Open “Minimal ADB and Fastboot”. Type:
Code:

adb reboot-bootloader

You should see the Moto G bootloader screen with the following options:
Code:

Normal Powerup
Recovery
Factory
Switch Console [NULL: null] Barcodes
BP Tools

2) Open a command prompt / terminal (Start -> cmd.exe in Win7) and browse to the folder with the extracted firmware.

In my case:
Code:

cd c:\falcon_retgb_user_4.3_14.10.0Q3.X-76-LGG-8_54_release-keys-cid7-Retail_GB

3a) If you downloaded and extracted a firmware in .tar.gz format

In windows, run the ‘flashall.bat’ script Type:
Code:

flashall.bat /eu

The “/eu” switch forces userdata to be erased from the device, this is the same as a factory reset or wipe this is recommended when restoring stock firmware.
In Linux/OSX run the flashall.sh script. Type:
Code:

chmod +x flashall.sh
./flashall.sh

Downgrading:
The scripts will fail with an error on downgrading from 4.4.2 to 4.3. Open the script in a text editor (notepad) and delete (or comment) the following:
Lines 89-90 in the flashall.bat file:
Code:

CALL :fastboot_flash partition gpt.bin
IF %errorlevel% NEQ 0 EXIT /b 1

Lines 120-121 in the flashall.sh file:
Code:

run $fastboot -s “$serial_number” flash partition gpt.bin
if [ $? -ne 0 ]; then echo “ERROR: fastboot failed.”; exit -1; fi

3b) If you downloaded and extracted a firmware in .xml.zip format.

Flash each of the partitions in sequence using mfastboot, you need to enter the following commands one-by-one checking that each one returns an [OKAY] Code:

mfastboot flash partition gpt.bin
mfastboot flash motoboot motoboot.img
mfastboot flash logo logo.bin
mfastboot flash boot boot.img
mfastboot flash recovery recovery.img
mfastboot flash system system.img_sparsechunk1
mfastboot flash system system.img_sparsechunk2
mfastboot flash system system.img_sparsechunk3
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1
mfastboot erase modemst2
mfastboot flash fsg fsg.mbn
mfastboot erase cache
mfastboot erase userdata
mfastboot reboot

Downgrading:
The 1st command “mfastboot flash partition gpt.bin” will fail on 4.4.2 to 4.3 downgrade. Skip this command if you are downgrading and continue with the other commands, which should work.

4) Wait, you should now be rebooted into a fully stock Moto G firmware.

  • Alfonso González Magaña

    What is gpt.bin, what this file do? why need to delete from those lines?… i have a moto x and downloaded MOTO X, GSM Dev Edition: KK-4.4.2-KXA20.16-1.25_MR3 (Retail) also i got Android 4.2.2 Blur_Version.139.12.37.ghost_row.Iusacell.en.MX

    My device is from another carrier (Telcel) is rooted, unlocked BL and flashed TWRP recovery, i want all dev system and software but modem/radios/baseband from iusacell

    I guess i must flash these files from the first firmware

    mfastboot flash partition gpt.bin (I guess with this I lose root and unlocked BL)
    mfastboot flash motoboot motoboot.img
    mfastboot flash logo logo.bin
    mfastboot flash boot boot.img
    mfastboot flash system system.img

    skip

    mfastboot flash recovery recovery.img (to keep TWRP)

    and then flash these files from the second one (iusacell)

    mfastboot flash modem NON-HLOS.bin
    mfastboot erase modemst1
    mfastboot erase modemst2
    mfastboot flash fsg fsg.mbn
    mfastboot erase cache
    mfastboot erase userdata
    mfastboot erase customize
    mfastboot erase clogo

    another question, doesnt matter if one is 4.4.2 and the other 4.2.2?

  • Vidya Sagar

    Thank for u support this very useful to me . my device is working propery……….

    • Glad to hear that.

      • Vidya Sagar

        I am unable to install super Su ..recently i updated to 4.4.4

        Thear is no su binary installed and supersu can not install it

        Can please fix this one

        • Tuhin

          Flash SuperSu from custom recovery!

  • Seba

    Could someone please help me? I’m trying to go back to stock (4.4.2) as I was using 4.4.4 and my phone got unresponsive at all… I unlocked the bootloader actually and tried the steps above, but getting stuck on this error…

    c:falcon_perar_user_4.4.2_KXB20.9-1.10-1.9_8_release-keys-cid12-Personal_AR>fla
    shall.bat /eu
    Motorola Mobility flashall script version 1.4

    Flashing Options:
    – flash persist: 0
    – flash userdata: 0
    – erase userdata: 1
    – erase cache: 0

    Waiting for fastboot enumeration…

    Fastboot device is ready!!

    Flashing GPT and bootloader images…

    Executing “.Windowsfastboot.exe flash partition gpt.bin”
    target max-sparse-size: 256MB
    sending ‘partition’ (32 KB)…
    OKAY [ 0.045s]
    writing ‘partition’…
    (bootloader) This may take a few seconds, if a
    (bootloader) different partition table is being
    (bootloader) flashed since we need to backup
    (bootloader) and restore a few partitions
    (bootloader) Flashing primary GPT image…
    (bootloader) Flashing backup GPT image…
    OKAY [ 0.381s]
    finished. total time: 0.426s

    8226 HW detected…

    Flashing motoboot

    Executing “.Windowsfastboot.exe flash motoboot motoboot.img”
    target max-sparse-size: 256MB
    sending ‘motoboot’ (1940 KB)…
    OKAY [ 0.098s]
    writing ‘motoboot’…
    (bootloader) Motoboot: Preflash validation for tz
    (bootloader) Preflash validation failed
    FAILED (remote failure)
    finished. total time: 0.416s
    .Windowsfastboot.exe flash motoboot motoboot.img failed!!

    c:falcon_perar_user_4.4.2_KXB20.9-1.10-1.9_8_release-keys-cid12-Personal_AR>

    • Tuhin

      Skip
      fastboot.exe flash partition gpt.bin” and
      fastboot.exe flash motoboot motoboot.img

      Don’t be lazy manually type the commands in Cmd prompt!
      Used “mfastboot” worked for me revived the device from softbrick.

      • deven

        Is there way to recover from Preflash validation failed

        • Tuhin

          Skip the first 2 steps!

          ie.
          “fastboot.exe flash partition gpt.bin” and

          fastboot.exe flash motoboot motoboot.img”

          • Kay Mandalaywala

            Thanks alot buddy. Really helped. Was trying to figure out solution to this error since last 5 hrs… Sadly couldn’t downgrade to 4.4.4.

          • Krishna Kiriti

            my moto g3 strucked at boot logo and while doing fast boot method it shows error at “fastboot.exe flash partition gpt.bin” and shows the prevalidation failed message and also similar message with sparsechunk files….please help me

  • justbodybuild

    What if I get this error when trying to flash: ‘mfastboot’ is not recognized as an internal or external command,

    operable program or batch file.