Home > Tips and Tricks

How to Extract Stock Boot.img from OnePlus OxygenOS Stock ROM

UPDATE 1: Added a new method to Extract Stock Boot.img from OnePlus OxygenOS Stock ROM [See METHOD 2: Extract 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 tutorial, we will show you the steps to extract stock boot.img from the OnePlus device’s OxygenOS stock ROM. This tutorial is valid for all the OnePlus devices whose stock firmware consists of the payload.bin file. Well, as of now, near about every OnePlus devices follow this format. Furthermore, when you download the stock firmware, you would see it to be in a ZIP format. But when you extract the contents, you wouldn’t find boot.img, vendor.img, system.img, and other such files.

Rather, there would be a compatibility ZIP file, a META-INF folder, a text file, a PB file, and most importantly the payload.bin file. So where are the aforementioned IMG files? Well, they are packed inside the payload.bin file and you cannot extract them via WinZIP or WinRAR. For that, you will need Python and a Decrypt Tool. In this guide, we will show you how to extract stock boot.img from the OnePlus device’s OxygenOS stock ROM. But first, let’s check out the need to carry out this process.



Why Extract OnePlus OxygenOS Stock Firmware Payload.bin?

Android OS, thanks to its open-source ecosystem allows you to carry out a plethora of tweaks. The everyday users might be contained with installing a custom launcher, using different font styles, and changing the icon packs. On the other hand, tech enthusiasts take this a step further. After unlocking the device’s bootloader, they flash custom ROMs like AOSP and Pixel Experience, install custom recoveries like TWRP or gain access to the system partition. The latter is possible by rooting their device via Magisk.

extract boot.img payload.bin oxygenos rom

This in turn takes two different approaches: via TWRP and without TWRP. In the case of the former, you just need to flash the Magisk Installer ZIP file. While the latter calls for extracting stock boot.img, patching it via the latest Magisk Manager (that now support for Android 11) and flashing it via Fastboot. So everyone should go for the first method, right? Well, the option isn’t always in the user’s hand. This is because not every Android device has a TWRP build.

And while you could expect devices from OnePlus to have one, it would take some time to be available. Even the unofficial builds might take a month or two (depending on the release of the kernel source). As a result, people prefer to root their device using the method that doesn’t involve TWRP. The first step for which requires you to grab hold of the stock boot.img file. In earlier days, OEMs used to upload their firmware in a simple ZIP format, extract it and grab hold of the required files. However, now things have changed.

OnePlus uses payload.bin, Realme and Oppo use OZIP, and so on. As for this guide, our focus will be on the former. In this guide, we will show the steps to extract stock boot.img from the OnePlus device’s OxygenOS stock ROM. After this, you may patch it via Magisk ad flash it via Fastboot to the desired slot. Follow along for the complete instruction steps. If you have an OnePlus Nord, then you could directly download the stock boot.img file from here as well: Download OnePlus Nord Stock Boot Image Files [All Versions].

Method 1: Extract payload.bin File via Payload Dumper

Before we list out the instruction steps, there are a couple of prerequisites that you need to go through. Make sure to checkmark all the requirements and only then proceed with the steps to extract stock boot.img from the OnePlus device’s OxygenOS stock ROM. Follow along.

Prerequisites


STEP 1: Install Python on your PC

  1. Launch the Python EXE set up file. 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.
    Setup-Success

STEP 2: Install Payload Dumper file

Let’snow move onto the next step to extract stock boot.img from the OnePlus device’s OxygenOS stock ROM. Now that you have installed Python, you could proceed with the extraction of the Payload.bin file from OnePlus OxygenOS stock firmware and then get the stock boot image file. For that, we will be making use of the Payload Dumper Tool. Follow the below steps for that:

  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 3: 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 three files: boot, system, and vendor. In some cases, you could also get dtbo, and a couple of other files as well.
    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

    oneplus-payload-bin-output-folder

METHOD 2: Extract 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 boot.img from payload.bin oneplus
  6. Now head over to that folder’s address bar, type in CMD, and hit Enter. This shall launch the Command Prompt window.
    extract boot.img from payload.bin oneplus
  7. Type in the below command to extract the payload.bin file:
    payload-dumper-go payload.bin

    extract boot.img from payload.bin oneplus

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

That is it. You could now make use of the boot.img file and proceed to root your device by patching via Magisk and flashing the patched boot image file via Fastboot. So with this, you have successfully extracted the payload.bin file and got the stock boot image file via the Payload dumper tool and Python. And this concludes our guide on how to extract the stock boot.img from the OnePlus device’s OxygenOS stock ROM. If you still have any queries, do let us know in the comments section below.

Share: