Unpacker Kitchen for Android(UKA)

Search This thread

emmanuelo7

Senior Member
Mar 3, 2011
266
49
What kind of update.zip? OTA? Recovery firmware zip? You have to be more specific. It depends on the files inside the zip. Did you already unpack the archive to see what files are in there?

OTA => never contains whole firmware images! Only single file system blocks. File size < 300MB

Recovery.zip = whole firmware images with *.dat.br (brotli compressed *.dat files) and *.list file extensions. To unpack them use:
Code:
su
menu

# use option:
5.) => Unpack .br
# and/or
6.) => Unpack .dat
# accordingly to the files inside your zip.

You do not need a step by step guide to use UKA. You need a better understanding of the different file types that are used by Android. I strongly recommend you to use a Linux OS instead of Windows when dealing with ext4 file systems and all the other file types on your desktop to modify them.
First of all Thank u for the reply!!😍
I m interested in taking each update of miui make them debloated ,disable force encrypted e.t.c and then make a zip for flashing the rom.
Second option is taking an already custom rom and debloated further more.
My general problem is how can edit and build .
 

WoKoschekk

Senior Member
Feb 25, 2019
1,045
1
332
Cologne
Moto G6
Moto G6 Plus
I m interested in taking each update of miui make them debloated ,disable force encrypted e.t.c and then make a zip for flashing the rom.
It doesn't make sense to build a flashable ROM. I assume you're using TWRP or OF to flash the zips?

A normal OTA.zip contains 3 files for each updated system partition, e.g. /system => system.transfer.list + system.new.dat + system.patch.dat.
The last one isn't important, so we ignore it.

system.new.dat => contains the new blocks for /system (all or only the updated ones)

system.transfer.list => Holds the information at which address the blocks of system.new.dat should be written to

What you are trying to do: system.transfer.list + system.new.dat => system.img (raw image by using sdat2img) => modify it => repack it to system.transfer.list + system.new.dat => flash it, where it gets unpacked to a raw image again.

What you should do: system.transfer.list + system.new.dat => system.img => modify it => flash it to /system using fastboot or TWRP.

That's much easier than building a complete new OTA.zip.
 
  • Like
Reactions: emmanuelo7

emmanuelo7

Senior Member
Mar 3, 2011
266
49
It doesn't make sense to build a flashable ROM. I assume you're using TWRP or OF to flash the zips?

A normal OTA.zip contains 3 files for each updated system partition, e.g. /system => system.transfer.list + system.new.dat + system.patch.dat.
The last one isn't important, so we ignore it.

system.new.dat => contains the new blocks for /system (all or only the updated ones)

system.transfer.list => Holds the information at which address the blocks of system.new.dat should be written to

What you are trying to do: system.transfer.list + system.new.dat => system.img (raw image by using sdat2img) => modify it => repack it to system.transfer.list + system.new.dat => flash it, where it gets unpacked to a raw image again.

What you should do: system.transfer.list + system.new.dat => system.img => modify it => flash it to /system using fastboot or TWRP.

That's much easier than building a complete new OTA.zip.
yes TWRP and ofox sometimes
my plan is making a build custom rom from ota.zip
like this:
 

emmanuelo7

Senior Member
Mar 3, 2011
266
49
This one for example.
I have no words for thanking you.
All these years of flashing ,i want to pass to next level so i can make my own builds only according my tastes
.
 

WoKoschekk

Senior Member
Feb 25, 2019
1,045
1
332
Cologne
Moto G6
Moto G6 Plus
This one for example.
I have no words for thanking you.
All these years of flashing ,i want to pass to next level so i can make my own builds only according my tastes
.
Some basic facts:
Your POCO F3 uses A/B slots and in this context your OTA files are merged in a payload.bin. A payload.bin is a special container format. To unpack a payload.bin you could use the UKA or a tool called payload_dumper. It's available for Android (Termux), Linux and Windows.

It's not possible (or much too complicated) to unpack a payload.bin, modify the images and repack it again. So, you have to work with the unpacked raw images in ext4 format and at the end you have to flash them via a custom recovery or fastboot.

Work with raw images:
The ext4 file system is used by Linux and Android. Windows is not able to open this format except you are using some special tools. But it's not recommended.
A raw image is like an ISO file in Windows and exactly the same as having a hard drive. You could mount (plug in) a hard drive on a Linux/Android machine or mount a raw image by using the machine's shell. Both methods let you modify its contents.
I wouldn't recommend to unpack a system.img, modify it and repack it again to a system.img. That's not the common way to deal with ext4 images. Mounting a ext4 image on a Linux machine is much, much better.

I don't know what your goal is when modifying the content of your update files. But booting TWRP, mounting /system and do your changes is at the end of all the same as modifying the raw system.img and flash it. But it's much easier.

