-
Downloads the Android SDK Command Line Tools
$ unzip android-sdk-macosx.zip $ cd android-sdk-macosx
-
Create a backup folder
$ mkdir backup
-
Plug your phone and make sure you have the Developer Options enabled (tap 7 times on Settings > About phone > Build number)
-
Make sure you can interact with your phone from the Terminal
$ ./platform-tools/adb devices List of devices attached XXXXXXXXXX device
-
Backup your SDCard content
$ ./platform-tools/adb pull -p /storage/sdcard0/ ./backup/ $ ...
-
Grab the OSX moto-fastboot version of fastboot here
$ unzip moto-fastboot-osx.zip -d moto-fastboot-osx $ cd moto-fastboot-osx
-
Grab the appropriate stock firmware here (or here) (you want the one that matches your Android build number in Settings > About phone > System version)
$ unzip XT1052_GHOST_RETEU_5.1_LPA23.12-15_cid7_CFC.xml.zip -d rom Archive: XT1052_GHOST_RETEU_5.1_LPA23.12-15_cid7_CFC.xml.zip inflating: rom/motoboot.img inflating: rom/recovery.img inflating: rom/fsg.mbn inflating: rom/gpt.bin inflating: rom/boot.img inflating: rom/system.img inflating: rom/logo.bin inflating: rom/NON-HLOS.bin inflating: rom/flashfile.xml inflating: rom/servicefile.xml inflating: rom/factory_version_info_cfc.txt
You can ensure you have the right version by checking version/model/build, etc. in factory_version_info_cfc.txt
.
-
Boot your phone into the bootloader (Power down phone > Hold Volume Down and Power > Release Power button after a few seconds)
-
Verify your phone is available
$ ./moto-fastboot-osx64 devices XXXXXXXXXX fastboot
-
Generally, flashing these images is enough
$ ./moto-fastboot-osx64 flash boot rom/boot.img $ ./moto-fastboot-osx64 flash recovery rom/recovery.img $ ./moto-fastboot-osx64 flash system system.img $ ./moto-fastboot-osx64 reboot
If you need a complete factory reset (including data/app reset), you can basically play all the commands that are in rom/flashfile.xml
:
$ ./moto-fastboot-osx64 getvar max-download-size
$ ./moto-fastboot-osx64 oem fb_mode_set
$ ./moto-fastboot-osx64 flash partition rom/gpt.bin
$ ./moto-fastboot-osx64 flash motoboot rom/motoboot.img
$ ./moto-fastboot-osx64 reboot-bootloader
$ ./moto-fastboot-osx64 flash logo rom/logo.bin
$ ./moto-fastboot-osx64 flash boot rom/boot.img
$ ./moto-fastboot-osx64 flash recovery rom/recovery.img
$ ./moto-fastboot-osx64 flash system rom/system.img
$ ./moto-fastboot-osx64 flash modem rom/NON-HLOS.bin
$ ./moto-fastboot-osx64 erase modemst1
$ ./moto-fastboot-osx64 erase modemst2
$ ./moto-fastboot-osx64 flash fsg rom/fsg.bin
$ ./moto-fastboot-osx64 erase cache
$ ./moto-fastboot-osx64 erase userdata
$ ./moto-fastboot-osx64 erase customize
$ ./moto-fastboot-osx64 erase clogo
$ ./moto-fastboot-osx64 oem fb_mode_clear
$ ./moto-fastboot-osx64 reboot