5,598,171 Members 44,234 Now Online
XDA Developers Android and Mobile Development Forum
View Poll Results: Did this method help you keep root?
Yes 41 80.39%
No 10 19.61%
Voters: 51. You may not vote on this poll

Tutorial: How To Protect and Restore Root (4.2.2 Pre-Camera Update Only)

Tip us?
 
Dark9781
Old
(Last edited by Dark9781; 20th December 2013 at 06:03 AM.)
#1  
Dark9781's Avatar
Senior Member - OP
Thanks Meter 210
Posts: 659
Join Date: Apr 2009
Default Tutorial: How To Protect and Restore Root (4.2.2 Pre-Camera Update Only)

This tutorial will explain how to protect and restore root for the OTA update.

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.


First I would like to thank JCase. If it wasn't for his original root method this would not be possible.

Prerequisites:
Moto X
A 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.

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


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 in
Code:
cd C:\ (example: cd C:\fastboot)
9. 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:
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.

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:
Code:
fastboot reboot
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 play

12. 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:
Code:
fastboot flash recovery boot.img
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.

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.

14. After root access is restored you are going to go back to your command prompt. Type the following commands:
Code:
adb shell
su
dd if=dev/block/mmcblk0p33 of=/mnt/sdcard/boot.img
exit
exit
adb pull mnt/sdcard/boot.img
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:
Code:
fastboot flash recovery boot.img
Now whenever you boot into recovery your phone will load with the new kernel and you should not have any more issues.

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

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 commands
Code:
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
Now your baseband will be up to date.
Attached Files
File Type: rar ADB_fastboot.rar - [Click for QR Code] (666.8 KB, 848 views)
Need Cloud storage? Try dropbox today. Just click on the link below to get started.
Dropbox
--------------------------------------------------------------
Can you see my memories?
The Following 30 Users Say Thank You to Dark9781 For This Useful Post: [ Click to Expand ]
 
kornklown69
Old
#2  
kornklown69's Avatar
Senior Member
Thanks Meter 702
Posts: 1,967
Join Date: Jan 2011
Location: Springfield, Missouri
hopefully someone makes a video

Sent from my XT1058 using XDA Premium 4 mobile app
 
capathy21
Old
#3  
capathy21's Avatar
Senior Member
Thanks Meter 49
Posts: 228
Join Date: Jul 2011
Location: Pineville,La
Thanks so much for this! Quick question. If I am completely stock (never rooted this device before) I can start on step 2 correct?

Sent from my White Moto X
Nexus 5-Black
4.4.2 Rooted
TWRP
 
Dark9781
Old
#4  
Dark9781's Avatar
Senior Member - OP
Thanks Meter 210
Posts: 659
Join Date: Apr 2009
Quote:
Originally Posted by capathy21 View Post
Thanks so much for this! Quick question. If I am completely stock (never rooted this device before) I can start on step 2 correct?

Sent from my White Moto X
Yup. Step 1 is only for those that have already rooted and have modded the system files.
Need Cloud storage? Try dropbox today. Just click on the link below to get started.
Dropbox
--------------------------------------------------------------
Can you see my memories?
 
mmad81
Old
#5  
Senior Member
Thanks Meter 19
Posts: 165
Join Date: Nov 2010
I'm receiving my Verizon moto x tomorrow so if I read this right I don't except the update, root the moto x continue with these steps, and we will continue to receive updates and maintain root?
 
capathy21
Old
#6  
capathy21's Avatar
Senior Member
Thanks Meter 49
Posts: 228
Join Date: Jul 2011
Location: Pineville,La
Quote:
Originally Posted by Dark9781 View Post
Yup. Step 1 is only for those that have already rooted and have modded the system files.
Thanks! One last question I promise. Can I go ahead and go through the process up to step 10 that way I'll be ready when the ota comes, or should I wait till the ota comes then begin the process?

I've always rooted and flashed updates on past devices so I'm not real familiar with ota's and don't want to take it before I'm able to run this process.

Thanks in advance!

Sent from my White Moto X
Nexus 5-Black
4.4.2 Rooted
TWRP
 
Dark9781
Old
#7  
Dark9781's Avatar
Senior Member - OP
Thanks Meter 210
Posts: 659
Join Date: Apr 2009
Quote:
Originally Posted by capathy21 View Post
Thanks! One last question I promise. Can I go ahead and go through the process up to step 10 that way I'll be ready when the ota comes, or should I wait till the ota comes then begin the process?

I've always rooted and flashed updates on past devices so I'm not real familiar with ota's and don't want to take it before I'm able to run this process.

Thanks in advance!

Sent from my White Moto X
Yup. You could do that.
Need Cloud storage? Try dropbox today. Just click on the link below to get started.
Dropbox
--------------------------------------------------------------
Can you see my memories?
 
capathy21
Old
#8  
capathy21's Avatar
Senior Member
Thanks Meter 49
Posts: 228
Join Date: Jul 2011
Location: Pineville,La
Thanks! I really appreciate your work!

Sent from my White Moto X
Nexus 5-Black
4.4.2 Rooted
TWRP
 
Dark9781
Old
#9  
Dark9781's Avatar
Senior Member - OP
Thanks Meter 210
Posts: 659
Join Date: Apr 2009
Quote:
Originally Posted by mmad81 View Post
I'm receiving my Verizon moto x tomorrow so if I read this right I don't except the update, root the moto x continue with these steps, and we will continue to receive updates and maintain root?
It should work on Verizon when they release an update. I can't say this will work for future updates or even for 4.3 when it comes around, but for this round of updates it will work to keep root.
Need Cloud storage? Try dropbox today. Just click on the link below to get started.
Dropbox
--------------------------------------------------------------
Can you see my memories?
 
mj0528
Old
#10  
Senior Member
Thanks Meter 42
Posts: 852
Join Date: Feb 2011
Location: Austin, Tx
Quote:
Originally Posted by Dark9781 View Post
It should work on Verizon when they release an update. I can't say this will work for future updates or even for 4.3 when it comes around, but for this round of updates it will work to keep root.
what has been the success rate of this? I'm surprised more haven't jumped on this! Why are so many trying to unroot to get the camera update?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes