How to Unpack and Repack the Super Partition on Windows
Hey everyone! Buckle up because today’s guide is a tough one.
I’ll teach you how to unpack and repack the Super partition on Windows, and the best part? No app installations are required—just CMD and Notepad.
If you’re new to flashing and ROM customization, I highly recommend checking out my Flashing Beginners Guide before diving into this tutorial. It’ll help you understand the basics and make this process much easier to follow.
So, why would you go through the trouble of unpacking and repacking the Super partition? Simple: GSIs. Let’s get started.
Why Would I Unpack and Repack?
Because of GSI—a Generic System Image which is a system.img partition designed to work on most devices that support Project Treble. Treble, introduced in Android 9+, modularized Android’s system components to make updates faster and more universal.
To check if your device supports Treble, use this command:
adb shell getprop ro.treble.enabled
However, some devices don’t have separate system
, product
, and vendor
partitions. Instead, they use a compressed Super partition (common in budget MTK devices like the Qin F21).
This is where unpacking and repacking the Super partition becomes crucial, especially when working with GSIs.
Steps to Unpack and Repack the Super Partition
1. Which Partitions?
When you unpack the Super partition, you’ll find these partitions:
system_a.img
product_a.img
vendor_a.img
For devices with dual boot slots (A/B), you’ll see these instead:
system_a.img
,system_b.img
product_a.img
,product_b.img
vendor_a.img
,vendor_b.img
In most cases, you can ignore the _b
partitions and focus on _a
.
2. Download These Tools
simg2img
Lpunpack
Lpmake
triplepack.zip (6.1 MB)
3. Using simg2img
(Step 1)
- Place
simg2img
in a folder and copy/move thesuper.img
file into the same folder. - Open CMD from this folder or navigate to it using
cd
. - Run this command:
simg2img super.img super1.img
- If the Super file is compressed, this creates
super1.img
. - the Super can also be called super - without .img -write the command accordingly.
- If you see this error:
Skip this step and use the originalInvalid sparse file format at header magic Failed to read sparse file
super.img
in the next step.
- If the Super file is compressed, this creates
4. Using Lpunpack
(Step 2)
- Move the
super1.img
(orsuper.img
) to theLpunpack
folder. - Open CMD from this folder or navigate to it using
cd
. - Run this command:
Lpunpack super.img
- Wait for it to extract the partitions (
system.img
,product.img
, etc.) into the folder. about 3 minutes…
Move these extracted partitions to the Lpmake
folder.
5. Using Lpmake
(Step 3)
A. Get Partition Sizes
- Right-click each
.img
file, go to Properties, and copy the Size in bytes. - Remove commas and paste the sizes into the Lpmake text file i provided under “SUPER DETAILS,” like this:
SUPER DETAILS
system_a.img 620957696
system_ext_a.img 1227198464
system_ext_b.img 0
product_a.img 1368666112
product_b.img 0
vendor_a.img 269713408
vendor_b.img 0
system_b.img 56127488
- Record two additional sizes:
- Unpacked Super size
- Combined size of all extracted partitions
Example:
--device super:4294967296 --group main:4330033152
B. Fill in the Lpmake Command Template
Here’s the template:
MAKING FORMAT
lpmake --metadata-size 65536
--super-name super
--metadata-slot=1
--device super:<GROUP_SIZE>
--group main:<GROUP_SIZE>
--partition system_a:readonly:<SUPER_SIZE>:main --image system_a=./system_a.img
--partition product_a:readonly:<SUPER_SIZE>:main --image product_a=./product_a.img
--partition product_b:readonly:<SUPER_SIZE>:main --image product_b=./product_b.img
--partition vendor_a:readonly:<SUPER_SIZE>:main --image vendor_a=./vendor_a.img
--partition vendor_b:readonly:<SUPER_SIZE>:main --image vendor_b=./vendor_b.img
--partition system_b:readonly:<SUPER_SIZE>:main --image system_b=./system_b.img
--sparse --output ./super.img
- Replace
<SUPER_SIZE>
and<GROUP_SIZE>
with their respective values. - Adjust for dual-slot devices by using
--metadata-slot=a/b
. - ajust the metadata-size to
32768
if your device is a 32bit. now its set to 64bit.
C. Run the Command
- Open CMD from the
Lpmake
folder or navigate to it usingcd
. - Copy Paste the each line of the making format list with a space in between each command.
it should look like this:
tap to see
lpmake --metadata-size 65536 --super-name super --metadata-slot=1 --device super:4294967296 --group main:3542663168 --partition system_a:readonly:620957696:main --image system_a=./system_a.img --partition product_a:readonly:1368666112:main --image product_a=./product_a.img --partition product_b:readonly:0:main --image product_b=./product_b.img --partition vendor_a:readonly:269713408:main --image vendor_a=./vendor_a.img --partition vendor_b:readonly:0:main --image vendor_b=./vendor_b.img --partition system_b:readonly:56127488:main --image system_b=./system_b.img --sparse --output ./super.img
- press Enter.
- it will start doing its thing. it may say
Invalid sparse file format at header magic
but that doesnt mean anything, so don’t worry.
6. Flashing the GSI
To flash a GSI, rename it to system_a.img
and replace the existing system_a.img
.
Troubleshooting
If you see an error like this:
lpmake E 11-21 13:11:16 1784 1324 images.cpp:338 [liblp] Image for partition 'system_a' is greater than its size (766783488, expected 620957696)
Try these fixes:
- Replace the decompressed Super size with the original compressed Super size.
- Remove
_b
partitions from the configuration. - Tweak the sizes as needed.
This process can be tricky, but with persistence, it works!
Final Notes
If you’ve followed along and successfully unpacked and repacked the Super partition, I want to hear from you! Feel free to PM me and share your results—I’m always curious to see how it went.
This method is how I’ve laid the groundwork for many of my custom ROMs. With practice, you’ll get it down too.
Thanks for reading, and I hope this guide helps you master one of the more advanced aspects of Android modding.
Now this is a post!