Problems with modifying system.img:
When modifying /system you encounter a lot of problems that all lead to a non bootable system. The reason is AVB (Android verified boot) or better known as vbmeta.img. The partition /vbmeta stores hashes (checksums) to validate critical system partitions to avoid any corruption of their content. A modified content will change the hash of a partition and as a result of this your system will not boot. To avoid AVB will refuse booting your system you need to patch the vbmeta partition. UKA could do this for you. Maybe it's already done by you when installing a custom recovery since it requires a patched vbmeta, too.

BTW: That's also the reason for using Magisk modules. Magisk is a systemless rooting method. Magisk will never ever touch /system! But to be able to modify system related files or parts Magisk mounts only a mirror of /system. While mounting this mirror Magisk will load all its modules to modify this mirror. But not to modify /system!

Summarizing it:
Repacking a OTA is not possible. To make changes on /system you only need a custom recovery and a patched vbmeta.
Depending on what to modify it could be better to use a Magisk module, e.g. when (un)installing some system apps.
 
Jul 3, 2009
6
1
Xiaomi.eu change file
Now, How to unpack super.img.0
Screenshot_2023-01-30-18-22-09-861_com.mixplorer.silver-edit.jpg
 

WoKoschekk

Senior Member
Feb 25, 2019
1,045
1
332
Cologne
Moto G6
Moto G6 Plus
Xiaomi.eu change file
Now, How to unpack super.img.0
You can't unpack super.img.0. Your image
is splitted into so called "chunks" in sparse format because your bootloader accepts only a very limited file size when flashing via fastboot. It's the same thing like a splitted ZIP archive when dealing with large files.

So, first put them together using "simg2img". This tool is available when UKA is installed and active:

- create a folder e.g "super" in internal storage
Code:
mkdir /sdcard/super
- copy all super.img.XX files into this folder
- run simg2img to repack them to raw image:
Code:
su
cd /sdcard/super
simg2img $(ls -vw 0 super.img.*) super.img
- super.img is now in raw format

A super.img is a container format to store /system, /vendor etc. After creating the raw super.img you have to unpack /system or another image to get its content.
 

XDXDDX

Member
Dec 19, 2022
19
3
i just use uka 5.15 and tried to unpack an erofs vendor.img of huawei but i couldnt convert it into ext4 .img i cant repack it, everytime i repack it it just shows:
Main Menu: Version v5.15 Full English by @FeLLzMODs ---------------------------- Enter the number corresponding to the desired action: ...../sdcard/vendor_backup_2023-01-31_08-33-48.img has file system erofs! .....Deleting the old "vendor_backup_2023" folder and configuration files... .....Unpacking /sdcard/vendor_backup_2023-01-31_08-33-48.img... ...error: Error! Incorrect extraction of files the /data/local/UnpackerSystem/erofs/vendor_backup_2023 folder will not be available for building on ext4!
 

puturaya20

Senior Member
Jun 24, 2013
620
67
Denpasar
Rename all of them into super.img_sparsechunk.0, super.img_sparsechunk.1,......

Then copy or move them to root/data/local/UnpackerQfil

Termux > su > menu > 11 > 4 > 1

Done, the output img will be there in the UnpackerQfil/output. Just unpack it as you unpack img files normally

how DEBLOAT use script?

com.miui.compass
com.miui.bugreport
com.google.android.googlequicksearchbox
com.xiaomi.joyose
com.android.email
com.xiaomi.payment
cn.wps.moffice_eng.xiaomi.lite
com.mi.health
com.miui.huanji
com.miui.mishare.connectivity
com.miui.videoplayer
com.mfashiongallery.emag
com.miui.daemon
com.miui.player
com.miui.notes
com.android.soundrecorder
com.xiaomi.scanner
com.miui.miservice
com.android.updater
com.miui.weather2
eu.xiaomi.ext
com.mi.globalbrowser

for example, I want to delete this but without deleting the folders one by one.
I want to input the command, which is in this list to delete
 

Anulal

Member
Dec 23, 2019
6
0
Screenshot_2023-03-02-16-33-57-51_84d3000e3f4017145260f7618db1d683.jpg
i was trying to build image of system.img
but taking too much hours to build.
any solution for this.? Suggest me

