[Moto G4 Guides, News, & Discussion] manos78:
Hi,

After much read of guides, I post here my SIMPLE guide for OTA upgrades when your Moto G is unlocked and you use systemless root and TWRP.

This guide is safe and works!

For example, with this guide you can upgrade from STOCK MPJ24.139-23.4 to MPJ24.139-63:

Warning: I assume you know the concepts "fastboot", "systemless root" and TWRP.

For the original stock firmware search here for your

exact MODEL and VERSION

: http://mirrors.lolinet.com/firmware/moto/athene/official/

1) Reboot to TWRP and make a FULL BACKUP of your current firmware. Use the SD-Card and not the internal memory.

2) To Apply the OTA you need to restore BOOT.IMG and SYSTEM.IMG.

2a) If you rooted your device, for sure your BOOT.IMG isn't the original one. You can:

- Option 1: Restore it from an original backup of your firmware (if you backup it prior to root).

- Option 2: Download the STOCK and ORIGINAL firmware for your device, extract "boot.img" and flash it in the fastboot mode using "fastboot flash boot boot.img".

2b) If you use Systemless SuperSU then your system partition

can be

untouched. In case of doubt, or if the patch shows an error, you can restore it...

- Option 1: Restore it from one backup of your firmware (only if you backup it prior to root).

- Option 2: Download the STOCK and ORIGINAL firmware for your device, extract "system.img_sparsechunk.0-7" and flash them in the fastboot mode using these 8 commands (execute one, wait until completes, then execute the next one):

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 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

3) Boot to the TWRP Custom Recovery (you don't need to restore the original Recovery partition).

4) Download the OTA (Blur_Version.24.24.4.athene.retail.en.US.zip) or copy it from the downloaded directory. Copy the ZIP file to a computer, extract the file "/META-INF/com/google/android/updater-script" and edit it... Remove these three lines (this only removes the check of the running build, because you like to execute it inside TWRP):

getprop("ro.build.thumbprint") == "6.0.1/MPJ24.139-63/64:user/release-keys" ||
getprop("ro.build.thumbprint") == "6.0.1/MPJ24.139-23.4/4:user/release-keys" ||
abort("Package expects build thumbprint of 6.0.1/MPJ24.139-63/64:user/release-keys or 6.0.1/MPJ24.139-23.4/4:user/release-keys; this device has " + getprop("ro.build.thumbprint") + ".");

After that, copy (repack) this edited file to the ZIP file of the OTA. I suggest to change the name of the ZIP, for example to "Blur_Version.24.24.4.athene.retail.en.US-TWRP.zip". Now, you can run this patch file running TWRP.

5) Copy the patch OTA file to the SD-CARD, boot to the TWRP and apply the OTA... After several minutes the task completes. Reboot and check if the update is done and all works well. Your data needs to be already there... ;)

6) Reboot into the fastboot mode and reflash the TWRP Custom Recovery using "fastboot flash recovery twrp-3.0.2-0-athene.img". Then boot in the recovery mode and do another Backup (for save untouched "system.img" and "boot.img" partitions).

7) Now you can re-root using the TWRP mode and SuperSU 2.78 in Systemless mode (remember to execute "echo SYSTEMLESS=true>>/data/.supersu" prior to install the SuperSU.zip)

I hope this helps you!

This guide only uses the minimum and required steps.

:good:

If you like to download one already patched OTA, then download it from here (join the two files first!):

Part 1: http://www.sendspace.com/file/dkws7p

Part 2: http://www.sendspace.com/file/xaompg

Part 1: http://www.sendspace.com/file/e3of46

Part 2: https://www.sendspace.com/file/a3tl4r

CRC:

filename=Blur_Version.24.24.4.athene.retail.en.US-TWRP.zip

size=508332365

crc32=AFEC5752