How to Extract boot.img from Stock Firmware

How to Extract boot.img from Stock Firmware

Android gives you the freedom to customise your device the way you want to, whether it be by installing mods, changing the launcher, flashing third-party firmware, or gaining root access to become a superuser. But to seamlessly root an Android phone, you must install Magisk. Magisk may be installed using a number different techniques, such as TWRP recovery. If you choose not to install TWRP Recovery, you must extract boot.img from stock firmware and use Magisk to patch it.

Extracting the Boot.img file is time-consuming and requires some effort. Every smartphone brand has a unique firmware format, and the boot.img location on a firmware might also change. Many OEMs, like as Google and Motorola, enable users to extract boot.img files straight from their firmware. However, manufacturers such as Realme and Oppo keep the Boot.img file within the OZIP file, whereas OnePlus stores the image file within payload.bin.

What is Boot Image?

A boot image is a system image file that is responsible for the device’s booting. During a regular boot, the bootloader loads the first partition image. It generally includes a kernel image, ramdisk, and a few valuable files that must be loaded before the filesystem can be mounted. It will not only allow you to root your device, but it will also allow you to fix issues if your device is stuck in the bootloop or does not boot at all.

Why do we need a boot image?

The stock boot image is required not just for rooting and unrooting, but also for fixing boot loops. The Stock Boot Image file is a required component of the firmware file that contains a set of codes that must be executed on the device every time you switch it on. Therefore, it always comes with the stock firmware file from the manufacturer in a compressed file.

The stock boot image is typically required by users who want to root their phones without TWRP recovery. It must be patched using the Magisk Manager app on your Android smartphone. You may then root your device by flashing the modified boot image file with the Fastboot command.

How to Extract boot.img from Stock Firmware

The majority of smartphone OEMs supply a straightforward compressed firmware file that is simple to extract from your system, but lately OEMs also offer OZIP, bin, img, and other formats. Here, we list every possible way to get boot.img for magisk.

How to get boot.img from Pixel Factory image

  1. Download the Factory image zip for your Pixel phone.
  2. Extract the factory image zip file using any file extractor like Winrar.
  3. Open the extracted folder and you will find one more zip file inside.
  4. Extract this folder again and you will find the boot.img file.Boot img pixel

How to get boot.img on Motorola Phones

  1. Download the Factory image zip for your Motorola device.
  2. Extract the factory image zip file using any file extractor like Winrar.
  3. Inside the extracted folder, you will find the boot.img file.boot.img Motorola

How to get boot.img from Xiaomi Recovery ROM

  1. Download the Recovery ROM zip for your Xiaomi device.
  2. Extract the zip file using any file extractor like Winrar.
  3. Inside the extracted folder, you will find the boot.img file along with other system files.Boot img Xiaomi

How to Extract Boot.img from OnePlus Stock Firmware

Boot.img files on Oneplus OxygenOS firmware is packed inside the playload.bin file. Use the well-known payload dumper tool to extract Boot.img from the OnePlus Firmware.

  1. Make sure you have Python installed on your PC – Download Python’s latest version
  2. Download and extract the payload dumper zip file.
  3. Download the latest OxygenOS firmware and extract it.
  4. Open the extracted folder and copy the payload.bin file from the OxygenOS firmware folder to the payload_input folder.Extract Boot.img from OnePlus Stock Firmware
  5. Now run the payload_dumper.exe to extract the boot.img.Playload_dumper.exe
  6. It will take some time, depending on the size of the package.
  7. Once the process is complete, the output will be saved in the payload_output folder.
  8. Open the payload_output folder and you will see the boot.img inside the folder.Extract Boot.img from OnePlus Stock Firmware

How to Extract Boot Image From Realme/Oppo OZIP Firmware

The OZip file contains the Boot.img files for the Realme/Oppo firmware. To obtain the stock boot.img file, vendor patch, etc., you must extract the stock ROM file in OZIP format. See the instructions below to extract the boot.img file from the Realme/Oppo OZIP firmware.

  1. Make sure you have Python and pip installed on your PC – Download Python latest version
  2. Download OZip Decrypt Tool and extract it on your PC.Download OZip Decrypt Tool
  3. Press Shift + Right Click on the blank space inside the folder and select the option Open command window here or Open PowerShell window here.Platform Tools for Windows
  4. In the Command Prompt window, enter the following command to install pycryptodome.
    pip3 install -r requirements.txt
  5. Now download the Realme OZIP Stock firmware and copy the .ozip file to the OZip Decrypt Tool folder.
  6. Execute the below command to extract the Realme OZIP firmware package.
    python ozipdecrypt.py file_name.ozipozipdecrypt.py tool
  7. Now decryption process start and when completes, you will see the Realme/Oppo stock firmware file in the ZIP format placed inside the same Python folder.
  8. Once you get the zip file, extract it and you will find the firmware files like boot.img, vendor file, and more.

How to Extract Boot Image From Samsung Firmware

The Boot.img file on Samsung Firmware is packed inside the tar file. To obtain the stock boot.img file, you must extract the Samsung stock ROM file.

  1. Download Samsung Stock Firmware and extract it on your PC.
  2. In the extracted folder, you will these AP, BL, CP, CSC, and Home CSC files.
  3. Extract the AP file (AP_xxxxxxxxxxx.tar.md5) using 7zip.
  4. Open the extracted folder, you will find boot.img.lz4 inside.boot.img.lz4
  5. Now extract the boot.img.lz4 with the 7-Zip ZS tool to get the boot.img file.
  6. To extract boot.img.lz4 file, just right-click the file and choose extract with 7-Zip ZS.

