Flash 5.1 Firmware



This is the script that I use to update or restore/downgrade my Moto G LTE to its stock Android release.

1) Extract the contents of the 5.1 Zip (acquired via XDA).
2) Copy the Google "fastboot" program into the extracted directory (note that you do NOT need any special Motorola "mfastboot" program).
3) Create a script with the below contents and make it executable.

Windows:

.\fastboot flash partition gpt.bin
.\fastboot flash motoboot motoboot.img
.\fastboot flash logo logo.bin
.\fastboot flash boot boot.img
.\fastboot flash recovery recovery.img
.\fastboot reboot-bootloader
.\fastboot flash system system.img_sparsechunk.0
.\fastboot flash system system.img_sparsechunk.1
.\fastboot flash system system.img_sparsechunk.2
.\fastboot flash system system.img_sparsechunk.3
.\fastboot flash modem NON-HLOS.bin
.\fastboot erase modemst1 
.\fastboot erase modemst2 
.\fastboot flash fsg fsg.mbn
.\fastboot erase cache 
.\fastboot erase userdata 
.\fastboot reboot

Linux / macOS:

#!/bin/sh
./fastboot flash partition gpt.bin
./fastboot flash motoboot motoboot.img
./fastboot flash logo logo.bin
./fastboot flash boot boot.img
./fastboot flash recovery recovery.img
./fastboot reboot-bootloader
./fastboot flash system system.img_sparsechunk.0
./fastboot flash system system.img_sparsechunk.1
./fastboot flash system system.img_sparsechunk.2
./fastboot flash system system.img_sparsechunk.3
./fastboot flash modem NON-HLOS.bin
./fastboot erase modemst1
./fastboot erase modemst2
./fastboot flash fsg fsg.mbn
./fastboot erase cache
./fastboot erase userdata
./fastboot reboot