[Moto X4 Guides, News, & Discussion] KrisM22:
AS ALWAYS: I take no responsibility - DO THIS AT YOUR OWN RISK!!!! BE CAREFUL!!!!! I guarantee nothing.

1 Mar 2020 9:50PM GMT:

changed

- PE10 doesn't work with this - need backup of EFS. Persist, fsg.

8 Mar 2020 2:42AM GMT:

I doubt the premise of removing the 2 erases of t1 and t2 so that has been removed. The crux of this guide is simply take backups of EFS and a few other files before making any mod.

Why this post: it seems many folks can't get back to working stock (no wifi or mobile).

- - for folks who have re-locked their phones, I have no solution for unlocking it if you can't go to the motorola site and unlock it. Sorry. - -

- - for folks who are on a custom ROM with working wifi and mobile, and don't have backups of EFS etc from stock, DO THAT as described below. - -

EDIT: Pixel Experience 10 coming back to stock wipes mobile, even though it worked on PE10. Have to have twrp backup of EFS, Persist, fsg. Worked fine for Lineage 16, Superior OS. So clearly, have a backup!

Prep: if you are thinking of trying a custom ROM, or simply as a good safety aid,

back up some of the small files:

Grab both the .img and .zip files of the latest TWRP.

Temporarily boot to twrp:

1) boot your phone to bootloader screen (power off, then hold vol-dn while hold power - takes 6 secs or so.

2) plug your phone to PC and do "fastboot boot twrp.img" (latest is 3.3.1-0)

- at the twrp screen, if you have 9 dots 3x3, press "cancel" just below that.

- choose Backup and select only the ones you want - I used EFS, Persist, fsg, Vendor.

- make sure it is stored to your SD card. It will be in /twrp/backup/..... Probably best to put a copy on your PC as well. :)

I use google's backup - in settings/system/backup to backup and restore my apps and settings. I uncheck "contacts" when restoring. your choice.

3) go to backup and tell it to backup now.

4) do 1 and 2 above.

5) now, flash twrp permanently: (since you previously put the latest twrp.zip on your SDcard, choose "install" and flash it. Hit back arrow until you get back to the regular menu and chose reboot, and choose recovery - this will reboot your newly flashed twrp and lock it in. (this method correctly puts twrp in both slots - -a and -b. -> https://twrp.me/motorola/motorolamotox4.html

Now, using the instructions in the thread for the ROM you want to flash, install it.

---------

Okay, you want to get back to stock: I grab the latest-minus-one for my phone from lolinet. At the time of this writing, I use -4 even though -5 is out - this way I will get an immediate update for -5 as the first boot is progressing. ie immediate proof that build is good as far as OTA is concerned.

Expand that zip, and add platform-tools to it. Also add whatever bat files to it that you wish. Attached to this post is the one I just used to get back from Lineage (modified slightly from the one I used to get back from PE 10).

EDIT: I do not know for sure that the bat file without the 2 erases is helpful/necessary so have removed it.

This bat is special!

It was made from the xml from XT1900-1_PAYTON_FI_9.0_PPWS29.69-39-6-4_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip , so if you are using a different zip, you will need to check that the command set is the same - particularly check the number of sparsechunks.

This bat is also very special

because it intentionally does not include the two erase modemst1 and t2 commands.

This is because I found that these 2 will render your new build as not having mobile, or possibly wifi.

okay, now you are ready to flash stock. Put your phone in fastboot mode (bootloader screen as per #1 at top of post). In windows you can right click on the folder that contains all this junk and choose open command window. Then just type the name of the bat file. I put lots of pauses near the beginning as I assumed I would make mistakes. ymmv

This gave me a perfect result. I will test with superior OS tomorrow.

EDIT: Superior OS back to stock works fine but Pixel Experience 10 (and probably others) required a twrp restore of a previously backed up EFS, Persist, fsg.

-----------

Thanks to [MENTION=6507606]redwoodie[/MENTION] and [MENTION=7258623]akillenb[/MENTION] .

The bat file is renamed txt to be allowed. You will need to change it back to bat.

EDIT: I do not know for sure that the bat file without the 2 erases is helpful/necessary so have removed it.

This bat is from XT1900-1_PAYTON_FI_9.0_PPWS29.69-39-6-4_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip - check the xml file in the stock zip you are using to assure this bat is correct for your zip.