Home > OnePlus

How to Extract Stock Recovery from OnePlus OxygenOS Stock ROM

UPDATE 1: Added a new method to Extract Stock Recovery.img from OnePlus OxygenOS Stock ROM [See METHOD 2: Extract OnePlus Recovery from Payload.bin via Payload Dumper Go]. As of now, we would recommend you over for this method only as it doesn’t require Python or any other setup as such. Moreover, the entire process hardly takes a few seconds!


In this guide, we will show you the steps to extract the stock recovery file from the OnePlus OxygenOS stock ROM. [Looking for OnePlus Stock boot.img file? Checkout this guide: Extract Stock Boot.img from OnePlus OxygenOS Stock ROM]. Well, it is no hidden secret that Android is an open-source operating system. The beneficiaries of the same are the end-users.

From installing custom launchers to icon packs and themes, the possibility stands endless. Then if you take this to the custom development, the option gets further multiplied. Furthermore, if you have an OnePlus device, then it’s the ultimate icing on the cake. The reason? Well, these devices are known to be among the most active players in the tweaking domain.

Once you have bypassed the sole restriction (a locked bootloader), you open the floodgates to the plethora of opportunities. For example, you could install custom ROMs, replace the device’s stock recovery with a custom one like TWRP. Along the same lines, you could even gain access to the system partition by rooting it via Magisk. This then allows you to flash tons of Magisk Modules and Substratum Themes.

However, there is just one issue that might bug a few users. OnePlus packs in most of its firmware files in payload.bin. Hence if you would like to get a hold of stock partition files such as vbmeta.img, boot.img, or recovery.img, it might prove to be a challenging task. Well, not anymore. Given here are the detailed instructions to extract the stock recovery file from the OnePlus stock OxygenOS ROM.



The Need for an OnePlus Stock Recovery file

So this might be one genuine query that you all may ask- why would we ever need to carry out this task. Well, the question is completely genuine and so it definitely deserves an explanation. The main reason to grab hold of the stock recovery file is when you wish to get rid of TWRP. In other words when you wish to uninstall the TWRP Recovery and get back to the stock recovery that came with your device, then this is the only file that you would need.

extract stock recovery.img oneplus stock rom oxygenos

But getting this file is no easy task in itself. Though OnePlus does an excellent job in uploading the stock firmware for all its devices over to their website, there might be one concerning factor for some. Although the firmware is uploaded in ZIP, all the required partition files are inside the payliad.bin file. And you can not extract these files via WinRAR/WinZIP or other such tools.

So this is why I decided to cover up this article. By performing the below steps, you will easily be able to extract the patyload.bin file of OnePlus ROM and get the desired partition files. So without further ado, here are the instructions to extract the stock recovery file from the OnePlus stock OxygenOS ROM. Follow along for the detailed instructions.



METHOD 1: Extract Stock Recovery from OnePlus Stock OxygenOS ROM via Payload Dumper

The entire instructions have been written in separate sections for ease of understanding. Proceed ahead in the exact same sequence as mentioned:

STEP 1: Download the Required Files

  • First and foremost, for extracting the Payload.bin file, you will need the Payload Dumper Tool. We would like to thank Gregory Montoir for creating this tool. You could download it from the following link: payload_dumper.zip
  • Next up, you should also have to install Python on your PC. Download Python v3.8.5 (latest version at the time of writing). Once you have downloaded both these files, proceed to the next step to check out their installation steps.

STEP 2: Install Python

  1. Launch the Python EXE setup file that you have downloaded. It will then ask for the installation directory. Click on Install Now if you wish to proceed with the default one, which would make it easier for you to follow this guide. Or you could also click Customize Installation if you want to change the directory.
    python setup
  2. Whatever installation directory you end up choosing, make sure to keep a note of it as it will be needed later on. The installation process will be completed within a minute or two. When that is done, hit the Close button to exit the setup wizard. Now move to the next step and proceed to extract the stock recovery file from the OnePlus stock OxygenOS ROM.
    Setup-Success

