Home > Unbrick

Restore OnePlus 7/7T/7T Pro to Stock via Fastboot Commands

In this guide, we will show you how to restore the OnePlus 7/7T/7T Pro to Stock OxygenOS ROM via Fastboot Commands. So here is how the entire guide goes. To begin with, we would be downloading the stock OxygenOS ROM for your device. Then we will take the payload.bin file and extract all its contents (boot.img, system.img, etc). Each of these files will then be flashed onto their respective portions via Fastboot Commands.

As soon as you have executed all the commands, your device will boot up to stock OxygenOS without any modifications. That is, it will be in its clean stock state without any TWRP, root, or other custom mods. Likewise, you could also use the instructions given here to fix the bootloop or soft brick on your OnePlus device[For hard Bricked devices, refer to our separate guide: How to Unbrick OnePlus 7 and bring it back from a Dead State | 7 Pro | 7T |  7T Pro].

OnePlus devices have always been the front runners when it comes to setting their feet in custom development. From flashing custom binaries to trying out tons of mods, there are a plethora of things to try out. These include flashing custom ROMS such as Pixel Experience, Havoc, or something along the AOSP lines. Likewise, you could also replace the device’s stock recovery with a custom one. This in turn will allow you to create and restore Nandroid backup, flash ZIP and IMG files, wipe device partitions, etc.

Then you could also gain access to the system partition by rooting your device via TWRP or without TWRP, by flashing the patched boot.img file. After rooting, you could try out Substratum Themes, Xposed Frameworks, Magisk Modules, etc. However, these tweaks sometimes prove to be risky, if not done correctly or if you end up flashing an incorrect file. In that case, your device will go to a bootloop or might get soft-bricked. If that ever happens to your device, then this guide is always here to help you out. Today, we will show you how to restore the OnePlus 7/7T/7T Pro to Stock OxygenOS ROM via Fastboot Commands. Follow along for the detailed steps.



Unbrick | Restore: OnePlus 7/7T/7T Pro to Stock via Fastboot Commands

Before we list out the instructions, there are a few requirements that you need to qualify. Make sure to go through them and only then proceed with the unbrick steps.

Prerequisites

  • Create a complete device backup, if possible. This is because we will have to wipe off all the data from your device via the fastboot-w command later on. So a backup beforehand is of utmost importance. Since most of you might be stuck in fastboot, it might be a tough job to do. But if your device is up and running, then please create a backup beforehand.
  • Next up, install the Android SDK Platform Tools on your PC. This will provide you with the necessary ADB and Fastboot binary files.

These were the required files. You may now proceed ahead with the steps to restore your OnePlus 7/7T/7T Pro to stock OxygenOS by flashing the Stock ROM via Fastboot Commands. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device by performing the below steps.

STEP 1: Boot OnePlus 7/7T/7T Pro to Fastboot Methods [3 Methods]

First and foremost, you will have to boot your OnePlus 7 series device to Fastboot Mode. This could be done via 3 different methods, depending on the scenario you are facing as of now:

fastboot mode oneplus
Fastboot Mode OnePlus [Reference Image]
  • If your device is soft-bricked, well then it might already be booted to Fastboot.
  • If it is in a continuous boot-loop, then wait for the battery to dry out so that it powers off. Then plug in the charger and at the same time press and hold the Volume Up and Power button together. The timing is extremely important in this, if done at the right time, then you should have no issues in booting to Fastboot or Bootloader Mode.
  • On the other hand, if your device is perfectly working then use the Advanced Reboot menu under Developer Options and access the Fastboot Mode option. Or you could also enable USB Debugging from Developer options and then use the adb reboot bootloader command. Anyways, once your device is booted to Fastboot Mode, head over to the next set of instructions. to restore your OnePlus 7/7T/7T Pro to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

STEP 2: Unlock Critical Partitions on OnePlus

For flashing IMG files to their respective partitions, you will first have to unlock those partitions. This could be done by executing the below command: [Read this for a more detailed explanation: How to Fix FAILED (remote: Partition flashing is not allowed)].