options are 7 1 3 0 0 .. It os doing modification in system_fs_config.tmp file.. (Creation complete is slow also).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    View attachment 5851681i was trying to build image of system.img
    but taking too much hours to build.
    any solution for this.? Suggest me

    options are 7 1 3 0 0 .. It os doing modification in system_fs_config.tmp file.. (Creation complete is slow also).
    You did something wrong. Check Again.
    1
    My smartphone is mtk . Is it possible to make system rw ? If yes. Send link or guide please.
    Sure you can. It is enough just to disassemble and reassemble the images of your system.
    This kitchen was developed on a smartphone with an MTK processor.

    Update to 5.18
    1
    flash the latest version, see posts above
    Thx, this worked
  • 9
    version: 4.9.4

    Last update of the program in the header: 04/06/2020

    Developer: kory-vadim

    For the program to function, root privileges are required.

    Install: flash as Magisk module

    Short description:
    Unpacking, assembling and converting system (vendor) {. Img} {. New.dat} {. New.dat.br}, mounting raw.images, gluing the system.img broken into parts into a single image (from the firmware for Qfil), unpacking payload.bin, repackaging boot (recovery) .img, extracting file_contexts from boot.img (android <= 8.1), and converting file_contexts.bin on the phone.

    Description:
    To unpack images, you can use a phone with android 5+.
    The system make_ext4fs is used from the phone’s firmware, so on a phone with android 6+ (or better 7), you can collect system.img images from android 5+.
    We need root rights, busybox (needed before UKA version: 4.4 inclusive) and enough space for the images themselves and unpacking them in ./data.
    Before flashing versions 4.6, 4.7, delete the old version and flash the corresponding archive via twrp.
    In the kitchen there is a utility AIK - Android Image Kitchen for repacking boot (recovery) .img.
    If, for some reason, you do not want to flash AIK-mobile (or, for example: already installed), then delete the file "AIK.Mobile.Installer.v3.4.zip" from the archive and flash "unpack-android_new_4.6. zip "without this file.
    After flashing, install the terminal emulator (if it is not already installed), and check the box for UTF-8 in its settings.

    To start the kitchen, in the terminal enter:
    su
    menu

    Go to the item: "Extract file_contexts", and select the subitem: "Install configuration", if this is not done, then the conversion file_contexts.bin -> file_contexts will not work.
    You need to run the configuration installation only once.
    *In version 4.5 and above it should work without applying this item.

    And then enter the numbers corresponding to the desired action.

    To extract file_contexts, put boot.img in the folder: /data/local/UnpackerContexts.
    To unpack .img images, you need to put system.img or vendor.img in the folder: /data/local/UnpackerSystem, and select the .img file (no more than 5) for unpacking.
    When unpacking, the folders will be deleted: "system", or "vendor"; files: * _fs_config and * _pack.sh from the previous unpacking.
    To build the image, copy the received file_contexts to the folder: /data/local/UnpackerSystem, if for some reason it will not be in the folder, then the assembly will be performed with file_contexts obtained when unpacking the image.
    If files or folders were added to the disassembled image, then before assembling it, you must enter everything added into fs_config, and only then collect it.
    If there are spaces in the names of folders or files in the unpacked image, then make_ex4fs will not collect such an image until you rename the files and correct the entries in fs_config.
    Therefore, adding folders and files with spaces to the unpacked image is also not possible.
    In version 4.6, the write assistant in fs_config is added.
    If you just deleted something, then you do not need to edit fs_config.
    Also in the collected folder must be present symlinks.
    Well, in terms of context, Selinux will also need to be watched, depending on what was added.
    To unpack or convert .dat, .br and in other cases, you will be prompted to enter the path to the folder where the image is located (in the same folder should be system (vendor) .transfer.list).
    When converting and assembling in .dat, look behind the phone screen, because in some cases you need to enter a number corresponding to the version of the android, the image being collected.

    There is a choice of compression ratio for converting * .new.dat to br.
    To reduce the conversion time, compression can be selected 3-5 (maximum 7).

    To unpack boot (recovery) .img, put the file in the folder: /data/local/AIK-mobile, and select the file in the menu: "unzip boot"
    For packaging, use the item: "pack boot".
    The collected file will be located in the folder: /data/local/AIK-mobile with the name boot-output.img.
    To clean the working folder, also use the corresponding item. Source and output files will not be deleted.
    AIK-mobile can be completely removed from the phone directly from the menu.

    To mount, use the corresponding menu item, and the raw image must be located in the folder: /data/local/UnpackerSystem.
    Do not forget to unmount the image.
    To remove the kitchen from the phone, go to the corresponding menu item and confirm the removal,
    after confirmation, the phone will be overloaded in twrp, and after working out the script, it will be loaded into the system.

    Screenshots(Gdrive): https://drive.google.com/folderview?id=1-5dSaOQKpDH4gy737gcDp-Anp0vAj_VU

    Download(Gdrive): https://drive.google.com/file/d/1-nOvictMuUNXbowwn3h1lbdrkJur2jJh/view?usp=drivesdk

    MOD EDIT: Link removed
    5
    please try attached ZIP module, compiled by me thanks to RajivShastri king's translation
    3
    UKA_5.6_eng_screenshot
    3
    Yes, fixed v5.6.
    3
    UKA_5.6_eng_magisk.zip ("Translated in English")