Extract Stock Boot.Img From OnePlus OxygenOS Stock ROM
Here, we’ll walk you through the steps of extracting stock boot.img from the OxygenOS stock ROM of OnePlus devices. All OnePlus devices which have the payload.bin file as part of their stock firmware can use this tutorial. It seems that OnePlus devices, as of now, follow this format on a relative basis. Furthermore, you will find that when you download the stock firmware, it is in ZIP format. Nevertheless, you will not find boot.img, vendor.img, system.img, or other files when you extract the contents.
Instead, there would be a compatibility ZIP file, a META-INF folder, a text file, a PB file, and most importantly, a payload.bin file. Are the IMG files aforementioned where they should be? You can’t extract them via WinZIP or WinRAR because they’re packed inside the payload.bin file. It will be necessary to use Python along with a Decrypt Tool for that. This guide will show you how to extract stock boot.img from OxygenOS stock ROM for OnePlus devices. The first thing we need to do is determine why the process is necessary.
What is the purpose of extracting the OnePlus OxygenOS Stock Firmware Payload.bin?
Android OS offers a wide range of customization options thanks to its open-source ecosystem. The everyday user might be limited to installing a custom launcher, changing the font style, and changing the icon packs. Those who are tech enthusiasts, however, go a step further. When a device’s bootloader is unlocked, custom ROMs like AOSP and Pixel Experience are flashed, custom recovery apps like TWRP are installed, or the system partition can be accessed. By rooting their device using Magisk, they can achieve the latter.
As a result, there are two different approaches: via TWRP and without TWRP. With the former, all you need to do is flash the Magisk Installer ZIP file. The latter requires extracting the stock boot.img, patching it with Magisk Manager (which now supports Android 11) and flashing it via Fastboot. The first method should be preferred by everyone, isn’t it? In fact, the option isn’t always in the user’s hands. The reason for this is that not every Android device has a TWRP build installed.
There is a possibility that OnePlus devices may include one in the future, but the availability would take some time. It might even take a month or two for the unofficial builds to be released (depending on when the kernel source is released). Due to this, people prefer methods that don’t require TWRP to root their devices. This requires you to obtain the stock boot.img file as a first step. Earlier, OEMs uploaded their firmware as ZIP files, which they would extract and grab hold of the files they needed. The situation has changed now, however.
There are a number of different file formats used by OnePlus, including payload.bin, OZIP, Realme, and Oppo. For the purposes of this guide, we’ll focus on the former. Our guide will show you how to extract the stock boot.img from the OnePlus device’s OxygenOS stock ROM. In this case, you need to patch it via Magisk and flash it via Fastboot to the desired location. To follow the instructions in its entirety, follow along with the steps below. You can also download the stock boot.img file directly from here: Download OnePlus Nord Stock Boot Image Files [All Versions].
Method 1: Extract payload.bin File via Payload Dumper
There are a couple of prerequisites you need to meet before we get to the instruction steps. Be sure to checkmark all the requirements before continuing with the steps to extract the stock boot.img from the OxygenOS stock ROM for the OnePlus device. Let’s follow along.
The Payload Dumper Tool is required for extracting the Payload.bin file. Gregory Montoir created this tool, which we would like to thank. Payload_dumper.zip can be downloaded from this link: payload_dumper.zip
The same applies to installing Python on your computer. For the most recent version of Python, download Python v3.8.5.
STEP 1: Install Python on your PC
Start the Python set-up file by clicking the EXE file. After that, it will ask for the installation directory. You can proceed with the default one by clicking on Install Now, which makes this guide easier to follow. If you would like to change the installation directory, click Customize Installation.
No matter what installation directory you choose, keep it handy because you’ll need it later. Within a minute or two, the installation process will be complete. In order to exit the setup wizard, hit the Close button once that has been completed.
STEP 2: Install the Payload Dumper file
OnePlus’ OxygenOS stock ROM then needs to be extracted to get its stock boot.img. Having installed Python, you can proceed with extracting the Payload.bin file from the OnePlus OxygenOS stock firmware and getting the stock boot image file. This will be accomplished using the Payload Dumper Tool. Here are the steps you need to follow:
- Once Python has been extracted, extract the contents of the Payload Dumper Tool into the same folder.
- If you chose the default directory when installing Python, then you should extract the contents to:
C:\Users\USER-NAME\AppData\Local\Programs\Python\Python <version number>
STEP 3: Extract Payload.Bin
- In order to begin, you will need to extract the OnePlus Stock ROM. It will be in ZIP format, so you will need WinZip or WinRAR to do this. When the extraction is complete, you should see a few files, including payload.bin.
- The payload.bin file should be moved to the Python folder where you have installed Python.
- This directory will now contain the Payload Dumper Tool, the payload.bin file, and the Python software.
- CMD can also be found in the same folder if you type it in the address bar and hit Enter. Using this command will launch the Command Prompt.
- You can install the dependencies by typing in the following command:
python -m pip install -r requirements.txt
- Finally, run the below command to extract all the contents of the payload.bin file. The size of the package will determine how long it takes.
python payload_dumper.py payload.bin
- We were able to obtain three files from payload.bin: boot, system, and vendor. Dtbo and a couple of other files may also be included in some cases.
- As soon as all files have been extracted, they will be placed into a folder named Output. In the case where Python is installed in the default directory, the output folder will be located as follows:
METHOD 2: Extract Payload.bin via Payload Dumper Go
Start by downloading payload-dumper-go 1.0.0 from Github [Credits: XDA Member ssssut].
Once the file has been downloaded, you can extract it anywhere on your computer. Filenames will be something like payload-dumper-go_1.0.0_windows_amd64. The file should be renamed to payload-dumper-go.
The next step is to download the liblzma-5.dll file and copy it to the same folder as the payload-dumper-go.exe file.
Once that has been done, transfer payload.bin to this folder as well.
Currently, you should have payload-dumper-go.exe, payload.bin, and liblzma-5.dll in one folder.
- Then type CMD into the address bar of that folder, and hit Enter. Upon clicking this, you will be prompted to open the Command Prompt.
- You can extract the payload.bin file by typing the following command:
- Now, you can start the extraction process which will only take a few seconds.
- As soon as the extraction process is complete, all the extracted files will be placed in a folder named extracted_date_time.
There you have it. In order to root your device, you need to patch via Magisk and flash the boot.img file via Fastboot after having made use of the boot.img file. With this, you have successfully extracted the payload.bin file and obtained the stock boot image file via the Payload dumper tool and Python. In conclusion, we have shown you how to extract the stock boot.img from OnePlus’ OxygenOS stock ROM. Let us know if you still have questions in the comments section below.