Guide on how to extract a boot image from any Android phone without needing to root using Magisk and without a custom recovery.
Most of the time when individuals buy a new phone, they encounter challenges when attempting to root their phone because they need a boot image first to patch, and most phones don't have a custom recovery available specifically designed for their device. Sometimes finding their firmware on the internet becomes difficult. Consequently, rooting such phones becomes a formidable task. So in this guide, I will provide a comprehensive solution for users who want to extract the boot image from their phone without needing to root it first or download firmware from the internet and also without custom recovery.
Before diving into the guide, please thoroughly review the Frequently Asked Questions (FAQ) to understand the basics of GSI and the various naming conventions used by GSI builders and maintainers.
Accessing and modifying system files on your device typically requires superuser permissions. To extract the boot image, we'll need a root environment. We'll achieve this by using a GSI that includes the "su" binary or has superuser capabilities built-in.
For instance, consider this Lineage OS GSI. You'll need to flash it onto your phone.
If you're unfamiliar with flashing a GSI or unsure how to proceed, watch this YouTube video or search online for additional guides. You can also join the PHH GSI support group on Telegram for assistance.
Alternatively, the DSU sideloader can be used to install GSIs via Android's DSU feature with ease. For a detailed explanation, watch this YouTube video.
- Download the Termux app from here.
- If not pre-installed, download the PHH Superuser app from here.
- Open Termux, grant storage permission, type
su
, and approve the superuser request from the PHH app to gain root access. - With superuser permission, you can access any system file. Enter the following command:
for name in boot_a boot_b; do
path=$(find /dev/block -type l -name "$name" -print0 | xargs -0 readlink -f | head -n 1)
if [ -n "$path" ]; then
echo "${name} = $path"
fi
done
This command will display the partition paths for both boot slots.
- Once you have the boot slot paths, use the following command to extract the image:
dd if=<boot_slot_path> of=<destination_path>
For example:
dd if=/dev/block/mmcblk0p42 of=/sdcard/boot_a.img
Done! You've now successfully extracted the boot image to the specified location.
If you find the manual process too complicated, you can use my Boot-image-Extractor script. This script automates the task, making the extraction process simpler and more efficient. You can find detailed instructions and usage guidelines within the repository.
The guide and script provided are for informational purposes only. The author does not take responsibility for any damage or loss caused by using or misusing the guide or script. By using the guide or script, you acknowledge that you are solely responsible for any outcomes, including but not limited to device damage, data loss, or voided warranty. Please note that modifying system files, including extracting the boot image, can have serious consequences if not done correctly. It is recommended to seek additional resources, such as official documentation or dedicated forums, for your specific device and firmware version.