Upgrading a Moto G
I got myself a refurbished Moto G phone a while ago. It came with Android Kitkat 4.4.4, complete with Moto bloat. I had already put Cyanogenmod on my tablet, so I installed Cyanogenmod 11, android 4.4.4 on it, in accordance with the instructions on the wiki, no problem. That got rid of the bloat and allows fine control of app snooping via Privacy Guard in the settings.
When I first installed Cyanogenmod, I had to use an unofficial build, as an official build for Kitkat 4.4.4 wasn’t available. Now there are six official builds available, including two for Marshmallow. I tried to upgrade to Lollipop using the built in upgrade system, but failed I think it complained about the bootloader.
So I downloaded the official factory image for Lollipop 5.1 from here (XT1032_FALCON_RETGB_5.1_LPBS23.13-56-2_cid7_CFC.xml.zip) and attempted to install it. I followed the instructions here, which appeared to work ok, but the phone wouldn’t boot. Fastboot appeared to be erasing the system partition each time I loaded another sparsechunk file.
So I looked in the flashfile.xml, which appears to contain the instructions for flashing and found a couple of extra commands, which stopped fastboot erasing the partitions. This doesn’t appear to be in the xdadevelopers forum thread, or I couldn’t find it. So the commands for flashing the phone are:
mfastboot oem fb_mode_set 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_sparsechunk.0 mfastboot flash system system.img_sparsechunk.1 mfastboot flash system system.img_sparsechunk.2 mfastboot flash system system.img_sparsechunk.3 mfastboot flash modem NON-HLOS.bin mfastboot erase modemst1 mfastboot erase modemst2 mfastboot flash fsg fsg.mbn mfastboot erase cache mfastboot erase userdata mfastboot oem fb_mode_clear mfastboot reboot
This worked fine and the phone booted up into Lollipop ok. Having done that, I was able to install Cyanogenmod (cm-12.1-20151117-SNAPSHOT-YOG7DAO1K9-falcon.zip) without too much difficulty. I also found a copy of the MotoCamera app here, which I installed, and a replacement boot logo file which replaced the annoying unlock warning boot message. It probably wasn’t necessary to install all of the factory images, just installing the updated partition, motoboot, logo and recovery images would have allowed me to install the latest Cyanogenmod .
I have since upgraded the phone to LineageOS (lineage-14.1-20171226-nightly-falcon-signed.zip), Android 7.1, which works fine. You have to reinstall the MotoCamera app when you upgrade.