Home > Tips and Tricks

How to Extract payload.bin and get stock boot image file

In this tutorial, we will show you how to extract the payload.bin file so that you may get the stock boot image (boot.img) and other firmware files. Earlier, the OEMs used to provide all the stock firmware files inside a single zip file. All you had to do is just extract that stock firmware ZIP and all the necessary files will be right in front of you. While some OEMs still follow this rule, others like the OnePlus don’t. And this is where it might issue trouble for quite a lot of users. Don’t Miss: How to Extract OZIP Realme Stock ROM (Firmware)

The thing is all the important stock firmware files are now bundled inside the payload.bin file. This file cannot be simply extracted using WinZip or WinRAR, etc. They require a specific set of applications in the form of the Payload Dumper Tool and Python. But simply installing both of these tools wouldn’t do any good. There are quite a few steps involved if you wish to extract the contents of the payload.bin file. And in this regard, this guide will come in handy.

Today, we will show you how to extract the payload.bin and get the stock boot image and other important partition files. But before we do so, it is also important to understand why you might need to carry out the aforementioned task. In the below section, we will first discuss the need (importance) to (of) extract this payload.bin file. After which the steps to get hold of the stock boot.img file via Payload Dumper and Python will be mentioned. Follow along.

The Need to Extract payload.bin File using PC

extract payload bin android without pc

To begin with, Payload.bin holds three of the most important partition files- system.img, boot.img, and vendor.img. After coming back from a GSI to stock ROM, you might need to flash the system.img file (Read: How to Go Back to Stock ROM from GSI ROM). Vendor image, on the other hand, contains device-specific hardware drivers.

But it is the boot.img file that might be of interest to a lot of users out there. You see, with an open-source ecosystem like Android, there are a plethora of customizations to try out. Right at the top is the ability o gain administrative-level privileges in the form of the root. And to root your device, there exist two different methods: using TWRP and without TWRP.

As of now, many users prefer to go with the latter method. This is because there is no working TWRP Recovery for a lot of Android devices. Hence if you wish to root without TWRP, the first prerequisite is to get your hands on the device’s stock boot.img file. Once that is done, you could easily patch it via Magisk and then flash it via fastboot commands.

However, as mentioned before, OEM now compiles all these files (including boot.img) inside the payload.bin file. So to root your device, you will anyways have to extract the payload.bin file. In this regard, the best way out is to use the Payload Dumper Tool and Python installed on your PC. Here are the complete instructions set to extract payload.bin and get the stock boot image file.

METHOD 1: Via Fastboot Enhance Tool

Thsui is the easiest and most recommended method of extracting the boot.img. This is because you don’t need to execute any commands, the entire process will be carried out via an application with an easy-to-use GUI. Moroever, you don’t even need to extract the entire payload.bin, you could simply extract the boot.img from the payload and get the job done, thereby saving your valuable time and resource. So do check out our below-linked guide to carry out this task:

How to Flash ROM & Extract Boot.img via Fastboot Enhance Tool

extract payload.bin stock boot image

METHOD 2: Extract payload.bin File via Payload Dumper

Please go through the requirements section and make sure to download all the necessary tools. Once that is done, you may proceed with the steps. We have broken down the instruction steps into separate sections for ease of understanding.

Prerequisites

  • To begin with, you will need the payload.bin file. You could get it from the stock firmware for your device. Many OEMs upload the same on their official pages, such as the OnePlus Download and Update page or Google Factory Image page. So just download the firmware, extract it via WinZIP, WinRAR or 7ZIP and get hold of the payload.bin file.
    pixel-3-OTA-payload-bin
  • Now, for extracting the Payload.bin file, you need a 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
  • Likewise, you should also have to install Python on your PC. Download Python v3.8.5 (latest version at the time of writing).

STEP 1: Install Python on your PC

  1. Launch the Python EXE setup 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

Now that you have installed Python, you could proceed with the extraction of the Payload.bin file 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. Now copy the payload.bin file from the ROM and move it to the folder where you have installed Python.
  2. Hence, this directory will now have the Payload Dumper Tool, the payload.bin file, and the Python software.
    payload-bin-dumper-inside-python
  3. Inside the same folder, type in CMD in the address bar and hit Enter. This will launch the Command Prompt.
  4. Type in the below command to install the necessary dependencies:
    python -m pip install -r requirements.txt

    payload-bin-dumper-inside-python

  5. 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.
    python payload_dumper.py payload.bin
  6. 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. That is not an issue. We will show you how to deal with that as well.
    custom-rom-extracted-images
  7. Anyways, moving on, once the process is complete, all the extracted files be placed 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

    payload-bin-dumper-inside-python

