Skip to content

propgsp/Android-Tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GitHub stars GitHub forks

Android Tools

(Working on an all in one combined script. Soon repo will be pushed and made public)

A collection of powerful tools designed to kickstart your Android ROM development and customization.

As a beginner in Android ROM development and customization, I've gathered tools along my journey to make them easily accessible for beginners.

Get the Files from Releases:
๐Ÿ”— Android Dev Tools Release

As a beginner in Android ROM development and customization, I have collected some tools to that are required to extract the required blobs to build device tree from an ota update package.

Important:

Strictly use Linux โ€“ It's essential for ROM development.
Avoid WSL โ€“ Too many limitations for this process.
Bare-metal Linux is best โ€“ If you can't install Linux natively, use a Linux VM.
Oracle VirtualBox is a better alternative to WSL, but expect slower builds (several hours to days).
Check out minimum system requirements:
๐Ÿ”— Android Build Requirements

Usage Overview

Each tool contains a README.md inside its respective folder with detailed usage instructions.
Below is a quick overview for advanced users who prefer a fast reference.

Extracting OTA Firmware (payload.bin)

If you have an OTA update containing payload.bin, use payload-dumper-go inside payload.bin-unpackor:

  1. Set execution permissions:
chmod +x payload-dumper-go 

2๏ธ) Add the tool to your PATH:

export PATH=$PATH:/path/to/payload-dumper-go

3๏ธ) Extract payload.bin:

payload-dumper-go /path/to/payload.bin

You now have unpacked images (boot, dtbo, system, vendor, etc.).
โš ๏ธ Not all payloads contain the same images โ€“ it depends on the device brand/model.

Extracting Sparse Images (super.img)

If you don't have payload.bin but instead have sparse chunks, follow these steps:

1๏ธ) Convert Sparse Images to super.img

Inside super.img-extractor, run:

./simg2img system.img_sparsechunk.* super.img

2๏ธ2) Unpack super.img into partitions

./lpunpack super.img /super_unpacked

You will get system, vendor, system_a, system_b, vendor_a, vendor_b images.
If an error occurs (vendor_b.img not found), create an empty file to bypass:

mkdir super_unpacked; cd super_unpacked; touch vendor_b.img

Now you have all images extracted from the firmware.

Extracting Device Tree, Kernel, and Other Files

When extracting device tree blobs (DTB), kernel files, and embedded partitions, different methods apply based on the image format. Hereโ€™s a step-by-step guide covering all approaches, including the manual dd method for stubborn files.

Note: If you got the expected files from the firmware just skip the steps.

Step 1: Install Required Libraries & Tools

Before extracting, install essential tools:

sudo apt update && sudo apt install -y binwalk simg2img lz4 squashfs-tools mount

Additional Dependencies:

pip install protobuf

Some extraction tools may require Python dependencies like protobuf.

Step 2: Identify Image Format

First, check the format of .img files:

file *.img

If Erofs, SquashFS, Ext4, or another format, use the relevant method below.

Step 3: Extracting EROFS Files

For EROFS-formatted partitions, use:

./erofsUnpackRust_x64linux system_a.img

Files will be unpacked.

Alternatively, mount EROFS manually on Linux:

mkdir mount_point  
sudo mount -t erofs system_a.img mount_point/

Now browse the extracted files inside mount_point/.

Step 4: Extracting Generic Files Using Binwalk

If the image contains embedded files (such as kernel or DTB blobs), use Binwalk for deep extraction:

binwalk -Me name.img

Extracted data is stored inside auto-generated folders.

If you only need a content list, without extracting:

binwalk -Me -r name.img

Additional Extraction with Binwalk:
If Binwalk does not properly extract the data, use dd to manually carve out sections based on offsets as mentioned in Step 8.

Step 5: Extracting Kernel & Device Tree (DTB)

Some devices store kernel and DTB files inside boot.img, vendor_boot.img, or dtbo.img.

Using split_bootimg.pl

Install the tool:

git clone https://github.com/xblax/bootimg-tools.git

cd bootimg-tools
chmod +x split_bootimg.pl

Extract boot image components:  
```bash
./split_bootimg.pl boot.img

Generates extracted files such as:

  • kernel

  • ramdisk

  • dtb

    If DTB is missing, extract manually using dd:

dd if=boot.img of=dtb.img bs=1 skip=<offset>

(Replace <offset> with actual DTB location found using Binwalk.)

Step 6: Extracting Android Boot Image Components

For extracting boot partitions (boot.img, vendor_boot.img, etc.), use Android Boot Image Editor:

Clone and install:

git clone https://github.com/cfig/Android_boot_image_editor.git  
cd Android_boot_image_editor  
chmod +x gradlew  

Unpack boot image:

./gradlew unpack

Extracted files appear in image-unpack-repack/build/.
After extracting each .img, clear the build folder to avoid conflicts.

Step 7: Extracting Vendor Blobs

For extracting vendor binary blobs:

./extract-proprietary-files.sh

This copies vendor blobs into the correct AOSP directory. (This wont for every source)

Manually extracting vendor.img:

simg2img vendor.img vendor.raw.img  
mkdir vendor_mount  
sudo mount -o loop vendor.raw.img vendor_mount/

You can now browse vendor files inside vendor_mount/.

Step 8: Manual Extraction Using dd (If Nothing Else Works)

When other methods fail, manually extract files using dd.
1๏ธ) Find offsets using Binwalk:

binwalk -E name.img

This displays embedded file locations.

2๏ธ) Extract data manually:

dd if=name.img of=extracted_file bs=1 skip=<offset> count=<size>
  • skip=<offset> = Starting byte (found using Binwalk).

  • count=<size> = Size of the file (estimate based on previous extractions).

    This method works when automated extractors fail!

Note:

Always check the image format first.
Use the appropriate extraction tool (Binwalk, simg2img, dd, etc.).
If extraction fails, try a combination of multiple methods.
Clear build folders after unpacking to keep things organized.

License

This project is a collection of open-source tools.
Each tool contains its own respective license file.

Credits

Thanks to the amazing developers who created these essential tools!

Tool Developer Repository
Binwalk @ReFirmLabs ๐Ÿ”— GitHub Repo
DTC (Device Tree Compiler) @dgibson ๐Ÿ”— GitHub Repo
Payload Dumper Go @ssut ๐Ÿ”— GitHub Repo
Android Boot Image Editor @cfig ๐Ÿ”— GitHub Repo
bootimg-tool @xblax ๐Ÿ”— GitHub Repo

๐Ÿ’™ A huge shoutout to these developers for building such powerful tools that make ROM development easier for everyone!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors