This repository contains Docker-based tools for working with disk images:
- Kali Linux Image Editor - Automated tool for creating Kali Linux images for uConsole CM4
- Image Comparison Tool - General-purpose image analysis and modification utilities
- Quick Reference - Common commands and workflows
- Docker and Docker Compose installed on your system
- At least 16GB of free disk space
- The Kali Linux ARM64 image (
kali-linux-2024.1-raspberry-pi-arm64.img.xz) in theimages/directory - I was able to find it here: https://old.kali.org/arm-images/kali-2024.1/
- Root/sudo access for mounting and modifying disk images
# Build the Docker image and start the container
docker-compose up -d# Access the running container
docker exec -it image-editor bash# Navigate to the scripts directory
cd /workdir/Scripts
# Execute the image creation script
./create-uconsole-cm4-image-fixed.shThe automated script performs the following modifications to the base Kali Linux image:
- Kernel Replacement: Removes the default Kali kernel and installs the uConsole CM4-specific kernel
- Display Configuration: Sets up proper display rotation (right) for the uConsole screen
- 4G Module Support: Installs necessary packages and configurations for 4G connectivity
- Repository Configuration: Adds ClockworkPi's APT repository for uConsole-specific packages
- Package Pinning: Prevents accidental installation of incompatible Kali kernel packages
After the script completes successfully, you'll have a modified image ready to write:
# Write the image to your SD card (replace /dev/sdX with your actual device)
# Note this is to be run on the host machine i.e your mac. be sure to cd to the images dir where your new image islikely ImageEditor/images
# Replace /dev/sdX with your actual SD card device
sudo dd if=kali-linux-2024.1-raspberry-pi-arm64.img of=/dev/sdX bs=1M status=progressdd command. Using the wrong device path can destroy data on your system.
/workdir/
├── images/ # Contains the Kali Linux image files
├── Scripts/ # Automation scripts
├── backups/ # Backup directory (if needed)
└── docker-compose.yml # Docker configuration
The script requires root privileges to mount and modify the image. It will automatically check for proper permissions.
If you encounter loop device errors, ensure no other loop devices are in use:
# List current loop devices
losetup -a
# Clear unused loop devices
sudo losetup -DCheck if the container is already running:
docker ps -a
docker-compose down
docker-compose up -dThe main script is located at Scripts/create-uconsole-cm4-image.sh. You can edit it to:
- Change package selections
- Modify display settings
- Add custom configurations
The Scripts/ directory contains various utility scripts for:
- Image analysis
- Partition mounting/unmounting
- Bootloader fixes
- Backup and restore operations
- Docker Engine 20.10 or later
- Docker Compose 1.27 or later
- Linux host system (for proper loop device support)
- Minimum 8GB RAM recommended
- SD card (8GB or larger) for the final image
- The image modification process can take 15-30 minutes depending on your internet connection and system performance
- The container runs in privileged mode to access loop devices and mount filesystems
- All modifications are performed within the container for safety and reproducibility