fastboot flashing unlock_critical

STEP 3: Download OnePlus 7/7T/7T Pro Stock OxygenOS ROM

oneplus 7 stock rom extracted

Now head over to the OnePlus Support Forum and download the latest OxygenOS for your OnePlus 7 series device. The firmware would be in ZIP format. If you see the firmware in JAR format, then simply use the 7 ZIP, WinZIP, WinRAR extraction tool to extract its content.



STEP 4: Extract OnePlus 7/7T/7T Pro Payload.Bin File

After extraction, you would notice that there aren’t any partition files. Rather you would see a payload.bin file. It is this file that is holding all the partition IMG files. So you will need to extract this patload.bin file to get hold of all the other files. In this regard, this guide should help you out: How to Extract Stock Boot. img from OnePlus OxygenOS Stock ROM.

payload bin extract via python oneplus 7 7T pro

Follow the steps given in this linked guide and you should all the files inside the Python output folder (again refer to the linked guide). For example, the above image shows all the files that I got after extracting the OnePlus 7 payload.bin file. Let’s now proceed to the next step to restore your OnePlus 7/7T/7T Pro device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

oneplus 7 7t pro extracted payload fastboot files

STEP 5: Flash OnePlus 7/7T/7T Pro Stock ROM- The Initial Setup

Once you have got all the OxygenOS ROM extracted files, transfer them to the platform-tools folder. Inside the same folder, type in CMD in its address bar and hit Enter (see below image). This will launch the Command Prompt window. Now connect your device to the PC via USB cable. Make sure that is booted to Fastboot. Finally, you may now flash all the OnePlus Fastboot ROM files via Fastboot Commands.

command-prompt-adb

Given below in STEP 6 we have listed all the commands for the same. Copy-paste the first command in the CMD window, hit Enter, then do so for the next one, and so on. Furthermore, some commands like when the system.img file is being flashed, will take up quite a lot of time. This is completely normal. Along the same lines, you might also get an “Invalid sparse file format at header magic” message. Well then it is not an error, just wait for a few seconds and it will automatically be gone.



STEP 6: Restore OnePlus 7/7T/7T Pro Stock ROM via Fastboot Commands

So here are the required Fastboot commands to restore your OnePlus 7/7T/7T Pro device to stock OxygenOS by flashing the Stock ROM. The first command (fastboot -w) will completely wipe off all the data from your device, so make sure to have a backup beforehand. Then the last command at the end (fastboot reboot bootloader) will reboot your device back to Fastboot Mode.

After this, you may easily reboot to the OS from Fastboot either by bringing up the Reboot option via Volume Keys and then pressing the Power button to confirm the decision. You could also execute the fastboot reboot command (only do so after all the files have been flashed and your device has been rebooted to Fastboot).

fastboot -w
fastboot flash aop_a aop.img
fastboot flash aop_b aop.img
fastboot flash bluetooth_a bluetooth.img
fastboot flash bluetooth_b bluetooth.img
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
fastboot flash dsp_a dsp.img
fastboot flash dsp_b dsp.img
fastboot flash dtbo_a dtbo.img
fastboot flash dtbo_b dtbo.img
fastboot flash modem_a modem.img
fastboot flash modem_b modem.img
fastboot flash oem_stanvbk oem_stanvbk.img
fastboot flash qupfw_a qupfw.img
fastboot flash qupfw_b qupfw.img
fastboot flash storsec_a storsec.img
fastboot flash storsec_b storsec.img
fastboot flash system_a system.img
fastboot flash system_b system.img
fastboot flash vbmeta_a vbmeta.img
fastboot flash vbmeta_b vbmeta.img
fastboot flash vendor_a vendor.img
fastboot flash vendor_b vendor.img
fastboot flash LOGO_a LOGO.img
fastboot flash LOGO_b LOGO.img
fastboot reboot bootloader