Although you can grab the boot.img with above steps but this file maybe of no use. Because Samsung use Odin to flash firmware or recover and Odin only accept .md5 format. Even to root your Galaxy device with Magisk, you need to patch “AP_xxx.tar” via Magisk.

How to Extract Boot Image From LG KDZ or DZ Firmware

The DZ file, which is likewise packaged inside the KDZ file, contains the Boot.img files for the LG Firmware. To obtain the stock boot.img file for your LG smartphone, first extract the KDZ file to obtain the DZ file, and then extract the DZ file.

  1. Download the KDZ Extractor tool and extract it.
  2. Copy the Downloaded KDZ into the KDZ Extractor folder.
  3. Run the OneKeyExtraction.bat file.KDZ Extract tool
  4. It will start to extract the file for you and you will now find the file with .DZ extension.
  5. Now to extract boot.img from DZ firmware, we will use the LG Extractor Tool.
  6. Download LG Extractor Tool and extract it.
  7. Run the WindowsLGFirmwareExtracxt.exe file to launch the Tool.WindowsLGFirmwareExtracxt
  8. Click on the Open button next to the DZ file and select the DZ file.
  9. Click OK, it will show all the files present inside this DZ file.
  10. Select the boot.img and click on the Extract DZ button.LG Firmware Extract
  11. You will now get the boot.img file in the LG Firmware Extract Tool folder.

How to get boot.img from Asus Phones

The Boot.img files on the Asus Firmware may either be extracted directly or they are contained inside the payload.bin file. To obtain the stock boot.img file, you must first extract the Asus stock ROM file.

  1. Download the full firmware.zip for your Asus device.
  2. Extract the firmware zip file using any file extractor like 7zip or Winrar.
  3. Inside the extracted folder, you will find the boot.img file.
  4. In some Asus devices, you can get the payload.bin instead of boot.img.
  5. To extract payload.bin for the Asus device, you can check the above method (that was shared for the OnePlus device) to extract payload.bin using the Payload Dumper.

How to get the stock boot.img from Sony Stock Firmware

The sin file contains the Boot.img files for Sony Firmware. To obtain the stock Boot.img file for Sony devices, you must extract the Sony Boot.sin file.

  1. First, download the stock firmware for your Sony phone and extract the zip file, you may find the .sin files inside the folder.
  2. Download the Sony Dump Tool and extract it on your device.
  3. Copy the boot.sin file to the Sony Dump Tool folder.
  4. Create a folder named output inside the Sony Dump Tool folder.
  5. Now go to the address bar of the Sony Dump Tool folder and type CMD and press Enter to launch the Command Prompt.
  6. In the Command Prompt window, enter the following command to extract the boot.img from the Sony firmware.
    sony-dump output file_name.sin
  7. Once the process is complete, the output will be saved in the output folder.
  8. Open the output folder and you will see the boot.img inside the folder.

How to Extract boot.img from Huawei UPDATE.APP file

On Huawei/Honor Firmware, the Boot.img files are included within the update.app file. To obtain the stock Boot.img file for Huawei smartphones, extract the update.app file.

  1. Download the Full firmware for Huawei/Honor device (FullOTA-MF).
  2. Extract the firmware file to get the UPDATE.APP file.
  3. Download the Huawei Update Extractor tool.
  4. Extract the zip file, open the folder and run HuaweiUpdateExtractor.exe.
  5. Go to the Settings tab and uncheck Verify header checksum.Huawei Update Extractor tool
  6. Now go back to the Extract tab and tap the “” button and select the UPDATE.APP file.
  7. You will now see all the files present inside the UPDATE.APP file. Right-click the boot.img file and click on Extract Selected and select the destination of where you want to save the extracted file.Huawei Update Extractor tool

How to Extract Boot.img via TWRP (All devices)

If you are a rooted user, you can easily extract Boot.img directly from device without downloading full firmware. Users who have TWRP installed will not need to download the complete firmware. They may easily obtain the boot.img file from their device’s firmware. This approach is also not device-specific; you can use it on any device that has TWRP installed.

  1. To use this method make sure you have ADB and Fastboot installed on your PC. (We have already written a detailed guide to set up ADB and fastboot on Windows and Mac).
  2. Make sure USB Debugging is enabled on your phone.
  3. Connect your device to the PC via USB cable.
  4. Now boot your device into the TWRP recovery mode by using the hardware button or by using the below command.
    adb reboot recovery
  5. Type in the following command in the CMD window to extract the boot.img from the firmware installed.
    dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/boot.img
  6. Your device will extract the stock boot.img from the currently installed firmware and save the file in your phone’s internal storage.

Wrapping Up: Extract Stock Boot.img on Android devices

So that’s how to extract stock boot.img file from stock firmware. You may now use this file to root your smartphone. If you run across any problems, please let us know in the comments.

Related Posts
Share on:
Photo of author
Author
Sumit is a gadget and tech enthusiast who writes about Android updates and tech guides and enjoys solving all of your tech problems.

Leave a Comment