[TOOL][WIN,LIN,AND,DARW] Super image tools | extract or make partitions RW in super partition

Search This thread

Pervokur

Senior Member
Feb 15, 2022
145
44

Attachments

  • Screenshot_20220628-232450_Total Commander.png
    Screenshot_20220628-232450_Total Commander.png
    334.1 KB · Views: 17
  • Like
Reactions: lebigmac

starbucks2010

Senior Member
Jun 30, 2010
3,154
1,866
Hi,

Tried to unpack a S22U Exynos super.img but getting the error from picture (error: This is nor a super image!).

Any idea what is wrong ?

Thank you.
 

Attachments

  • super_error.png
    super_error.png
    10.2 KB · Views: 15

Atlas11010

Member
Jun 30, 2022
5
0
How to use superrepack:

adb push superrepack.arm64_pie /data/local/tmp
adb shell
su
cd /data/local/tmp
mv superrepack.arm64_pie superrepack
chmod 755 superrepack
stop
./superrepack /dev/block/bootdevice/by-name/super system_a
sync
reboot
what do you mean by_name whhaa do I type in my device name?
 

Atlas11010

Member
Jun 30, 2022
5
0
Disclaimer:

Super image tools was made for testing and educational purposes, ME is not responsible for what you do on/with your device using our tools, you must agree that you using our tools on your own risk, I am not responsible for anything else!


How to use superunpack:

- First step, unpack super.sin using my tool or use @IgorEisberg unsin tool
- Step two, Superunpack. On windows just drag and drop unpacked super image onto our exe to start extraction. Also you can use it from command line, from script or from etc. On Linux use it from command line. No need to set slot like it was a case on lpunpack, our tool will auto extract all slot images for you, enjoy!
- If you need to unpack partition images in RW mode add parameter 1 at the end of command line e.g. "superunpack super.img 1", than resize partition using resize2fs, repair and unshare blocks using e2fsck. Or if you unpack without rw you no need to resize or repair it, just mount it ro.

Note that, superunpack is a tool for extract all logical partitions from super image or directly from super partition.

How to use superrepack:

adb push superrepack.arm64_pie /data/local/tmp
adb shell
su
cd /data/local/tmp
mv superrepack.arm64_pie superrepack
chmod 755 superrepack
stop
./superrepack /dev/block/bootdevice/by-name/super system_a
sync
reboot

Note that, superrepack is a tool to convert logical RO partitions iside your phone super partition to RW mode without extracting anything, all things is done on the fly directly inside super partition/image! In this example system_a partiton is converted to the rw mode, if you need other partitions to rw just change system_a argument. Or if you need all partitions to rw mode do it without partition rw argumet e.g: "./superrepack /dev/block/bootdevice/by-name/super". YOU MUST RUN TOOL 4-5 TIMES UNTIL ALL ERRORS DISAPEARS!!! One of the well known errors is: "Couldn't clone file: Could not allocate block in ext2 filesystem". Look at /data/local/tmp/script.log each time and make sure it not contain any error otherwise you are not done things right and partition is not repaired yet!!! More info -> https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-84966715

Platform:

- Superunpack is working on Windows, Linux, Android, Darwin11, just chose right binary.
- Superrepack is working only under android


Changelog:

- version 1 (21.Jun.2020), initial version
- version 1.1 (22.Jun.2020), dump file format detection, partition size correction in case ext4, partition group detection, have extraction progress bar, improvements
- version 2 (03.04.2021) implemented possibility to extract partition images to rw mode using Superunpack & I have made new tool called Superrepack
- version 2 (04.04.2021) implemented arguments so you would do conversion on single partition instead of doing it on all partitions
- version 3 (04.04.2021) implemented return codes and implemented output logs to be more scripting friendly
- version 4 - not released
- version 5 (08.04.2021) implemented resize and repair partitions after switching to rw mode. Implemented build script for building resize2fs, e2fsck, simg2ims, img2simg, lptools
- version 6 (08.04.2021) better loop device detection and setup
- version 7 (08.04.2021) fix selinux status detection
- version 8 (15.04.2021) fix loop device setup in superrepack
- version 9 (16.04.2021) make losetup android compatible
- version 10 - not released
- version 11 (01.05.2021) simplified, removed needs for parameter rw, implemented dm-verity disabler
- version 12 (05.05.2021) make old logs always deleted before fresh log is created, this prevent concentation with old logs
- version 13 (06.05.2021) make linux version so you should do the things on your super partition dump in linux machine
- version 14 (07.05.2021) fix compilation mess between linux and android
- version 15 (08.05.2021) use libselinux to determine and set selinux to permissive mode instead of popening getenforce-setenforce tools

Credits:

- me and me :)


Source code:

- source code -> https://github.com/munjeni/super_image_dumper
were do I get the super.sin file
 

munjeni

Senior Member
Jun 2, 2011
9,580
22,215
I'm believing samsung have it encrypted so you will need to decrypt first! For further questions see picture
 

Attachments

  • 2022-06-30_135217.jpg
    2022-06-30_135217.jpg
    39.3 KB · Views: 18

munjeni

Senior Member
Jun 2, 2011
9,580
22,215
If this answer was intended for my post #365 then the answer is no, the image is not encrypted.
Ok probably its true, but definitelly its not a standard lpmetadata format which superunpack searching for! For idea you should take a look at this line https://github.com/munjeni/super_im...c8725d00aea3c962c028aa4793/superunpack.c#L201

You should open image with an hex editor and post here first 100 bytes and I can tell you than what might be needed!
 
  • Like
Reactions: lebigmac

starbucks2010

Senior Member
Jun 30, 2010
3,154
1,866
Magic bytes 0xED26FF3A. Yes thats compressed sparse image, you probably need simg2img tool to unsparse them first! Even if after simg2img my tool somehow not working give me another hex and I will try to let you know further
After running simg2img on super.img, the tool unpacked it into 4 files .bin (system,bin, vendor.bin, product.bin and odm.bin). Are these files the stock rw .img files?

Here's the successful unpacking log and the header of the unsparse image.

Thank you.
 

Attachments

  • unpack_log_ok.log
    4.3 KB · Views: 3
  • super_unsparse_header.png
    super_unsparse_header.png
    27.8 KB · Views: 6

munjeni

Senior Member
Jun 2, 2011
9,580
22,215
After running simg2img on super.img, the tool unpacked it into 4 files .bin (system,bin, vendor.bin, product.bin and odm.bin). Are these files the stock rw .img files?

Here's the successful unpacking log and the header of the unsparse image.

Thank you.
Yes its raw partition files, you should mount them inside linux. Do in mind this is not real rw! Search for how dynamic disk working! If you delete one file now from that partitions you will delete a ton of files referenced to those file! Superunpack tool is intended only for fast and easy partitions extraction from super image, further work is needed to make them fully rw. For exapmle you need to unshare blocks, to resize partition, repair using e2fsck ...etc than if everything is ok your partitions is fully rw. Take a look at superrepack
https://github.com/munjeni/super_image_dumper/blob/master/superrepack.cpp#L276

I have mannaged to mount them on the fly and repair.resize,unshare blocks on the fly without extracting anything! And it take almost ten secconds. The only problem is that some files on some devices is deleted after e2fsck and it cause a bootloop on almost half of the available devices today. I do not have superpartition device so can't make them fully working, investigation need to be done on e2fsck source level, mean an custom implementation.
 
Last edited:

starbucks2010

Senior Member
Jun 30, 2010
3,154
1,866
Yes its raw partition files, you should mount them inside linux. Do in mind this is not real rw! Search for how dynamic disk working! If you delete one file now from that partitions you will delete a ton of files referenced to those file! Superunpack tool is intended only for fast and easy partitions extraction from super image, further work is needed to make them fully rw. For exapmle you need to unshare blocks, to resize partition, repair using e2fsck ...etc than if everything is ok your partitions is fully rw. Take a look at superrepack
https://github.com/munjeni/super_image_dumper/blob/master/superrepack.cpp#L276

I have mannaged to mount them on the fly and repair.resize,unshare blocks on the fly without extracting anything! And it take almost ten secconds. The only problem is that some files on some devices is deleted after e2fsck and it cause a bootloop on almost half of the available devices today. I do not have superpartition device so can't make them fully working, investigation need to be done on e2fsck source level, mean an custom implementation.
which command have you used to mount images RW?
I can only mount images in RO and get this message:

WARNING: source write-protected, mounter read-only.

thanks
 

Top Liked Posts

  • There are no posts matching your filters.
  • 43
    Disclaimer:

    Super image tools was made for testing and educational purposes, ME is not responsible for what you do on/with your device using our tools, you must agree that you using our tools on your own risk, I am not responsible for anything else!


    How to use superunpack:

    - First step, unpack super.sin using my tool or use @IgorEisberg unsin tool
    - Step two, Superunpack. On windows just drag and drop unpacked super image onto our exe to start extraction. Also you can use it from command line, from script or from etc. On Linux use it from command line. No need to set slot like it was a case on lpunpack, our tool will auto extract all slot images for you, enjoy!
    - If you need to unpack partition images in RW mode add parameter 1 at the end of command line e.g. "superunpack super.img 1", than resize partition using resize2fs, repair and unshare blocks using e2fsck. Or if you unpack without rw you no need to resize or repair it, just mount it ro.

    How to manualy patch super partition in under Linux:
    https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-87112415

    Note that, superunpack is a tool for extract all logical partitions from super image or directly from super partition.

    How to use superrepack:

    adb push superrepack.arm64_pie /data/local/tmp
    adb shell
    su
    cd /data/local/tmp
    mv superrepack.arm64_pie superrepack
    chmod 755 superrepack
    stop
    ./superrepack /dev/block/bootdevice/by-name/super system_a
    sync
    reboot

    Note that, superrepack is a tool to convert logical RO partitions iside your phone super partition to RW mode without extracting anything, all things is done on the fly directly inside super partition/image! In this example system_a partiton is converted to the rw mode, if you need other partitions to rw just change system_a argument. Or if you need all partitions to rw mode do it without partition rw argumet e.g: "./superrepack /dev/block/bootdevice/by-name/super". YOU MUST RUN TOOL 4-5 TIMES UNTIL ALL ERRORS DISAPEARS!!! One of the well known errors is: "Couldn't clone file: Could not allocate block in ext2 filesystem". Look at /data/local/tmp/script.log each time and make sure it not contain any error otherwise you are not done things right and partition is not repaired yet!!! More info -> https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-84966715

    Platform:

    - Superunpack is working on Windows, Linux, Android, Darwin11, just chose right binary.
    - Superrepack is working only under android


    Changelog:

    - version 1 (21.Jun.2020), initial version
    - version 1.1 (22.Jun.2020), dump file format detection, partition size correction in case ext4, partition group detection, have extraction progress bar, improvements
    - version 2 (03.04.2021) implemented possibility to extract partition images to rw mode using Superunpack & I have made new tool called Superrepack
    - version 2 (04.04.2021) implemented arguments so you would do conversion on single partition instead of doing it on all partitions
    - version 3 (04.04.2021) implemented return codes and implemented output logs to be more scripting friendly
    - version 4 - not released
    - version 5 (08.04.2021) implemented resize and repair partitions after switching to rw mode. Implemented build script for building resize2fs, e2fsck, simg2ims, img2simg, lptools
    - version 6 (08.04.2021) better loop device detection and setup
    - version 7 (08.04.2021) fix selinux status detection
    - version 8 (15.04.2021) fix loop device setup in superrepack
    - version 9 (16.04.2021) make losetup android compatible
    - version 10 - not released
    - version 11 (01.05.2021) simplified, removed needs for parameter rw, implemented dm-verity disabler
    - version 12 (05.05.2021) make old logs always deleted before fresh log is created, this prevent concentation with old logs
    - version 13 (06.05.2021) make linux version so you should do the things on your super partition dump in linux machine
    - version 14 (07.05.2021) fix compilation mess between linux and android
    - version 15 (08.05.2021) use libselinux to determine and set selinux to permissive mode instead of popening getenforce-setenforce tools

    Credits:

    - me and me :)


    Source code:

    - source code -> https://github.com/munjeni/super_image_dumper
    18
    I'm not one of those who make paid software and promote on xda, my work is always free. Even I'm always providing source code for free, source code of this tool is here -> https://github.com/munjeni/super_image_dumper , enjoy! ;)
    3
    Version 7 is out! V6 had error detecting slinux status. I do not have device with super partition for test my tool but I have only hope that all is ok. Let me know! :)
    3
    Pixel 4a, working. V13
    3
    how about simg2img