Home > LG

How to Extract Boot.img from LG KDZ or DZ Firmware

In this guide, we will show you the steps to extract the boot.img file from LG’s KDZ or DZ firmware. When it comes to rooting an Android device, there are two different approaches that you could take.  The first one is a rather direct route that just involves flashing the Magisk ZIP (which is now a part of the Magisk App, version 22 onwards) via TWRP Recovery. However, there are still a lot of devices out there that don’t have a working custom recovery (neither official nor unofficial). As a result, those set of users can’t proceed with this method.

Well, even if there is a TWRP, some users prefer to maintain a safe distance due to the complexities involved in installing them. The A/B partition thing: the absence of recovery partition/ replaced by the boot and the data encryption issues are just some of the reasons for the same. As a result, they take an alternate “route to root” their devices. This involves getting hold of the stock boot.img file, patching it via Magisk, and then flashing it via Fastboot. While it is a little bit lengthier method, but at least does its job without any issue.

The only problem that some users have is extracting the boot.img from the stock firmware. This is because most OEMs don’t upload their firmware in ZIP or RAR. OnePlus takes the payload.bin approach, Oppo and Realme have it in the OZIP package and LG has it in KDZ or DZ (or TOT) format. Since there is no universal extraction tool, it leads to a little bit of confusion among the users. But it’s now time to put all these doubts to rest. In this guide, we will show you how to extract the boot.img file from LG’s KDZ or DZ firmware.

Extract Boot.img from LG KDZ or DZ Firmware: The Technicalities

extract boot.img lg kdz dz firmware

[You may skip this section if you’re in a hurry] Recently I covered an article on extracting KDZ, DZ, and TOT firmware. That process involved using the LG Extractor Tool. I loaded the KDZ firmware and upon extraction, it gave me the DZ firmware. Then I loaded this DZ firmware and extracted it again via that tool. This time I got some partition files in IMG format. But, there was something just not right with the extracted DZ file. This is because there were just a couple of partition files, all the major ones such as recovery, boot, and system were missing.

So I did some research and found out the issue was with the method LG Extractor Tool handling of the KDZ file- it wasn’t able to extract the KDZ file correctly, so the DZ file that it gave out was only half-baked. Therefore I decided to ditch this tool for the KDZ extraction and found out a Python script that does this job quite efficiently. So here we would use that Python command to extract the KDZ file, which will give us the DZ firmware. We would then use the LG Extraction Tool to extract this DZ file and get the boot.img file.

So can’t we have used Python to extract the DZ file as well? Truth be told, that script is made to work for the extraction of both the KDZ and DZ files. But there are some indentation issues with its DZ extraction file. So I had to only limit its usage for the extraction of KDZ and then shift over to the LG Extraction Tool for the DZ extraction. Phew! Anyways, let’s now keep these technicalities aside, and start off with the guide to extract the boot.img file from LG’s KDZ or DZ firmware. Follow along.

How to Extract Boot.img from LG KDZ or DZ Firmware

We will list out the entire instructions in separate sections for ease of understanding. Proceed ahead in the exact same sequence as mentioned below.

Download LG Stock firmware

To begin with, download the LG Firmware file for your device. Do keep in mind that you have to download the same firmware that is currently installed on your device. You may check the currently installed version from your device’s Settings > About Phone section.

As far as the site for downloading firmware is concerned, there’s no official one. However, just a Google search should list out a plethora of sites with your device’s firmware. Download it from your preferred source and then move over to the next step.

Download Python Extraction Script

We will be using Python to extract the KDZ firmware which shall give us the DZ firmware file. So download the KDZTools from GitHub.

download python lg kdz extract boot.img tool

But this tool wouldn’t work if you haven’t installed Python on your PC. So head over to the official site and download Python right away. Once downloaded, launch its setup file, tick-mark the Add Python to Path option and proceed with the onscreen instructions to install it.

extract-lg-kdz-boot.img-via-python

Download LG Extractor Tool

Once we have got the DZ firmware via Python, we will use the LG Extractor Tool to extract this DZ file and get the stock boot.img file. So download the LG Extractor Tool [Credits: XDA Developer bullghost] and extract it to any convenient location on your PC.

Extract LG KDZ Firmware via Python

  1. To begin with, transfer the downloaded LG firmware file to the Steadfast kdz-tools folder.
  2. Furthermore, it is recommended to rename the firmware file to firmware.kdz to make it easy to type in the Command window.
    place lg kdz firmware in python extract stock boot.img
  3. Now head over to this folder’s address bar, type in CMD in the address bar, and hit Enter. This shall launch the Command Prompt window.
  4. Type in the below command in this window to extract the DZ file from KDZ:
    python unkdz.py -f firmware.kdz -x

    lg kdz extracted to dz python

  5. The extraction process will now begin. Once done, a new folder by the name kdzextracted will be created inside the kdztools-master directory and your extracted DZ file will be placed there.
    lg kdz extracted to dz files
  6. You will get PARAM, DZ, BIN, DLL, and DYLIB Files. As of now, let’s keep our focus on the extraction of the DZ file which shall give us your LG device’s stock boot.img file.

Extract LG DZ firmware via LG Extraction Tool

  1. Double click on the WindowsLGFirmwareExtracxt.exe file to launch the Tool.
  2. Now click on the Open button next to the DZ file.
  3. Navigate to the DZ file, select it and click OK.
    extract boot.img kdz firmware lg extraction tool
  4. It will bring up all the associated files present inside this DZ file.
  5. Select the boot.img (and any other file if you require) and click on the Extract DZ button.
  6. You will now get the boot.img file in the LG Firmware Extract Tool folder. It will be something like boot.img_numbers. Rename it to boot.img.
    extracted LG boot.img from dz via extraction tool
  7. That’s it. You may now refer to our guide to Patch Stock Boot Image via Magisk and Flash it using Fastboot.

So this was all from this guide on how to extract LG KDZ or DZ firmware and get the stock boot.img file. If you have any queries concerning the aforementioned steps, let us know in the comments. We will get back to you with a solution at the earliest.

Share: