Last Updated on December 14, 2022 by Mathew Diekhake
We were browsing the XDA Developers forum recently and realized that many people don’t know how to extract a boot image file. The boot image in Android is used to boot the operating system, thus it is quite common for those who are planning on installing custom firmware to have to tinker with it. Some rooting tools such as Magisk can often require a patched boot image that is different from the original.
Overview
Extracting the boot image is a simple process provided you have the right tools. You will need a tool that can unzip your files such as WinZip or 7-Zip. While WinZip is lauded as being the better tool in general, many Android experts recommend 7-Zip for tinkering with Android files because it is the one with more variety when it comes to compressing Android-related files. Thus, we also concur that 7-Zip would work well. But by no means do you have to use 7-Zip or WinZip for that matter.
What Is a Boot Image
The boot image is a file that both smartphones and desktop computers use to allow the software to boot its operating system and run. You will often read explanations about how boot images allow hardware to run, but when they say this, they’re referring to the software that’s on the hardware. Sometimes boot images on operating systems such as Windows can become corrupted. And other times on operating systems such as Android, people are looking for modified boot images to break security barriers.
How to Extract boot.img files from Samsung Firmware
1. Download the firmware and unpack the zip file.
2. Right-click on the file and rename the firmware file’s extension from .tar.md5 to .tar.
3. Open the .tar file and unpack the boot.img.lz4 file.
4. Unpack the boot.img.lz4 file.
You will now have the boot.img (boot image) file in front of you.
Note: The above guide may not work for every single Samsung device. And it certainly will not work for all devices that are not Samsung. One of the more common problems people have is they try to unpack the file and find a .pac file. PAC firmware files are associated with devices with Spreadtrum unisoc processors. You can read more about them in the linked article.
In conclusion, that is how to extract boot image files from Samsung firmware.
Mat Diekhake
June 24, 2022 @ 22:57
I have asked some of my developer friends about this. They say it may be because the endianness of the fields in the struct
boot_img_hdr
header varies when compiled for ARM. The bootloader assumes the same endianness that mkbootimg compiled for x86 writes them in.Hrz
June 24, 2022 @ 22:45
I have installed a new boot image but the device’s operating system does not boot. This is obviously the situation one would be most cautious about so it’s not as though I’m not aware this could have been an unfortunate outcome. But I am still not able to get the OS to load once in recovery mode.
I have tried using the pbatard boot image tool from GitHub (https://github.com/pbatard/bootimg-tools) and run the necessary commands to remake the boot image. But I still can’t manage to create the new boot image successfully. Any idea what to do next?