As mentioned before, your device will be booted to Fastboot mode due to the fastboot reboot bootloader command. You may now boot it to the OS right from the Fastboot Mode itself or use the fastboot reboot command.

Alternate Commands: If the above commands didn’t work out for you, then you may also try out the below commands. Thanks to user Deep Lathia for bringing it to our notice and of course, to the XDA Recognized Contributor mauronofrio for these commands. Again, try again at your own risk, and the first command, fastboot- w will wipe off all the data on your device. So make sure to have a backup beforehand.

The difference between mine (above command) and the below command is that I have provided the commands to flash the partition files to both the slots (since these are the A/B partition) devices. But it seems flashing the files to just the single partition seems to do the j0b for some, at least for the OnePlus 7T users. For me, though, the above commands that instruct to flash files to both the slots worked out.

I haven’t tried out the below command on my deivce and hence cannot comment much on that. With that said, I would continue to update this guide as and when I find more useful information about the same. In the meantime, you could try out the below commands to Restore OnePlus 7/7T/7T Pro Stock ROM via Fastboot Commands.

fastboot -w
fastboot flash aop aop.img
fastboot flash bluetooth bluetooth.img
fastboot flash boot boot.img
fastboot flash dsp dsp.img
fastboot flash dtbo dtbo.img
fastboot flash LOGO LOGO.img
fastboot flash modem modem.img
fastboot flash oem_stanvbk oem_stanvbk.img
fastboot flash qupfw qupfw.img
fastboot flash storsec storsec.img
fastboot flash multiimgoem multiimgoem.img
fastboot flash uefisecapp uefisecapp.img
fastboot flash recovery recovery.img
fastboot --disable-verity flash vbmeta vbmeta.img
fastboot --disable-verity flash vbmeta_system vbmeta_system.img
fastboot flash opproduct opproduct.img
fastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash product product.img
fastboot reboot

Do keep in mind that the first boot might take up some time. It is completely normal. Furthermore, you might have to set up your device from scratch as a complete device wipe has taken place. On that note, let us know in the comments if you have any other queries related to the aforementioned steps. On that note, we conclude this guide to how to restore your OnePlus 7/7T/7T Pro device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

Unbrick OnePlus 7/7T/7T Pro via Fastboot Enhance

This is a tool created by XDA Senior Member xzr467706992 and beholds a slew of intriguing features, including the ability to directly flash the payload.bin file, without the need to even manually extract it first. Do note that even though this tool was created for OnePlus 8T but it should work across other OnePlus devices too. [Well, I have personally tested it on OnePlus 7T and OnePlus 10 Pro, it works well and good even on those devices].

STEP 1: Download Fastboot Enhance Tool

Download the Fastboot Enhance Tool from GitHub [direct link]. Once downloaded, extract it to any convenient location on your PC. The biggest advantage of this tool is that you could directory flash the payload.bin file, there is no need to extract it and get the resultant IMG files!

Unbrick OnePlus 7

STEP 2: Download OnePlus OnePlus 7/7T/7T Pro ROM

  1. Next up, get hold of the firmware for your device from below:
    OnePlus 7/7T/7T Pro Stock Firmware
  2. Once downloaded, extract it and transfer the resultant payload.bin file to the Fastboot Enhance Tool folder.
    Unbrick OnePlus 7

STEP 3: Install Android SDK

Next up, install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform tools folder, which will be used throughout this guide.

install adb platform tools windows

STEP 4: Install Fastboot Drivers

The tool doesn’t come with the Fastboot Drivers, so you will manually have to install it on your PC. For that, please refer to our guide on How to Install Fastboot Drivers in Windows 11. Likewise, make sure to install the OnePlus USB Drivers as well [they are usually automatically installed as soon as you connect your device to the Windows PC for the first time].

Unbrick OnePlus 7

STEP 5: Boot to Fastboot Mode

  1. Since your device is currently in a brick state, you wouldn’t be able to use the adb reboot bootloader command to boot your device to Fastboot Mode. Rather, you will have to take the help of the Hardware key combinations to get this job done.
    Unbrick OnePlus 7
  2. Once booted, type in the below command and you should get back the device ID. This signifies that the Fastboot connection stands successful.
    fastboot devices

    oneplus 7 pro android 13