STEP 3: Install Payload Dumper file

Now that you have installed Python, you could proceed with the extraction of the Payload.bin file from the OnePlus OxygenOS stock firmware and then get the stock recovery image file. For that, we will be making use of the Payload Dumper Tool. Here are all the required instructions on how to use this tool

  1. Extract all the contents of the Payload Dumper Tool inside the folder where you have extracted Python.
  2. If you have chosen the default directory while installing Python, then the contents should be extracted inside:
    C:\Users\USER-NAME\AppData\Local\Programs\Python\Python <version number>

STEP 4: Extract Payload.Bin

  1. To begin with, extract the downloaded OnePlus Stock ROM. It would be in ZIP format, so you could use WinZIP or WinRAR to extract it. Once the extraction is complete, you should see a couple of files, including the payload.bin.
    oneplus stock rom payload bin
  2. Copy the payload.bin file from the extracted firmware and move it to the folder where you have installed Python.
    payload-bin-extract-oxygenos-oneplus
  3. Hence, this directory will now have the Payload Dumper Tool, the payload.bin file, and the Python software.
  4. Inside the same folder, type in CMD in the address bar and hit Enter. This will launch the Command Prompt.
    python cmd window
  5. Type in the below command to install the necessary dependencies:
    python -m pip install -r requirements.txt

    payload-bin-dumper-inside-python

  6. Finally, execute the below command to extract all the contents of the payload.bin file. It will take some time, depending on the size of the package. [Facing issues? Check out our detailed guide: Fix: pip is not recognized as an internal or external command].
    python payload_dumper.py payload.bin
  7. In our case, the payload.bin file gave us the boot, system, vendor, recovery, dtbo, and many other partition files in IMG format. Below is just an example of a few of these files in the CMD window.

    TIP: Extracting of system.img takes some time. So if you are only looking for recovery.img, then hit the Ctrl+C shortcut to terminate the rest of the commands once you get the stock recovery file.

    stock-boot-img-payload-bin-oneplus-oxygenos

  8. Once the process is complete, all the extracted files are placed inside a folder named Output. If you have installed python in the default directory, then the location of the output folder will be:
    C:\Users\USER-NAME\AppData\Local\Programs\Python\Python<version-number>/Output

    extracted recovery.img from payload.bin

  9. That’s it. Copy this recovery.img file, transfer it to the ADB directory and flash it onto your device.

METHOD 2: Extract OnePlus Recovery from Payload.bin via Payload Dumper Go

  1. To begin with, download the payload-dumper-go 1.0.0 from Github [Credits: XDA Member ssssut].
  2. Then extract it to any convenient location on your PC. The name of the file will be something like payload-dumper-go_1.0.0_windows_amd64. Rename it to payload-dumper-go.
  3. Next up, download the liblzma-5.dll file and transfer it to the same folder where the payload-dumper-go.exe file is present.
  4. After that, transfer the payload.bin file to this folder as well.
  5. So as of now, you should have the payload-dumper-go.exe, payload.bin, and liblzma-5.dll files all under one folder.
    extract stock recovery oneplus payload.bin
  6. Now head over to that folder’s address bar, type in CMD, and hit Enter. This shall launch the Command Prompt window.
    extract stock recovery oneplus payload.bin
  7. Type in the below command to extract the payload.bin file:
    payload-dumper-go payload.bin

    extract stock recovery oneplus payload.bin

  8. The extraction process will now begin and would only take a few seconds.
    extract stock recovery oneplus payload.bin
  9. Once done, all the extracted files will be placed under a folder named extracted_date_time that is created inside that directory.
    extract stock recovery oneplus payload.bin

So with this, we conclude the guide on how to extract the stock recovery file from the OnePlus stock OxygenOS ROM. If you have any queries concerning the aforementioned steps, do let us know in the comments section below. We will get back to you with a solution at the earliest.


Share: