Flashing system images on Moto X Play

Another Android phone, a new roundabout way of getting control over it. I purchased a Moto X Play last year (review: great battery capacity, good performance, huge phone though), and recently found myself in the situation where I had to manually flash a stock firmware image. This is the first non-Nexus phone I owned, and I found the procedure to be needlessly complicated. In order to save someone else on the internet a few precious hours, here is how to do it.

Before you start: ask yourself if a full reflash of stock firmware is really necessary. A simple factory reset might suffice if you just want to return your phone to the state in which it came out of the box. You’ll lose all your apps and customizations. I had to perform a full stock firmware flash because the version I was on wasn’t updating to the latest Android (Marshmallow).

Dragons ahead, unlocking your phone will void your warranty. I’m not responsible if your pants catch fire or your phone breaks, but if you follow the guide closely and keep google handy, you should be fine.

Android SDK ToolsWhat you need

  • USB micro cable (your charger cable)
  • Windows or Linux system
    • For Windows drivers, see Motorola Device Manager, this installs USB, ADB and Fastboot drivers. This seems to be the only reliable way to get ALL the drivers on windows.
    • For Linux, android device drivers come standard with the kernel. Wooyay.
  • Android command line tools : You don’t need the full  SDK, which includes Eclipse and the whole IDE mumbo jumbo, just the command-line tools.
  • The phone (duh)


  • Install drivers for your system.
  • Run the Android SDK Manager, and make sure you’ve got the Android SDK Tools and Android Platform Tools installed for your system.
  • Activate developer mode on your phone: On your phone, go to SettingsAbout Phone, scroll down to Build Number, and then – and yes, this is is real – tap Build Number about 9 times. A message will pop up saying you are a developer.
  • Go to SettingsDeveloper Options and enable USB Debugging.
  • Connect the phone to your computer, open a command prompt in the platform-tools folder. (Default: C:/Program Files(x86)/Android/android-sdk/platform-tools, you can SHIFT+right click in the explorer window on that location and choose open command window here).


  • type
    adb.exe devices
  • A list of Android devices should display.
  • ALL OF THE COMMANDS IN THIS GUIDE SHOULD BE RUN FROM THIS COMMAND PROMPT. Unless you add the location to your system path, “adb.exe” or “fastboot.exe” will not be found from a normal command prompt.

OEM Unlock

We’re gonna flash everything on the device anew, also the bootloader/recovery. Motorola doesn’t like this, and has locked the bootloader – probably for our own safety, but hey, we’re reckless and adventurous and can read instructions! Make sure that in the developer settings, “allow OEM unlock” and “allow USB debugging” is enabled. Connect the device to your PC at least once. You have to authenticate the ADB connection once, to make sure your computer is trusted.

In order to unlock your device, you got to get it into fastboot mode (recovery). This can be done by holding down the power button and volume down button while booting up, but in case that fails (which it often does, it’s quite sensitive), you can get into fastboot mode by letting the phone boot up and executing

adb.exe reboot bootloader

When you’re in this mode, you can execute

fastboot.exe oem get_unlock_data

With this code, you have to register on the Motorola Unlock Website. Because god forbid you tinker with your hardware without Motorola knowing it. After going through the tedious process on the website and getting your unlock key (copy-paste it somewhere safe), you can unlock your device using the fastboot command:

fastboot.exe oem unlock KEY

After this has finished, you can reboot your device to check whether or not everything is still allright.

fastboot.exe reboot

Flashing clean system image

In contrast with the Google Nexus devices, Motorola doesn’t provide nice images with a script to flash all the necessary things: you only get the raw .img data, and have to flash every little thing yourself. As always, consult the XDA Developer Forum for download links for your specific Moto X Play version. I found this place to be very complete.

If you’re unsure which version you need, check your settings -> about phone page. My version is lux_reteu.reteu.EN.EU, which is the European single sim version, but your mileage may vary.

Android Phone Info

Download the correct archive and unzip it. (Use the excellent 7-zip, for example), and extra the contents to a folder. (It’s easiest if you extract it to a subfolder of where the fastboot.exe and adb.exe commands are) These are typical file contents:


  • The .bin, .number and .fmb files are binary blobs containing the different parts of the phone system we’re going to flash: bootlog, recovery, …
  • The flashfile.xml file is where we’re going to extract the correct sequence and commands for flashing the images. Let’s open it.

Android Flash File XML

This is the part where you got to check your head and pay attention. The relevant part of the XML file is displayed above. Every item in that list contains the following:

  • The MD5 checksum of the blob to be flashed
  • The filename of the blob to be flashed
  • The operation we need to flash the blob
  • The partition where the blob should be flashed

You translate these commands following the scheme

fastboot.exe operation partition filename

So for example, for the bootloader line, this becomes

fastboot.exe flash bootloader bootloader.img

If you do this for all elements, you’ve got the sequence in which you should flash the system images and you can go ahead. For reference, for me this was:

fastboot.exe flash partition gpt.bin
fastboot.exe flash bootloader bootloader.img
fastboot.exe flash boot boot.img
fastboot.exe flash recovery recovery.img
fastboot.exe flash system system.img_sparsechunk.0
fastboot.exe flash system system.img_sparsechunk.1
fastboot.exe flash system system.img_sparsechunk.2
fastboot.exe flash system system.img_sparsechunk.3
fastboot.exe flash system system.img_sparsechunk.4
fastboot.exe flash system system.img_sparsechunk.5
fastboot.exe flash system system.img_sparsechunk.6
fastboot.exe flash system system.img_sparsechunk.7
fastboot.exe flash system system.img_sparsechunk.8
fastboot.exe flash modem NON-HLOS.bin
fastboot.exe erase modemst1
fastboot.exe erase modemst2
fastboot.exe flash fsg fsg.mbn
fastboot.exe erase cache
fastboot.exe erase userdata
fastboot.exe erase customize
fastboot.exe erase clogo

Execute all these commands.

  • Don’t pull the phone cable during flashing, don’t even touch the phone.
  • Make sure you flash the system sparsechunks in their right order (0 to … whatever number you have)

After all these operations

fastboot.exe reboot

in order to restart your freshly reset phone. Victory!

Comments are closed.