STEP 6: Flash Downgrade Firmware on OnePlus 7/7T/7T Pro via Fastboot

  1. To begin with, launch the Fastboot Enhance Tool via its EXE file.
    Unbrick OnePlus 7
  2. Your device should be listed under the Fastboot Virtualization tab,  select it.
    Unbrick OnePlus 7
  3. After that, click on the Reboot to FastbootD button.Unbrick OnePlus 7
  4. Your device will boot to FastbootD Mode.Unbrick OnePlus 7
  5. Now go to the Payload Dumper tab and click on Browse.
    Unbrick OnePlus 7
  6. Navigate to the payload.bin file, select it and click Open.Unbrick OnePlus 7
  7. The file will now be loaded in the tool, displaying the resultant information.
    Unbrick OnePlus 7
  8. Now go to the Fastboot Virtualization tab and click on Flash payload.bin. If the flashing starts, well and good.
    Unbrick OnePlus 7
  9. However, if you get the ‘Virtual A/B temporary partitions exist’ popup, then click on No.
    Unbrick OnePlus 7
  10. After that, go to the Partitions tab and type in cow in the Filter by name box.
    Unbrick OnePlus 7
  11. Select all the partitions from the results that have cow in their name and hit the Delete button.
  12. Once done, click on Flash payload.bin. This time the flashing will start without any issues.
    Unbrick OnePlus 7
  13. Once complete, you will be notified of the same. You may now boot to the OS by clicking on Reboot to System.
    Unbrick OnePlus 7

