Super.img Unpack Repack !!better!! -
This review covers the standard technical workflow for unpacking and repacking the Android super.img , a dynamic partition container introduced in Android 10 that typically houses system , vendor , product , and other critical partitions. Core Toolset The primary tools for this process are part of the Android Open Source Project (AOSP) partition_tools : lpunpack : Extracts individual partition images (e.g., system.img , vendor.img ) from the super.img . lpmake : Reassembles the modified partition images back into a single super.img file. simg2img : Converts "sparse" images (common in factory firmware) into "raw" images that lpunpack can process. Workflow Overview Preparation : If the super.img is in a sparse format, convert it to a raw image using simg2img . Unpacking : Use lpunpack to extract the internal partitions into a designated output directory. Modification : Mount the extracted images (like system.img ) as loop devices to edit their contents. Note : Modern partitions often use EROFS (read-only) or EXT4 . EROFS images must be converted to EXT4 if you intend to write changes back to them. Repacking : Use lpmake to build the new super.img . This requires specific metadata, including: The total size of the original super partition. The exact byte size of each modified internal partition. Metadata slot information (e.g., 1 for A-only or 2 for A/B devices). Recommended Utility Scripts For a more automated experience, several community-developed scripts simplify the complex command-line arguments: How To Unpack And Repack Android super.img
The Ultimate Guide to Unpacking and Repacking super.img on Android The Android ecosystem has evolved significantly over the last decade. As devices became more complex and storage needs increased, Google introduced Dynamic Partitions—a major shift in how Android handles system storage. At the heart of this system lies the super.img file. For modders, custom ROM developers, and advanced tinkerers, understanding how to manipulate this file is crucial. Whether you are trying to extract a vendor image, modify system files, or debloat a stock ROM, you will inevitably face the challenge of unpacking and repacking a super.img . This comprehensive guide will walk you through the technical intricacies of Dynamic Partitions, the tools required, and the step-by-step process to successfully unpack and repack super.img files without bricking your device.
Understanding the Beast: What is super.img ? Before we dive into the "how," we must understand the "what." In older Android devices, partitions like system , vendor , product , and odm were distinct, physical partitions on the storage chip. However, as Android versions progressed, the size of these partitions fluctuated wildly between updates. A system partition might outgrow its allocated space, while vendor had space to spare. To solve this inefficiency, Google introduced Dynamic Partitions . super.img is essentially a logical container. Think of it as a giant filing cabinet. Inside this cabinet, there are no fixed walls. Instead, "logical partitions" like system_a , vendor_a , and product_a live inside the super partition. They can resize themselves dynamically as long as there is free space within the super container. Why Unpack and Repack? There are several legitimate reasons to modify a super.img :
Porting ROMs: Moving proprietary blobs (vendor files) from one device version to another. Debloating: Removing carrier bloatware deeply integrated into the product partition. GSI Installation: Modifying partition sizes to accommodate Generic System Images (GSI). Magisk/Rooting: Sometimes patching specific partition images requires extracting them from the super image first. super.img unpack repack
Prerequisites: The Toolset You cannot simply unzip a super.img like a standard archive. Because it uses specific Linux kernel structures and Android-specific metadata, you need specialized tools. Here are the standard tools for the job:
LPUnpack / LPMake: These are command-line utilities provided within the Android Open Source Project (AOSP). They are the "official" way to handle super images.
lpunpack : Extracts logical partitions from the super image. lpmake : Reassembles the logical partitions back into a super image. This review covers the standard technical workflow for
PartEd (Partition Editor): Occasionally used for mounting loop devices, though less common for the actual packing/unpacking process. Python Scripts (via PIP): Various developers have wrapped the C++ tools into Python scripts for easier use (e.g., pypi packages). ImgRePackerRK / Unpacker: While useful for Rockchip devices, they are not universal. Simg2img: Often a preliminary step. Many super.img files are sparse images (compressed format). They must be converted to raw images before unpacking.
Setting Up Your Environment For the most reliable results, we recommend using a Linux environment (Ubuntu/Debian or WSL2 on Windows). While some Windows executables exist, the Linux tools are significantly more stable and up-to-date. Installation on Linux: You can often install the necessary tools via your distribution's package manager or build them from AOSP source. However, the easiest method for most users is utilizing pre-built binaries or Python wrappers. Ensure you have Python installed: sudo apt update sudo apt install python3-pip pip3 install protobuf
Phase 1: The Preparation (Sparse vs. Raw) This is the step most beginners miss. If you downloaded a super.img from a factory image or a backup, it is likely a Sparse Image . Tools like lpunpack generally require a Raw Image . If you try to unpack a sparse image without converting it, you will get errors or corrupted output. Converting Sparse to Raw You need the simg2img tool. If you don't have it, you can install it via android-tools-fsutils or compile it. Command: simg2img super.img super_raw.img Modification : Mount the extracted images (like system
super.img : Your original file. super_raw.img : The output file (uncompressed). Note that this file will be much larger than the original.
Once you have super_raw.img , you are ready to begin the actual extraction.