So these were the steps to extract the payload.bin file and get the stock boot.img. Let’s now check out how this could be done directly on your Android device, without using a PC.

METHOD 3: Extract Payload.bin Directly on Android Without PC [NEW]

YouTube video

There exists two different tools that will help you extract the payload.bin without PC, this one and the next one. The biggest advantage with this tool is that it doesn’t eequire you to install Python and execute any commands whatsoever. As a result of which, this is an extremely fast tool and gets the job done within seconds.

  1. First off, download and install Payload-Dumper-Android.
  2. Then launch it and give it the file access.
  3. Now tap on plus and select the payload.bin/OTA ZIP file.extract payload.bin without pc
  4. It will load the firmware. Select the desired files that you need to extract.
  5. You may choose multiple files at once as well. Once done, hit Extract.
  6. Th files will be extracted and placed inside the folder named after the firmware.extract payload.bin without pc

METHOD 4: Extract Payload.bin Directly on Android Without PC

YouTube video

The below instructions are listed under separate sections for ease of understanding. Make sure to follow in the exact same sequence as mentioned. 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 and data by performing the below steps.

STEP 1: Setup Payload Dumper Tool

extract payload dumper tool on android

  1. To begin with, download the Payload Dumper Tool on your device.
  2. Then extract it to the root of the Internal Storage, i.e. not inside any folder.

STEP 2: Get the Payload.Bin File

  1. Now download the ROM/firmware of your choice and extract the payload.bin file from it. If you have downloaded the OnePlus firmware, then it might be in a filename.zip.jar extension.
  2. You need to rename it and remove the JAR at the end so that it becomes filename.zip. Now extract this ZIP firmware and you will get the payload.bin file.
    oneplus jar firmware extract payload.bin file
  3. Once you have got the payload.bin file, transfer it to the same folder where you have extracted the Payload Dumper Tool.
    transfer payload.bin inside payload dumper android

STEP 3: Setup Python on Android

extract payload.bin on android via python

  1. Next up, download and install the Termux App on your device.
  2. Then launch the app and execute the below four commands. Type in the first command, hit Enter, type in the next command, and so on. While you do so, it might ask you to install additional dependencies, make sure to type in Y and hit Enter.
    pkg install python -y
    pip install --upgrade pip
    pip install protobuf
    apt update && apt upgrade -y

STEP 4: Grant Storage Permission

After this, grant the storage permission to Termux via the below command. You might get a warning from termux that “storage partition is going to be wiped but no storage contents will be touched”. You need to type in Y and hit Enter. Don’t worry, you wouldn’t lose any data. I have personally tried it on my device as well and there was no data loss.

termux-setup-storage

termux storage permission

STEP 5: Change Termux Directory to Payload.Bin File

You will now have to change the Termux’s directory to the folder where you have placed the payload.bin file. In our case, that is the Internal Storage’s payload_dumper folder (this folder you would have got after extracting the Payload Dumper Tool). Anyways, the command to change the directory is:

cd storage/shared/payload_dumper

STEP 6: Install Google APIs Dependencies

Next up, you’ll have to install a couple of Google API dependencies in Python. For that, just copy and paste the below two commands in the Termux window:

pip install google
pip install google-api-core

extract payload without pc

STEP 7: Extract payload.bin on Android

extract payload.bin files on android without pc

  1. Finally, execute the below command to extract the payload.bin file directly on your Android device without using PC:
    python payload_dumper.py payload.bin
  2. The extraction process will now being and once done, you shall get all the partition files inside the payload_dumper folder.

METHOD 5: Extract Payload.bin via Payload Dumper Go

YouTube video

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

    extract payload.bin

  8. The extraction process will now begin and would only take a few seconds.
    extract 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 payload.bin

That is it. With this, you have successfully extracted the payload.bin file and got the stock boot image file via the Payload dumper tool and Python. Along the same lines, we have also shared the steps to do via the Payload Go Tool which as of now, seems to be the best method for this job.

Apart from that, we have also listed out the steps to do so directly on your device without using a PC. You could transfer the stock boot.img file over to your device and then refer to our instructions to patch it via magisk and then flash it via fastboot. If you have any queries related to any of the two aforementioned steps, do let us know in the comments section below.

Share: