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

Search This thread

pandavova

Senior Member
  • Feb 9, 2016
    116
    16
    So I reflashed stock rom, booted one time, flashed the patched image to boot_a and boot_b. Im getting a "Your device is corrupt. It can't be trusted and will not boot. Your device will be powered off in 5 seconds." screen. Flashing the normal Magisk img works and the device boots with Magisk 22.1. If I reflash your patched img it shows me the "Your device is corrupt." screen again.
     
    • Like
    Reactions: munjeni

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    That have 3 meaning, your device have avb protection active or I didn't had right mkbootimg tool to make new boot image or fstab avb removal cause bootloop. Did you tried:

    fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
     

    pandavova

    Senior Member
  • Feb 9, 2016
    116
    16
    That have 3 meaning, your device have avb protection active or I didn't had right mkbootimg tool to make new boot image or fstab avb removal cause bootloop. Did you tried:

    fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
    Yeah, I tried it with this empty vbmeta file: https://androidfilehost.com/?fid=2188818919693783115

    I don't know if this would be the correct one, I got it from here: https://www.androidjungles.com/download-and-flash-blank-vbmeta-file/

    Or do you mean I should try to flash the normal vbmeta with that command?
     

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    I'm not sure since I own xperia 10 which do not have all this featues so I can't test anything. I'm realy tired now with this tool, I will delete it right now.
     

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    You see here is few peoples interested for my tool, and null who want to help, I realy wanted to finish tool but as you see theres no go. Do you have idea how can I repack magisk image? Do you have idea why repacked boot image not boot? Do I need to sign it? I was worked on android 3 years ago, thats long time ago when dm-verity, super partitions and b.s. was not found, in the time when I worked on android mkbootimg tool never caused bootloop, but now I see it produce "Your device is corrupt. It can't be trusted" and to be honest I'm tired of crazy google protections. If you have idea let me know!
     
    • Like
    Reactions: lebigmac

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    If you want we can test if bootloop is caused by fstab modification or caused by not adequate tool for repacking magisk image, are you ready to test just repacked magisk image without any modification, just repacked? If you are not ready to spend 30 minutes with me now let me know, I no want to wait long replies, allready spent 2-3 hour without figuring anything I simply do not have free time for this anymore, if you are ready let me know! I need to be sure what cuse "Your device is corrupt."
     

    pandavova

    Senior Member
  • Feb 9, 2016
    116
    16
    If you want we can test if bootloop is caused by fstab modification or caused by not adequate tool for repacking magisk image, are you ready to test just repacked magisk image without any modification, just repacked? If you are not ready to spend 30 minutes with me now let me know, I no want to wait long replies, allready spent 2-3 hour without figuring anything I simply do not have free time for this anymore, if you are ready let me know! I need to be sure what cuse "Your device is corrupt."
    yeah lets try that out! i am ready to spend time with you! its also in my interest that this tool works :D
     

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    Can you confirm magisk22.1_patched_boot_58.1.A.5.159_XQ-AS52_UNTESTED.img boot on your device?? This is how I repacked justrepacked.img (hope somebody tell me what I doing wrong):

    Code:
    rm -rf ramdisk
    mkdir ramdisk
    cd ramdisk
    gunzip < ../magisk22.1_patched_boot_58.1.A.5.159_XQ-AS52_UNTESTED.img-ramdisk.gz | cpio -id
    find . -print | cpio -H newc -o | gzip > ../ramdisk.gz
    cd ..
    mkbootimg --kernel ./magisk22.1_patched_boot_58.1.A.5.159_XQ-AS52_UNTESTED.img-zImage --dt ./magisk22.1_patched_boot_58.1.A.5.159_XQ-AS52_UNTESTED.img-dtb --ramdisk ./ramdisk.gz --cmdline 'androidboot.hardware=qcom androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 androidboot.usbcontroller=a600000.dwc3 swiotlb=2048 loop.max_part=7 cgroup.memory=nokmem,nosocket reboot=panic_warm buildproduct=pdx206 buildid=EDO-2.1.1-210330-1117 oemboot.earlymount=/dev/block/platform/soc/1d84000.ufshc/by-name/oem:/mnt/oem:ext4:ro,barrier=1:wait,slotselect,first_stage_mount buildvariant=user' --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --pagesize 4096 -o justrepacked.img

    Device is Sony Xperia 5ii, XQ-AS52_EEA_58.1.A.5.159, Android 11, it boot sucesfully magisk22.1_patched_boot_58.1.A.5.159_XQ-AS52_UNTESTED.img before repack but after repack it produce "Your device is corrupt. It can't be trusted and will not boot. Your device will be powered off in 5 seconds." and I realy have no idea why! This is just repacked image without any modification -> https://easyupload.io/ir46wk

    Can you try justrepacked.img and let me know? Anybody tell me which mkbootimg tool is compatible and sure working with xperia 5II ??
     
    Last edited:

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    Maybe more infos for you because I don't know what you are doing with fstab. If you didn't read that github link: the magisk img was already repacked one time because if you just flash the boot img with magisk in the app and flash that, it doesn't work. something needs do be commented out for it to work https://github.com/topjohnwu/Magisk/issues/3752#issuecomment-814410901
    What I done in previous img is removed all avb lines from fstab e.g.

    system /system ext4 ro wait,,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey

    to

    system /system ext4 ro wait,logical,first_stage_mount

    but please let me know this one unmodified -> https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-84985101 need to know if repack cause bootloop or fstab before I start investigating
     
    Last edited:

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    13 minutes is gone and I have 10 minutes left right now untill my pc is off otherwise see you tommorow. Tommorow if we not figure out thing superrepack for sure going to the trash as I have no intention of wasting time anymore
     
    • Sad
    Reactions: lebigmac

    pandavova

    Senior Member
  • Feb 9, 2016
    116
    16
    Sorry for the delay, with the "justrepacked.img" I'm also getting the "Your device is corrupt." screen.
    Flashing the "normal" magisk img back lets me boot again.
     
    • Like
    Reactions: munjeni

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    Ok thanks, so definitelly repacking without any single modification cause boot loop. I don't know what I need to do since it was long time ago when I used mkbootimg tool. Let see tommorow if somebody help, if not I realy going to delete superrepack... see you tommorow I must go now
     

    pandavova

    Senior Member
  • Feb 9, 2016
    116
    16
    Ok thanks, so definitelly repacking without any single modification cause boot loop. I don't know what I need to do since it was long time ago when I used mkbootimg tool. Let see tommorow if somebody help, if not I realy going to delete superrepack... see you tommorow I must go now
    In the Github Issue the person repacked it with android image kitchen, so maybe its because of that?

    bye bye ^^
     
    • Like
    Reactions: lebigmac

    pandavova

    Senior Member
  • Feb 9, 2016
    116
    16

    f1^ter

    Member
    Jan 8, 2016
    47
    40
    32
    Nadym
    Sony Xperia 1 II
    I'll add it on my own.
    I tried with v13, and after the first time the command:
    Code:
    ./superrepack /dev/block/bootdevice/by-name/super
    it gave me an error mounting RW, but when I did it 3-5 times-the error disappeared and all the partitions really showed RW. After the reboot, the system was loaded surprisingly and this is magic. But then a strange thing began, if I, for example, delete an application from the system partition , then when the system is rebooted, the system somehow loads, but system crashes occur, "the user interface is stopped". I understand that the blocks were not properly converted to RW after all? And when you delete it, some of the blocks were broken. I recovered completely and went the same way, but only chose to delete the application from the product section, but when I deleted a couple of applications, then after restarting everything loaded - but the part of the Google application that is in the product-they did not start and constantly gave errors.
    We are already making great progress with version 13. But still something is missing, maybe there really is some other check? I remind you that all checks using vbmeta and vbmeta_system were disabled.
    Sony Xperia 1 II, FW 58.1.A.5.159
     
    Last edited:

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    I'll add it on my own.
    I tried with v13, and after the first time the command:
    Code:
    ./superrepack /dev/block/bootdevice/by-name/super
    it gave me an error mounting RW, but when I did it 3-5 times-the error disappeared and all the partitions really showed RW. After the reboot, the system was loaded surprisingly and this is magic. But then a strange thing began, if I, for example, delete an application from the system partition , then when the system is rebooted, the system somehow loads, but system crashes occur, "the user interface is stopped". I understand that the blocks were not properly converted to RW after all? And when you delete it, some of the blocks were broken. I recovered completely and went the same way, but only chose to delete the application from the product section, but when I deleted a couple of applications, then after restarting everything loaded - but the part of the Google application that is in the product-they did not start and constantly gave errors.
    We are already making great progress with version 13. But still something is missing, maybe there really is some other check? I remind you that all checks using vbmeta and vbmeta_system were disabled.
    Sony Xperia 1 II, FW 58.1.A.5.159
    You should not delete system applications otherwise framowork things which depend on those app will cause system crash, you must know which one can be deleted and which one can't, you must be carefull with it! If your /data/local/tmp/script.log contain NO errors than you are definitelly done things right and filesystem is fully ok, the rest of things you need to figure out byself with help of logcat and I can't tell you which apks is safe to delete!
     
    Last edited:

    munjeni

    Senior Member
    Jun 2, 2011
    9,305
    21,926
    Yeah it works on my device.
    But the original magisk img that you would get if you flash magisk on the boot.img with the app doesn't work. The provided magisk img was already repacked with android image kitchen as stated by the uploader https://github.com/topjohnwu/Magisk/issues/3752#issuecomment-814410901
    I found what cause bootloop! I didn't know that bootimage version header is updated to version 3 but I have old mkbootimg tool, will try compile latest one and make new image for test
     
    Last edited:

    Top Liked Posts

    • There are no posts matching your filters.
    • 1
      I need android kernel dmesg and not one from recovery kernel. And I not need last_log, I need dmesg.
      It's not uploading. I'll send a link to drive

      1
      Sde28 I'll find out, my super is sde26 I'm thinking that's the roll back or if possible another slot, b perhaps.
      But let me see what I can find out
      You can do it with:

      ls -l /dev/block/bootdevice/by-name
    • 27
      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. 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
      14
      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
      2
      New version is out, v11, it now detect file format, partition size correction in case ext4, partition group detection, have extraction progress bar, and it looks like:

      Code:
      ---------------------------------------------------------
      Super image dumper v_11 (by expert :) munjeni @ xda 2020)
      ---------------------------------------------------------
      
      LpMetadataGeometry magic = 0x616c4467
      LpMetadataGeometry struct size = 0x34
      LpMetadataGeometry sha256 = 12FF55F0ABA7B506F25CB5DA5DCA09344234E8DF1D9C93AE82A499D98019467E
      LpMetadataGeometry metadata_max_size = 0x10000
      LpMetadataGeometry metadata_slot_count = 0x3
      LpMetadataGeometry logical_block_size = 0x1000
      
      LpMetadataHeader magic = 0x414c5030
      LpMetadataHeader major_version = 10
      LpMetadataHeader minor_version = 0
      LpMetadataHeader header_size = 0x80
      LpMetadataHeader header sha256 = CCF4F5D07842AAAE7C1B87F0E025512CF7AEA426D477B1E5175DA3D74F9B1C8C
      LpMetadataHeader tables_size = 0x2e8
      LpMetadataHeader tables sha256 = 52578668F89D8BCDA1BD1F748F2F69ED874C10A7062C85EF9970EE05D90161B1
      LpMetadataHeader partitions offset = 0x0
      LpMetadataHeader partitions num_entries = 0x8
      LpMetadataHeader partitions entry_size = 0x34
      LpMetadataHeader extents offset = 0x1a0
      LpMetadataHeader extents num_entries = 0x5
      LpMetadataHeader extents entry_size = 0x18
      LpMetadataHeader groups offset = 0x218
      LpMetadataHeader groups num_entries = 0x3
      LpMetadataHeader groups entry_size = 0x30
      LpMetadataHeader block_devices offset = 0x2a8
      LpMetadataHeader block_devices num_entries = 0x1
      LpMetadataHeader block_devices entry_size = 0x40
      
      Partitions = 5 used, 3 not used, total 8
      
        partition_1_name = system_a
          attributes = 0x1
          first_extent_index = 0x0
          num_extents = 0x1
          group_index = 0x1
          partition_group = somc_dynamic_partitions_a
          extent num_sectors = 0x336390 (0x66c72000 bytes total)
          extent target_type = 0x0
          extent target_data = 0x800 (dumping offset = 0x100000)
          extent target_source = 0x0
            Filetype EXT4. EXT4 size = 0x6526c000
            Dumping system_a.ext4 ...
            ....................................................
            ....................................................
            ....................................................
            ..............................................
        partition_2_name = system_b
          attributes = 0x1
          first_extent_index = 0x1
          num_extents = 0x1
          group_index = 0x2
          partition_group = somc_dynamic_partitions_b
          extent num_sectors = 0xab178 (0x1562f000 bytes total)
          extent target_type = 0x0
          extent target_data = 0x337000 (dumping offset = 0x66e00000)
          extent target_source = 0x0
            Filetype EXT4. EXT4 size = 0x150b3000
            Dumping system_b.ext4 ...
            ..........................................
        partition_3_name = product_a
          attributes = 0x1
          first_extent_index = 0x2
          num_extents = 0x1
          group_index = 0x1
          partition_group = somc_dynamic_partitions_a
          extent num_sectors = 0x2b62b8 (0x56c57000 bytes total)
          extent target_type = 0x0
          extent target_data = 0x3e2800 (dumping offset = 0x7c500000)
          extent target_source = 0x0
            Filetype EXT4. EXT4 size = 0x5565b000
            Dumping product_a.ext4 ...
            ....................................................
            ....................................................
            ....................................................
            ..............
        partition_4_name = product_b (not unused)
          attributes = 0x1
          first_extent_index = 0x3
          num_extents = 0x0
          group_index = 0x2
          partition_group = somc_dynamic_partitions_b
          extent num_sectors = NULL
          extent target_type = NULL
          extent target_data = NULL
          extent target_source = NULL
            Skipping dump.
      
        partition_5_name = vendor_a
          attributes = 0x1
          first_extent_index = 0x3
          num_extents = 0x1
          group_index = 0x1
          partition_group = somc_dynamic_partitions_a
          extent num_sectors = 0x186d58 (0x30dab000 bytes total)
          extent target_type = 0x0
          extent target_data = 0x699000 (dumping offset = 0xd3200000)
          extent target_source = 0x0
            Filetype EXT4. EXT4 size = 0x30141000
            Dumping vendor_a.ext4 ...
            ....................................................
            ............................................
        partition_6_name = vendor_b (not unused)
          attributes = 0x1
          first_extent_index = 0x4
          num_extents = 0x0
          group_index = 0x2
          partition_group = somc_dynamic_partitions_b
          extent num_sectors = NULL
          extent target_type = NULL
          extent target_data = NULL
          extent target_source = NULL
            Skipping dump.
      
        partition_7_name = odm_a
          attributes = 0x1
          first_extent_index = 0x4
          num_extents = 0x1
          group_index = 0x1
          partition_group = somc_dynamic_partitions_a
          extent num_sectors = 0xa60 (0x14c000 bytes total)
          extent target_type = 0x0
          extent target_data = 0x820000 (dumping offset = 0x104000000)
          extent target_source = 0x0
            Filetype EXT4. EXT4 size = 0x132000
            Dumping odm_a.ext4 ...
      
        partition_8_name = odm_b (not unused)
          attributes = 0x1
          first_extent_index = 0x5
          num_extents = 0x0
          group_index = 0x2
          partition_group = somc_dynamic_partitions_b
          extent num_sectors = NULL
          extent target_type = NULL
          extent target_data = NULL
          extent target_source = NULL
            Skipping dump.
      Press any key to continue . . .

      If you need to mount ext4 partition on Linux you need to mount partition RO or it will not mount!