DISCLAIMER: This guide describes procedures with tools that are designed to write directly to the storage of your device. This has the potential to lead to data loss or bricking your device. If you follow this guide carefully, none of these things should happen. That being said, you are still responsible for your own actions and how you handle the tools mentioned in this guide. Caution is advised.
When do i need this?
The following procedure can be used to get your device back into a booting state if all else fails. Usually you'd want to use this tool to get a working recovery running on your device and then go from there, since apart from flashing ROMs, recoveries like TWRP offer direct access to the internal storage as well.
This tool is usually not needed if:
- The device still boots into recovery and it is possible to access the internal storage through it or flash ROMs. Flashing the official OxgenOS downloaded from OnePlus can fix many issues and the stock recovery is just fine for this purpose.
- The devices bootloader is unlocked. In this case fastboot boot <recovery-image.img> can be used to get into a useful recovery
- The Android ROM still boots and offers root access. This can also be used to flash a useful recovery to the device
Now, if you made sure that you are desperate enough to go on, let's cut to the chase.
You may know the legendary guide by Naman Bhalla about unbricking your OnePlus X: https://forum.xda-developers.com/oneplus-x/general/guide-mega-unbrick-guide-hard-bricked-t3272108
It utilizes the interface that's used in factories to flash the OnePlus X and does not rely on an unlocked bootloader - it allows direct read/write access to the devices flash storage. The original guide requires you to install drivers and run an executable from an unknown source on a windows machine. What if you mistrust this or don't have access to a windows machine?
Well, i know i'm hella late but i was happy to find this so i'm going to share it now:
There is an open source tool to flash your device using Qualcomms EDL mode and it can be used on a Linux machine!
Since the same protocol is used to flash onto the device, the procedure is mostly analogous to the original guide by Naman Bhalla. It simply uses another program on your PC to achieve this.
You'll need to know how to use a terminal, how to open a terminal in a specific directory and how to install missing software in the Linux distribution you are using. It is very likely that you also need root access or sudo on your machine.
Once all that is settled, follow these steps:
Congratulations on unbricking your device on a Linux machine, enjoy. Also, props to you for still using your OnePlus X after all this time
HELP, i've ran qdl and my device does not vibrate or boot or ANYTHING AT ALL!
If this happens, you have likely flashed to the GPT without patching it, either accidentaly because you left the "<program />" tags which flash to "PrimaryGPT" and "BackupGPT" in your "customprogram.xml" without adapting your command line as described or because you followed an older version of this guide which contained a serious error in that regard. Don't fret - it's not that serious, you probably just need to flash the "patch0.xml" program from the UnBrick tool to get your device up and running. It ensures that your GPT is intact again after flashing to it. This is your partition table so it is required to read the bootloader from your devices storage or literally anything else. If it can't be read there's nothing to do any booting with.
To get back your device either run the full default configuration with
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn rawprogram0.xml path0.xml"
or remove everything but the two "<program />" elements from "rawprogram0.xml", save it as "gptprogram.xml" and run
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn gptprogram.xml patch0.xml"
[1] The UnBrick tool comes with a flashing procedure along with the required files, which, without further modifications to rawprogram0.xml or removal of those files, will flash device drivers and bootloader and the recovery from some OxygenOS 2 OTA update by OnePlus onto your phone. If you have "the new bootloader" installed, [ i.e. you once flashed OxygenOS 3, have any modern (post-Marshmallow) ROM running on your device or TWRP v3.0.2-1 or newer ] then this will soft-brick your device, meaning your ROM won't boot anymore.
By having a look at the rawprogram0.xml file, it's fairly easy to figure out how to tinker with it: You can A remove certain elements to flash only what you want or B replace the files that come with the UnBrick tool by anything you want. Want to flash the files from the OxygenOS 3.1.3 OTA? No problem - just obtain them, place them in the directory and give them the right names and go. Want to flash only a compatible TWRP? Put it in the directory and edit the program xml file accordingly and all is good.
[2] Actual bricking should only occur if you use a program xml file meant for a different device or if you change any of the values that control at which offset the files are going to be flashed. QDL will write anything onto your device to any given storage area as specified in the xml program, independent from partition boundaries and even if it means overwriting something from your data partition or maybe your IMEI and MAC address - Remember that via EDL you can reflash most of the storage back to a working system, but not everything. The original rawprogram0.xml from the UnBrick tool mini only writes to partitions that you are able to reflash to a working condition - as long as you haven't edited it, you should be able to restore to a working condition if something goes wrong.
When do i need this?
The following procedure can be used to get your device back into a booting state if all else fails. Usually you'd want to use this tool to get a working recovery running on your device and then go from there, since apart from flashing ROMs, recoveries like TWRP offer direct access to the internal storage as well.
This tool is usually not needed if:
- The device still boots into recovery and it is possible to access the internal storage through it or flash ROMs. Flashing the official OxgenOS downloaded from OnePlus can fix many issues and the stock recovery is just fine for this purpose.
- The devices bootloader is unlocked. In this case fastboot boot <recovery-image.img> can be used to get into a useful recovery
- The Android ROM still boots and offers root access. This can also be used to flash a useful recovery to the device
Now, if you made sure that you are desperate enough to go on, let's cut to the chase.
You may know the legendary guide by Naman Bhalla about unbricking your OnePlus X: https://forum.xda-developers.com/oneplus-x/general/guide-mega-unbrick-guide-hard-bricked-t3272108
It utilizes the interface that's used in factories to flash the OnePlus X and does not rely on an unlocked bootloader - it allows direct read/write access to the devices flash storage. The original guide requires you to install drivers and run an executable from an unknown source on a windows machine. What if you mistrust this or don't have access to a windows machine?
Well, i know i'm hella late but i was happy to find this so i'm going to share it now:
There is an open source tool to flash your device using Qualcomms EDL mode and it can be used on a Linux machine!
Since the same protocol is used to flash onto the device, the procedure is mostly analogous to the original guide by Naman Bhalla. It simply uses another program on your PC to achieve this.
You'll need to know how to use a terminal, how to open a terminal in a specific directory and how to install missing software in the Linux distribution you are using. It is very likely that you also need root access or sudo on your machine.
Once all that is settled, follow these steps:
- To download and compile QDL, the open source flashing tool that will be used in this guide, follow the section "Get the Linux flashing tool" from these instructions
- Download and extract the "UnBrick tool mini" linked in a follow up post by Naman Bhalla and open a terminal in the extracted folder with all the files
- Before the next steps, make sure that everything is configured correctly. Everything else might flash something you don't want and even has the potential brick and/or overwrite anything in your phone's storage. Apart from that, you might also flash just a recovery instead of the complete package that comes with the download. [1] [2]
- With your OnePlus X powered off, hold the volume up key, then establish a USB-connection to your PC
(To make sure the device connected properly, you can check the output of "dmesg". It should print something like "Qualcomm USB modem converter now attached to ttyUSB".) - On the terminal in the extracted folder, run the following for the default configuration:
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn rawprogram0.xml patch0.xml"
For a customized configuration, edit "rawprogram0.xml" and save it as "customprogram.xml" for example, then run
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn customprogram.xml"
Be careful about the last two "<program />" elements from "rawprogram0.xml" which flash to the "PrimaryGPT" or "BackupGPT" respectively. If you include them in your "customprogram.xml" you must also flash the "patch0.xml" program like in the unmodified configuration, or your device won't boot, like so:
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn customprogram.xml patch0.xml"
If qdl gets stuck at "waiting for device", try running the command with root privileges, e.g. with "sudo <command>".
If everything worked, you'll see several lines of output and the tool will report what is flashed etc. - Once it's done, QDL will reset power on your device to kick it out of EDL mode. If everything is alright your phone should react to being connected via USB by vibrating and booting into the charging screen. Just before this happens, you can already press and hold the volume down button to boot straight into recovery, or wait and boot your device normally into whatever mode you're up to.
Congratulations on unbricking your device on a Linux machine, enjoy. Also, props to you for still using your OnePlus X after all this time
HELP, i've ran qdl and my device does not vibrate or boot or ANYTHING AT ALL!
If this happens, you have likely flashed to the GPT without patching it, either accidentaly because you left the "<program />" tags which flash to "PrimaryGPT" and "BackupGPT" in your "customprogram.xml" without adapting your command line as described or because you followed an older version of this guide which contained a serious error in that regard. Don't fret - it's not that serious, you probably just need to flash the "patch0.xml" program from the UnBrick tool to get your device up and running. It ensures that your GPT is intact again after flashing to it. This is your partition table so it is required to read the bootloader from your devices storage or literally anything else. If it can't be read there's nothing to do any booting with.
To get back your device either run the full default configuration with
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn rawprogram0.xml path0.xml"
or remove everything but the two "<program />" elements from "rawprogram0.xml", save it as "gptprogram.xml" and run
"/path/to/qdl_source_code/qdl prog_emmc_firehose_8974.mbn gptprogram.xml patch0.xml"
[1] The UnBrick tool comes with a flashing procedure along with the required files, which, without further modifications to rawprogram0.xml or removal of those files, will flash device drivers and bootloader and the recovery from some OxygenOS 2 OTA update by OnePlus onto your phone. If you have "the new bootloader" installed, [ i.e. you once flashed OxygenOS 3, have any modern (post-Marshmallow) ROM running on your device or TWRP v3.0.2-1 or newer ] then this will soft-brick your device, meaning your ROM won't boot anymore.
By having a look at the rawprogram0.xml file, it's fairly easy to figure out how to tinker with it: You can A remove certain elements to flash only what you want or B replace the files that come with the UnBrick tool by anything you want. Want to flash the files from the OxygenOS 3.1.3 OTA? No problem - just obtain them, place them in the directory and give them the right names and go. Want to flash only a compatible TWRP? Put it in the directory and edit the program xml file accordingly and all is good.
[2] Actual bricking should only occur if you use a program xml file meant for a different device or if you change any of the values that control at which offset the files are going to be flashed. QDL will write anything onto your device to any given storage area as specified in the xml program, independent from partition boundaries and even if it means overwriting something from your data partition or maybe your IMEI and MAC address - Remember that via EDL you can reflash most of the storage back to a working system, but not everything. The original rawprogram0.xml from the UnBrick tool mini only writes to partitions that you are able to reflash to a working condition - as long as you haven't edited it, you should be able to restore to a working condition if something goes wrong.
Last edited: