Today was the single-most crazy day in my life. I seriously doubt that I've faced worse issues before.
It all began when Dad asked me to flash his Moto X (2013) back to stock from Cyanogenmod 12, due to some camera issues. I assumed that it was an easy job, but it hardly was so. I corrupted his partition table and system partitions, taking it to a point where no one would be able to repair it. Then I brought it back from the Doors of Death. Here's a brief timeline.
Evening, 5 PM
Downloaded the stock image, but for the wrong region, with the wrong baseband. Go figure! Lost radio connectivity and IMEI info.
Evening, 6 PM
Downloaded the Asia image, but it belonged to Android Kitkat 4.4 and won't flash over existing Lollipop. Wasted 2 GB of data.
Evening, 7 PM
Fastboot refused to flash old partition table, threw
downgraded security version. Managed to pull the IMEI off via
fastboot getvar imei and set it manually.
Evening, 8 PM
Managed to get KitKat 4.4 to boot after playing with partition offsets. Everything fine, just boring old KitKat.
Night, 11 PM
Phone downloads the official Lollipop update, installation allowed.
Night, 11:30 PM
Hard brick. Phone won't install the new update since the existing partition table was newer than the one that shipped with the OTA. All bets off. Phone says
contact dealer, 0xdead
Next day, 12 AM
Brainstroke! Downloaded Verizon's OTA which was released 15 days ago, copied the partition table, flashed it successfully to the phone, did a factory reset. All systems go!
Well, the last 8 hours were probably the craziest in my life, and I hope this post will prevent others from tearing their hair out (I'm feeling bald already).