

Disclaimer: If you wish to keep root, DO NOT accept the OTA Update before running through these steps. PwnMyMoto will not work after updating since bug 9695860 (2nd Master Key) was patched. I am not responsible if this bricks your phone. Use at your own risk.



Note: If you use rsdlite to flash back to stock remember to remove the getvar command from the xml file. If you use fastboot to flash back to stock use the following post as a reference how:

http://forum.xda-developers.com/show...24&postcount=3

Code: cd C:\ (example: cd C:\fastboot)

Code: fastboot flash recovery recovery.img (replace recovery.img with recovery-stock.img if you pulled the backup from you device).

Don't exit the command prompt. We will be using it again shortly.

Code: fastboot reboot

Code: fastboot flash recovery boot.img

The next set of steps will show you how to pull the new boot.img from your phone so you can flash it to the recovery partition so there are no issues caused by using the old boot.img. These steps are completely optional. If you are uncomfortable doing this I recommend waiting for the fxz file for the update to be released to get the new boot.img.

Note: ADB is required to do this. It is now included with the fastboot files attached to this post

Code: adb shell su dd if=dev/block/mmcblk0p33 of=/mnt/sdcard/boot.img exit exit adb pull mnt/sdcard/boot.img

Code: fastboot flash recovery boot.img

These next set of steps will allow you to fix the issue of the baseband failing to update during the OTA update.

Code: fastboot flash modem NON-HLOS.bin fastboot erase modemst1 fastboot erase modemst2

This tutorial will explain how to protect and restore root for the OTA update.First I would like to thank JCase. If it wasn't for his original root method this would not be possible.Prerequisites:Moto XA data cable (one that came with the phone woks fine)Root - Grab JCase's program PwnMyMoto from this thread: http://forum.xda-developers.com/show....php?t=2444957 ADB & Fastboot (attached to post if anyone needs it)RSDlite - Can find it here: http://www.4shared.com/rar/HkfWKoC5/...MTK_Patch.html SuperSU (in playstore, can't guarantee other Superuser programs can restore root)SUPERCURIO's OTA RootKeeper or equivalent root keeper program (in playstore)FXZ file for your carrier - Can be found here: http://sbf.droid-developers.org/ghost_rcica/list.php Steps to Restore Root:1. Make sure that there are no modifications to the system files. If there are the update will fail to flash. There are two way to go about this. You can flash back to stock using the FXZ for your carrier and rsdlite or fastboot (whichever you prefer) or remove the modifications if you know what they are. If you just removed all mods then skip to step 3.2. Now you will need to install PwnMyMoto and then run it. After 2-3 reboots you should be rooted.3. Make sure you install SuperSU and OTA RootKeeper.4. Shutdown your Moto X. Then hold the power and down volume keys for about 5 seconds to boot into the bootloader. Scroll down with the down volume key to recovery and press the up volume key. You will be booted into android with write protection disabled.5. Open up SuperSU. If it asks you to update the binary update it. You are going to want to make sure Survival mode is checked.6. Open OTA RootKeeper. Grant it superuser rights and click Protect Root. It will save a backup of su. After that click Temp. un-root (keeps backup). This will hide root on your device.7. Next we are going to flash the stock recovery. You will need fastboot, a command prompt and the stock recovery.img. For the recovery,img you can either grab the backup (recovery-stock.img) that is saved to the root of your device or you can grab the one from your carrier's FXZ. If you use the recovery from the FXZ you should also grab boot.img since we are going to be using it later. So unzip the fastboot files into a folder that you can easily locate. I placed it in C:\ for easy reference. Make sure your recovery and boot.img are in the same folder.8. Now shutdown your Moto X and boot into the bootloader as we did in step 4. Open your command prompt by going to your start menu clicking run and typing cmd.exe (for windows 8 just use the search in the start screen and search for cmd under apps). This will bring up the command prompt. Now we need to change the directory to the folder you placed the fastboot and recovery files in. To do this type in9. Make sure you connect your phone to you computer via your data cable and that all the moto drivers are installed. Windows will usually automatically detect them. Once your connected and set to got we are going to type the following command into the command prompt:10. So now you are ready to take the OTA Update. Boot your phone up by either choosing Normal Powerup or using the following fastboot command:Once rebooted flash the OTA Update.11. Your phone will reboot into recovery for the flash. Once it is complete it will boot up like normal and optimize any changes made to the system. Once this is done SuperSU will try to automatically restore root, but will fail due to booting with write protection enabled. This is where boot.img comes into play12. Shutdown your Moto X and boot into the bootloader again. Make sure to connect your phone to your computer via you data cable if you disconnected it after flashing recovery. Bring up your command prompt and type the following command:This will allow you to reboot into android with write protection disabled by hijacking the recovery like JCase did with his original exploit.13. Now boot into recovery from the bootloader. Once you are booted back up SuperSU will now be able to restore root automatically.14. After root access is restored you are going to go back to your command prompt. Type the following commands:This will save a copy of the boot.img to the root of your phone and then save it to the directory that your fastboot and adb is in.15. Now we are going to boot back into the booloader. Refer to step 4 for a reference how. Once booted into the bootloader type the following commands into the command prompt:Now whenever you boot into recovery your phone will load with the new kernel and you should not have any more issues.16. If your baseband didn't update with the OTA then you will need to grab the FXZ of the update. Unzip the file NON-HLOS.bin and place it in the folder that contains fastboot.17. Bring up your command prompt and and type the following commandsNow your baseband will be up to date.