Share:
  • Thanks a lot..

  • Hello!
    I bricked my phone after unrooting it and locking the bootloader. The software is corrupted, I was at android 11. It does go to fastboot mode, Can I use this method to install stock rom on my device or msm method? Please help.

  • Sorry for this newb question but does this process require unlocked bootloader?

    • Well if you’re trying to restore stock OOS, that means 99% chances are you’re already have unlocked bootloader, because the reason to restore is when you have custom OS on your phone, which needs unlocked bootloader in first place.

  • Hi!

    I installed YouTube Vanced through their manager app via root (magisk) and then (for some reason) installed microG from magisk, thinking it is the same microG that vanced uses.

    Now that didn’t work so I uninstalled the module and in doing so somehow play store and services were converted into user apps. I flashed the ROM once but they didn’t switch to system app so I uninstalled them (dunno what I was thinking).
    I flashed the ROM by downloading it from oxygen updater and flashing it in settings and then install magisk again from the app, but play store and services don’t come back.

    I tried the flashing process 2-3 times, so pretty sure I have flashed it on both partitions by now, but no luck. I am on OOS 11.0.1.1. Now everytime I try opening any G apps like movies or music, it says play services not found.

    I don’t know if this method will fix the issue, because I don’t know why flashing the stock ROM from updater app doesn’t restore play services. Any ideas?

  • Hey Sadique, hope you are doing well. I have a question:
    the unlock critical command doesn’t seem to work for me. It does not give me any error when I try to run it, it just gives me a list of fastboot commands (as if the command is not recognized).
    then of course when I try to flash some of the img I get “Flashing is not allowed for critical partitions”.
    Any thoughts on what I can do?
    Additional details:
    – I have a Oneplus 7 Pro, EU variant.
    – I am trying to come back to stock from lineageOS
    – Device is unlocked (did as part of the official installation guide of LineageOS, using fastboot oem unlock command).
    Your advice would be greatly appreciated.

  • Hi Sadique,
    I ran into issues while flashing new ROM on my OP7pro. It was already rooted with magisk and on custom rom (android11).
    Now i am stuck in fastboot mode . Flash recovery twrp img etc is working but I am unable to boot into the TWRP.
    fastboot boot twrp.img also sends me back into fastboot.
    I don’t have backup of the latest data and have kept wipe storage as last resort.
    Any suggestions to boot into TWRP from fastboot ?
    Thanks in advance .

    • Sadique Hassan

      Hi Rajesh, as far as I know, fastboot boot twrp.img is the correct command to boot to TWRP. Are you getting any error messages after executing this command?

  • hello i have a problem with partitions take a look

    “\platform-tools>fastboot flashing unlock_critical
    FAILED (remote: ‘ Device already : unlocked!’)
    fastboot: error: Command failed

    \platform-tools>fastboot flash aop_a aop.img
    Sending ‘aop_a’ (200 KB) OKAY [ 0.019s]
    Writing ‘aop_a’ FAILED (remote: ‘Flashing is not allowed for Critical Partitions
    ‘)
    fastboot: error: Command failed”

    i don’t know what’s wrong

  • bro this worked like a charm but worked in 2nd step thanks a lot

  • Hi Sadique,
    Firstly thanks for this incredible guide. I’ve tried all methods and this is the one that is the most noob-friendly guide. thank you.
    The extracted files from the payload.bin have more than what you showed here or used in your fastboot flashing, such as “cmnlib” or “opproduct”, etc. are those not necessary to flash?

    • Sadique Hassan

      Hi Daniel, thanks for the appreciation. Yes, we don’t need to flash all the files that we get after extracting the payload.bin file.

  • The first set of commands works great on OnePlus7 Pro with OEM Oxygen 10. The only addition I needed to make was a file called odm.img 104.9mb in size. I did the “fastboot flash odm_a” and “fastboot flash odm_b” for this file and then the above worked. I did this step last, right before rebooting to bootloader. I hope this helps someone that is stuck! As OnePlus rolls out newer versions, there might be more files in the bin file, so if it’s not working, you can try to double check you’re uploading everything to your device. If it doesn’t take the file, it will tell you on the Terminal/CMD prompts. No real risk here. Thanks for the article, Sadique. I keep coming back to it when my TWRP + Lineage 17.1/18.1 + Magisk zip file uploads crap out on me. Does anyone have TWRP working on Lineage 18.1 AND have Magisk working for a “de-googled” OnePlus 7 Pro? I don’t have to have TWRP, but it makes ROM changes a little easier.

    • Sadique Hassan

      Thanks a lot Nathan for letting us know. This comment will definitely help other users as well.

  • and even:

    >fastboot flash system_a system.img
    Invalid sparse file format at header magic
    Sending sparse ‘system_a’ 1/2 (786292 KB) OKAY [ 18.340s]
    Writing ‘system_a’ FAILED (remote: ‘Partition not found’)
    fastboot: error: Command failed

  • thank you for the guide above, some of the lines had these errors:
    —–
    >fastboot flash bluetooth_b bluetooth.img
    Sending ‘bluetooth_b’ (828 KB) OKAY [ 0.024s]
    Writing ‘bluetooth_b’ FAILED (remote: ‘Flashing is not allowed for Critical Partitions
    ‘)
    fastboot: error: Command failed
    —–
    is there any way round this?

    • Sadique Hassan

      Hi mate, sorry for the late reply, was down with ill health. Coming back to your query, have you unlocked the critical partitions. If not, you may do so via fastboot flashing unlock_critical BUT IT WILL WIPE THE DATA, so take a backup beforehand.

  • Pandalion

    Hey I’m having an issue flashing the system partitions. I tried both sets of commands and it always gives me

    writing ‘system’ FAILED (remote: ‘Partition not found’)
    fastboot: error: command failed

    • Sadique Hassan

      Hi Pandalion, could you try rebooting from fastboot to fastbootd using fastboot reboot fastboot and then retry executing the command that was giving out the error.

  • Hi, I fail on the wipe step and then when I try the next step it just sits forever on fastboot flash aop_a aop.img

    fastboot -w

    gave

    wiping userdata…
    Erase successful, but not automatically formatting.
    Can’t determine partition type.
    FAILED (remote: unknown command)
    erasing ‘userdata’…
    FAILED (remote: Check device console.)
    finished. total time: 0.004s

    • Sadique Hassan

      Hi Joel, I have also shared a second set of commands under the Alternate Commands section. Those set of commands doesn’t take into consideration the partition types. Could you please try that and let me know the results as well.
      EDIT 1: I also found out that the issue could well be the USB cable as well. So make sure that you are using the official cable that shipped in with your device. Moreover, use the USB 2.0 Port on your PC and not USB 3.0.

  • Hey Hassan,

    Thanks for the tutorial! Before I proceed to do any of this, I wanted to know if there was an alternative for my mess up. So, I was fiddling around with this Uninstaller app, and removed Netflix app that came as a system app on my OP 7T Pro via root. Now after the reboot, my screen just goes blank after unlock and I can just see the status bar ! Is there a way to fix this without having to flash the stock? PS: I do not have any back ups.

    • Sadique Hassan

      Hi Rohan, you could try installing the Netflix app and then converting it to the system app (since the device is rooted, you may change the permission for this conversion). I know it’s just the opposite of what you wanted to do in the first place, but apart from flashing the firmware, this workaround seems to be the only way out. )

  • Hi there! It seems that my phone is not being detected by either ADB or Fastboot. The USB Debugging thing was not enabled prior to my phone bricking. Any help? Thanks.

    • Sadique Hassan

      Hi Miguel, for ADB you don’t need USB Debugging. With that said, are you able to boot to Fastboot? If not, then you will have to boot to EDL and then unbrick it via MSMTool.

  • PLEASE PLEASE I NEED HELP!!

    [Link Retracted by Author]

    Thank you, Eduardo!!!

    • Sadique Hassan

      Hi Eduardo, the image that you have shared seems to suggest that you went for the second set of commands. Could you proceed with the first set of commands that instructs to flash the partition files to both the slots. Then let me know the results.

  • Deep Lathia

    I came across xda thread that had a similar process but different flow in the way commands are fired:

    (Commands added to the guide by the author to shorten the comment)

    This flow did not gave me any errors as such and i was able to flash the rom.

    • Sadique Hassan

      Hi Deep Lathia, thanks for letting me know, I have updated the guide accordingly. I still need to do some search as to how the A/B partition devices is able to accept these commands. Anyways, since it worked for you, it may work for others as well. Thanks again!

  • Thanks for your post.

    My screen device broke this morning and I’m unable to execute wipe.

    fastboot -w
    Erasing ‘userdata’ FAILED (remote: ‘Erase is not allowed in Lock State’)

    I can’t go to developer options because I don’t have screen. Chicken and egg situation?

    • Hey man, have you gotten any fixes for this? I’m now experiencing the same thing. Thanks!

    • Sadique Hassan

      Hi Ivan, I guess we could still avoid this Chicken and Egg situation! On a serious note, you could try flashing the encrypted stock firmware on your device via MSM DOwnload Tool as given in this guide: Unbrick Your OnePlus and bring it back from a Dead State: OnePlus 7, 7T, 7 Pro or 7T Pro. Just keep in mind that the guide has been mentioned assuming the device to be bricked or Qualcomm crash dump mode and already in EDL Mode. Since that isn’t the case with your device, you could manually boot it to EDL via the fastboot oem edl command and then flash the decrypted firmware via MSM Tool, as instructed in the linked guide.

  • do you have video of this working

    • Sadique Hassan

      Not yet Paulo. Could you let me at what step you are stuck in?

      • after fastboot reboot fastboot

        fastboot: error: Failed to boot into userspace fastboot; one or more components might be unbootable.
        then i move to next step >fastboot flash system system.img
        it said
        Invalid sparse file format at header magic
        Sending sparse ‘system’ 1/3 (784720 KB) OKAY [ 17.682s]
        Writing ‘system’ FAILED (remote: ‘Partition not found’)
        fastboot: error: Command failed
        what to do??????????