The Android operating system is one of the best-operating systems when it comes to customization. You can do pretty much everything from changing the UI to making some tweaks in the OS itself all thanks to its open-source environment. Today we are focusing especially on how to extract the stock boot.img file from OnePlus OxygenOS.
In this article, I will teach you how to extract the stock boot.img file from OnePlus device’s stock ROM. This guide will work for all of the OnePlus devices as most of them follow pretty much the same structure. That is all of them consists of a payload.bin file in the stock firmware.
The thing is, when you download the stock firmware, it comes in a ZIP format. When you will extract the content, you won’t see boot.img, vendor.img, system.img, and files like these. Instead you will see a compatibility ZIP file, a META-INF folder, a text file, a PB file, and the payload.bin file which is actually the most important file.
You just can’t simply extract the IMG files using WinZIP or WinRAR. You will need a decrypt tool and Python. Every IMG file that you will need is in the payload.bin.
Why Extract the Payload.bin?
As mentioned earlier, Android devices are very good for customization. They can be customized on both the basic level which is changing the UI, themes, fonts, etc. On the other hand, many curious people who are into customization take the game to the next level. They unlock the device’s bootloader. Once you do that, you can flash custom ROMs, install custom recoveries like TWRP, or gain access to the system partition by rooting their device using Magisk.
So basically, there are two ways to do it, either with TWRP or without TWRP. The first one is quite simple. All you have to do is flash the Magisk installer ZIP file.
The second one is quite a process as you need to extract the stock boot.img file, then patch it via the latest Magisk Manager. Then finally flashing it via Fastboot. Now the first option looks easy, right? Well, it is not in your hands to select it as every Android device does not have a TWRP build.
The general consensus of people prefer to root their smartphones without the use of TWRP. Now that requires the boot.img file. Earlier it was easy as all the smartphone manufacturers used to upload their firmware in a simple ZIP format but it is a bit different now.
In this article, our focus is on OnePlus which uses payload.bin. I will guide you to extract the stock boot.img file from OnePlus OxygenOS and upon successful extraction, you can easily patch the file via Magisk and then flash it via Fastboot in your desired slot.
Extract The Stock Boot.img File From OnePlus Oxygen OS
Extracting the payload.bin File
- You will need a Payload Dumper Tool. You can download it from the link given below:
- You will also need Python on your computer. You can download Python from the link given below:
Step 1: Download the Python EXE file from the link given above and upon successful download, launch the file.
Step 2: Click on ‘Install Now’ after selecting the location to install the file. It is recommended to select the default location.
Step 3: The setup will take a minute or two to install, upon successful installation, click on the ‘Close’ button.
That’s it and just remember the location where you have installed Python.
Installing Payload Dumper
Step 1: Download the ZIP file of Payload Dumper from the link given above.
Step 2: Upon successful download, extract all the files inside the ZIP folder to the same location where you have installed Python.
If you have selected the default directory while installing Python, the content should be extracted to the location, “C:\Users\USER_NAME\AppData\Local\Programs\Python\Python<version_Number>”
Extracting Payload.bin File
Step 1: Extract the downloaded OnePlus Stock ROM. It will be in a ZIP format so you can use WinRAR or WinZIP to extract it. Upon successful extraction, you will see payload.bin along with some other files.
Step 2: Copy the payload.bin file and paste it in the exact same folder where you have installed Python. It means that the folder will have Python, the Payload Dumper Tool, and the payload.bin file in the same place.
Step 3: In the same folder, go to the address bar and type “CMD”. It will open the command prompt.
Step 4: Type in the following command and hit enter,
python -m pip install -r requirements.txt
Step 5: Now type in the following command and hit enter,
python payload_dumper.py payload.bin
This will extract the contents of payload.bin file.
Step 6: In most cases, users get three files: boot, system, and vendor. In some cases, users also get dtbo and some other files as well.
Step 7: Once this process is completed, you can access all the extracted files in 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”.
So that was all about how to extract the stock boot.img file from OnePlus Oxygen OS. You can now use this file to root your device. If you face any difficulty, do let us know in the comments.