Android Image Tools ๐Ÿ› ๏ธ

July 9, 2026 ยท View on GitHub

GitHub Release License

A powerful, user-friendly Linux script for unpacking and repacking Android images with full filesystem support, SELinux context preservation, and seamless automation. Like CRB Kitchen, but native to Linux with cross-distro compatibility and advanced CI/CD features.

Click here to preview the interface

Android Image Tools Screenshot

โœจ What It Does

  • Unpack Android Images: Extract partitions from .img files to editable directories
  • Modify Files: Edit system files, apps, configurations, etc.
  • Repack Images: Rebuild bootable Android images with your changes
  • Super Image Support: Handle complex multi-partition super.img files
  • Filesystem Conversion: Convert between ext4, EROFS, and F2FS formats
  • SELinux Preservation: Maintain security contexts for bootable images
  • Automation Ready: Generate configs automatically for CI/CD pipelines

๐Ÿš€ Quick Start

Basic Usage

# Interactive mode
sudo ./android_image_tools.sh

# Automated mode with config
sudo ./android_image_tools.sh --conf=config.conf

Simple Workflow

  1. Place your .img file in INPUT_IMAGES/
  2. Run the tool and select "Unpack an Android Image"
  3. Edit files in the extracted directory
  4. Select "Repack a Directory" to rebuild
  5. Find your new image in REPACKED_IMAGES/

๐Ÿ“‹ Features

FeatureDescription
Open SourceFree, transparent, and community-driven
Cross-Distro CompatibleUbuntu/Debian + Fedora/RHEL + Arch
Filesystem Supportext4, EROFS, F2FS
SELinux PreservationMaintains Android security contexts
Interactive GUIEasy terminal menu interface
Auto Config GenerationNo manual config creation needed
CI/CD ReadyFull automation support
Super Image HandlingMulti-partition Android images
Compression OptionsLZ4, LZ4HC, Deflate algorithms
Filesystem ConversionConvert between any supported formats
Sparse Image SupportAutomatic format handling
Smart CleanupAutomatic temp file management

Prerequisites

  • Root access (sudo required)
  • Architecture: x86_64 (AMD64) based system required
  • Supported Distributions: Ubuntu/Debian-based, Fedora/RHEL-based or Arch-based Linux distributions
  • Linux kernel with loop device support (preferred method, provides best performance and SELinux compatibility)
  • FUSE support (fallback option for restricted environments, but buggy/limited in SELinux environments)

Required packages are installed automatically

๐Ÿ“– Detailed Usage

  • Unpack an Android Image: Extract single partition images
  • Repack a Directory: Rebuild images from extracted folders
  • Generate Config File: Create automation templates
  • Advanced Tools: Super image operations
  • Cleanup Workspace: Remove temporary files

Automation Setup

The tool eliminates manual config creation:

Method 1: Export During Repacking

sudo ./android_image_tools.sh
# Navigate: Repack a Directory โ†’ Complete setup โ†’ "Export selected settings"

Creates a ready-to-use config file automatically.

Method 2: Export During Unpacking

sudo ./android_image_tools.sh
# Navigate: Unpack an Android Image โ†’ Complete setup โ†’ "Export selected settings"
# Or: Advanced Tools โ†’ Super Image Kitchen โ†’ Unpack a Super Image โ†’ "Export selected settings"

Creates reusable config files for automation workflows.

Method 3: Super Image Configuration

sudo ./android_image_tools.sh
# Navigate: Advanced Tools โ†’ Super Image Kitchen โ†’ Finalize Project Configuration

Automatically generates complex multi-partition configs.

Using Generated Configs

# Run automated operations
sudo ./android_image_tools.sh --conf=generated_config.conf

Config File Examples

Basic Unpacking:

ACTION=unpack
INPUT_IMAGE=system.img
EXTRACT_DIR=extracted_system

Super Image Unpacking:

ACTION=super_unpack
INPUT_IMAGE=super.img
PROJECT_NAME=my_super_project

Basic Repacking:

ACTION=repack
SOURCE_DIR=EXTRACTED_IMAGES/extracted_system
OUTPUT_IMAGE=REPACKED_IMAGES/system_new.img
FILESYSTEM=erofs
COMPRESSION_MODE=lz4hc
COMPRESSION_LEVEL=9
CREATE_SPARSE_IMAGE=true

Super Image Repacking:

ACTION=super_repack
PROJECT_NAME=my_super_project
OUTPUT_IMAGE=REPACKED_IMAGES/super_new.img

๐Ÿ“ Project Structure

Android_Image_Tools/
โ”œโ”€โ”€ android_image_tools.sh    # Main script
โ”œโ”€โ”€ .bin/                     # Helper scripts
โ”œโ”€โ”€ INPUT_IMAGES/             # Place .img files here
โ”œโ”€โ”€ EXTRACTED_IMAGES/         # Unpacked directories
โ”œโ”€โ”€ REPACKED_IMAGES/          # Output images
โ”œโ”€โ”€ SUPER_TOOLS/              # Super image projects
โ”œโ”€โ”€ CONFIGS/                  # Generated configs
โ””โ”€โ”€ .tmp/                     # Temp files (auto-cleaned)

๐Ÿ› ๏ธ Troubleshooting

Common Issues

Permission denied

  • Run with sudo
  • Check file ownership

SELinux contexts lost

  • Only occurs on SELinux-enforcing distros when using FUSE mounting
  • Normal on Fedora (contexts preserved with kernel mounts)
  • Use kernel mounts when possible

Sparse conversion fails

  • Check simg2img/img2simg installation
  • Verify disk space

Super operations fail

  • Verify super.img integrity

Debug Mode

Enable detailed logging for complex operations:

# Add to super config
ENABLE_VERBOSE_LOGS=true

๐Ÿค Contributing

  1. Fork the repository
  2. Test on Ubuntu + Fedora systems
  3. Submit pull requests

๐Ÿ“„ License

MIT License - see LICENSE file.

๐Ÿ™ Credits

Inspired by CRB Kitchen for Windows. Thanks to the Android modding community!


Ready to mod? ๐Ÿš€ Run the tool and explore the menu - everything is designed to be intuitive!