[Moto E4 Guides, News, & Discussion] kartik verma:
Note :

Do not erase/flash Bootloader file preloader.img or preloader.bin

fastboot erase preloader

fastboot flash preloader preloader.img

Do not erase/flash partition table file pgpt.img/gpt.img or pgpt.bin/gpt.bin

fastboot erase pgpt or gpt

fastboot flash pgpt or gpt pgpt.img or gpt.img​

About :

With this guide you will restore stock firmware and re-lock your device bootloader.This guide is from Moto E4 Mediatek variant SKU XT1760 but can work with any Moto E4 Variant. Just grab the partition info and partition name in fastboot mode with fastboot command "fastboot getvar all". But this step isn't necessary if you take backup with miracle tool. It will dump whole firmware in scatter format. So, no need to worry if you have a different variant of Moto E4

This guide will give you the following :​

<bootloader> : warranty (YES)
<bootloader> : unlocked (NO)
<bootloader> : secure (YES)
>> device unlocked (we cannot remove this warning !)

Requirement :

• Place all the firmware files here:

C:\Program Files\Minimal ADB and Fastboot\HERE

• A laptop/Desktop

• Unlocked Bootloader

• Enabled USB Debugging

• Moto E4 Any Variant

• USB Cable

• Minimal Adb & Fastboot Tool

• Miracle Tool

• Adb & Fastboot Commands

Step 1 : Boot into bootloader mode

Switch off your device

Hold power button and volume down button

When you see START release buttons

This is fastboot mode

Step 2 : Reboot into bootloader

Note : i recommended you to use a laptop than that of desktop. For continuous power supply. Fully charge your laptop battery.

Connect with USB Cable

Open fastboot command window

Type fastboot command:

fastboot reboot bootloader

Now your device in fastboot mode

--- Do not disconnect ---

Step 3 : Flashing stock factory images

Type these fastboot commands:

Erasing partitions first

if you have a different variant of Moto E4, just write all the partitions name except bootloader(preloader) in a text file and replace them with the below partition names.​

fastboot erase boot
fastboot erase efuse
fastboot erase expdb
fastboot erase flashinfo
fastboot erase frp
fastboot erase hw
fastboot erase keystore
fastboot erase lk
fastboot erase logo
fastboot erase metadata
fastboot erase nvdata
fastboot erase nvram
fastboot erase oem
fastboot erase oemkeystore
fastboot erase otp
fastboot erase para
fastboot erase persist
fastboot erase proinfo
fastboot erase protect1
fastboot erase protect2
fastboot erase recovery
fastboot erase seccfg
fastboot erase secro
fastboot erase tee1
fastboot erase tee2
fastboot erase utags
fastboot erase system
fastboot erase userdata

--- Do not disconnect ---

Now flash stock factory images

fastboot flash boot boot.img
fastboot flash efuse efuse.img
fastboot flash expdb expdb.img
fastboot flash flashinfo flashinfo.img
fastboot flash frp frp.img
fastboot flash hw hw.img
fastboot flash keystore keystore.img
fastboot flash lk lk.img
fastboot flash logo logo.img
fastboot flash metadata metadata.img
fastboot flash nvdata nvdata.img
fastboot flash nvram nvram.img
fastboot flash oem oem.img
fastboot flash oemkeystore oemkeystore.img
fastboot flash otp otp.img
fastboot flash para para.img
fastboot flash persist persist.img
fastboot flash proinfo proinfo.img
fastboot flash protect1 protect1.img
fastboot flash protect2 protect2.img
fastboot flash recovery recovery.img
fastboot flash seccfg seccfg.img
fastboot flash secro secro.img
fastboot flash tee1 tee1.img
fastboot flash tee2 tee2.img
fastboot flash utags utags.img
fastboot flash system system.img

--- Do not disconnect ---

Step 4 : Re-lock bootloader

Type this fastboot command

fastboot oem lock

Hit volume up button

Again type fastboot command

fastboot reboot

Step 5 : Fix for system image sparse chunk

Used only when fastboot command failed to write system in system partition else when you see "sparse chunk error" wait for 10 minutes. you will see 1/20 or something operations. if not or command ended up with chunk error than use this command.​

Use this fastboot command:

fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash system system.img_sparsechunk.9
fastboot flash system system.img_sparsechunk.10
fastboot flash system system.img_sparsechunk.11
fastboot flash system system.img_sparsechunk.12
fastboot flash system system.img_sparsechunk.13
fastboot flash system system.img_sparsechunk.14
fastboot flash system system.img_sparsechunk.15
fastboot flash system system.img_sparsechunk.16
fastboot flash system system.img_sparsechunk.17
fastboot flash system system.img_sparsechunk.18
fastboot flash system system.img_sparsechunk.19
fastboot flash system system.img_sparsechunk.20

Step 6 : Do not use this fastboot command

fastboot erase preloader

This will wipe bootloader from bootloader partition and your device ended up with permanent Hard brick.

Step 7 : Fix for bootloader(fastboot) drivers

if your device isn't recognized in fastboot mode, Download USB Drivers from below attachment. Select manually "android_winusb.inf" file while updating driver software.

Download Link :

https://drive.google.com/file/d/0B0Oo-yXGY-zUMG1XRG52dFZpV1k/view

Step 8 : How to dump stock firmware

Thread link below:

https://xdaforums.com/moto-e4/how-to/how-to-backup-stock-rom-moto-e4-variants-t3654976

Guide to fix boot_dataerr in miracle tool if it failed to dump stock rom

Look at the log window in miracle tool there in driver part you will see MTK preloader USB COM PORT#7. We don't need Preloader driver right now, we need MTK Android DA USB COM PORT#7. The solution is update your device driver software to fix this problem else you won't able to dump firmware in scatter format also we don't have official factory images. This is the only method to revert on purely unrooted stock firmware.

Step 9 : Minimal Adb & Fastboot download link

https://androidmtk.com/download-minimal-adb-and-fastboot-tool

This is my last thread in Moto E4 forum and i won't support this device anymore.​