yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] Pachacouti:
Sure... I'm on an Ulefone Armor x5 Pro mt6765/6762, Android 10_Q stock. NOT PIE, arrm64-v8a A-only system-as-root

Firmware is after sales, I broke into this fn using a note9 recovery... This forced me to look for an engineer bootloader, and guess what? the boot-debug.img found in most ulefone firmware comes rooted! there never was reason to root! Magisk WI|LL kill this, but it's really the other way round... to keep stock, you CANT use magisk.

Just flash boot-debug to boot, stock vbmeta etc, check size of bootloader, mine is 32mb.

System_As_Root means no root required, it's just understanding variant=eng is a no go since android 10, but the note9 (origionally android 9) uses same mt so same commands for me in android 10 got me in to discover the boot-debug IS android 10 root, but need the user-debug to have FULL root, which no longer works, because the user-debug img's wont let fone on network until removed from fone, so I've heard...

Could really do wiith this having supersu or busybox added instead of magisk, but then, is it actually needed? no offence magisk, but after finding this, I can honestly say... I Killed magisk like magisk kills su...

Ps, I'll prove it, with an overdue reflash only this time instead of systemrw1.32, I'll try your script, wont settle until I see the system adapt to space changes. But take my word for it, do whatever on a fone with NO magisk, if we can add su to this, it would be true root designed for each and every fone!!

Read:

https://xdaforums.com/t/hahahack-dis-no-magisk-required.4337361/post-85685533

Ps, if you could make your script adapt to space change's, I'm up for testing an updated for 10-11-12 script that can adapt to system changes made by you using the boot-debug... thanks...

Ps, to all other testers, you need stock for this to work.

Stock = NO magisk.
[Miscellaneous Android Development] munjeni:
Man you are in wrong thread! This tool inside this thread is related to superparition! Your phone do not have superpartition. And thats nothing new having root on eng builds
[Miscellaneous Android Development] Pachacouti:
I'm not in wrong thread, I posted to you after the op of systemrw1.32 sent me here, then you ask for a debug, while I'm still looking to keep my system partition read write without magisk... I figure since the guy who sent me here says you know your stuff, that I should at least show you why certain things are failing.

You see, using magisk, you are writing to an overlaid filesystem, so people actually write to the overlaid filesystem when using magisk, irelevant of wether who-ever's script grants access to the actual system partition or not.

If you check my thread, YOU are wrong. I know MY fone.

By meddling with vbmeta (ie, blank them) MAGISK FORCES writing to overlaid filesystem, which, like windows 98se, wont write to actual ro partition until a reboot...

So is John Wu correct or not? Can we write to an ro system?

Sure... using your script, or someone else's.. who's is a remix of your's. I'm NOT in the wrong thread, and thank you for failing to mention to all that we dont need this script when using boot-debug.img.

I guess your magisk'd...

;)

Soz for mentioning what you clearly never knew before you asked...

Cant believe you think I have no super partition after me stating what fone I have... says it all really..

Clearly in wrong thread... my apologies...
[Miscellaneous Android Development] munjeni:
I still not understand what you need. Its well known having root by enabling adb root inside ramdisk. Also if you have recovery you have root that way too. Magisk is diferent story, its used for systemless things not just for root. Question is what you want to do?
[Miscellaneous Android Development] Pachacouti:
I have found away to resize partitions to use 100% of space freed up if we say delete other partitions on the fly, within the super, the op of system_1.32 used your work, which I only found after he pointed me in your direction, me, I could do with the three partitions doing this, as welll as the super itself..?

It's a race now tho lol ;)

I think your version would work better being for my fone, being an arm64 -v8a, because mine seems to be quite picky because I want to do my fone without magisk, and this helps with the rw... your about to get busy lol, others will be after this shortly ...

And just for the record, so many people read about magisk before discovering that since Pie, Android/google is killing root apps by GIVING us root OVER our overlaid filesystems, this is already obvious when recovery.img does not give root access, but boot-debug.img GIVES root as opposed to earlier 'recoveries' that did pretty much everything to force us to use root apps... Not one person posted this fact when I went on about variant=eng being removed from android since android 10, provable by both boot, and boot-debug both showing variant =user when opened in hex... and googles confirmation that variant=eng are being removed perm. Identical files that are NOT identical... if anyone here knew before I found it, it would have been written of by now...

I'm just happy discovering I never needed root, we need a thread on this alone...
[Miscellaneous Android Development] hendrysetiadi:
hi, munjeni...

i want to try your tools on my amlogic s905x2 box running android 10 stock firmware (not rooted). if using systemrw script from lebigmac, i'm afraid there's not enough space on the device itself while it's using only 8gb rom & 2gb ram.

can u comment what i must do on step by step is correct or not?

1. unlock bootloader?

2. install magisk?

3. patch boot.img and install it?

4. run your tools?

or without installing magisk, can just running your tools?

and can u help me how i replace stock recovery to twrp? any guide on this?
[Miscellaneous Android Development] Pachacouti:
I'll say this once and never mention it again.. change from ef2whatever to parted, then have option to free up empty space size=auto or size=100%

I only tell you because I need it too.. get to it...
[Miscellaneous Android Development] lookeye:
good
[Miscellaneous Android Development] munjeni:
I can sugest you ask somebody with the same device, I don't know what you need to do. And instead of our tool do it with systemrw script from lebigmac
[Miscellaneous Android Development] munjeni:
I can solve thing easy if somebody give me this -> https://xdaforums.com/t/tool-win-li...s-rw-in-super-partition.4120963/post-85320641
[Miscellaneous Android Development] tids2k:
Hello @munjeni i thank you for the tool. As instructed please find the ls_after and ls_before files. Please note i have sent the links in a PM to you as they contain some sensitive information regarding the device. I had the same result like @Pachacouti , on restart there is a kernel panic which goes into endless bootloops. @lebigmac has been trying to help as well with the script but it appears that I have the same error, issue ( bootloops ) as when running his script. So in short it appears that the script works properly, the issue could be related to a permissive or enforcing nature of the kernel or the verity issue. Hopefully once you look at the logs, more light could be shed.

My device is a Google Pixel 6 Pro and on Android 12 with dynamic partitions.
[Miscellaneous Android Development] munjeni:
Hello, can you send me ls after and ls before logs?
[Miscellaneous Android Development] Anhlatuananh:
is this work on android 12 ? i just a new guy (google pixel 4xl)
[Miscellaneous Android Development] xiaodeng:
this tool is very good,thanks
[Miscellaneous Android Development] d1m-ON:
Working great! Thanks so mush! You are awesome(y)

Lenovo tablet, ZUI 12.6, Android 11.
[Miscellaneous Android Development] blaze2051:
wow great tool, working on LG v60 Tmobile A10, everytime i flash my super it takes ages now i can just flash system. thank you
[Miscellaneous Android Development] Md652:
Now I see that superunpack worked fine for me to download the blocks_shared and it went downbut I still do not have r / w and when I run mount this is the result "

KINGKONG_MINI2:/ # busybox mount -o remount,rw /system

mount: can't find /system in /proc/mounts"

can someone help me urgently
[Miscellaneous Android Development] Paladinen:
Hello. Could you please tell me if this tool will work on Realme 8, Android 11? Thanks
[Miscellaneous Android Development] vp1117:
me@LMINT:~/Downloads$ adb push superrepack.arm64_pie /data/local/tmp

superrepack.arm64_pie: 1 file pushed. 15.0 MB/s (1821472 bytes in 0.116s)

me@LMINT:~/Downloads$ adb shell

RMX3195:/ $ su

RMX3195:/ # cd /data/local/tmp

RMX3195:/data/local/tmp # mv superrepack.arm64_pie superrepack

RMX3195:/data/local/tmp # chmod 755 superrepack

RMX3195:/data/local/tmp # stop

RMX3195:/data/local/tmp # ./superrepack /dev/block/bootdevice/by-name/super

---------------------------------------------------------

Super image repacker v_15 by munjeni @ xda 2021)

---------------------------------------------------------

We going to set selinux to permissive mode!

Error setting selinux to permissive mode!

Invalid argument
[Miscellaneous Android Development] muhammadbahaa2001:
Does this work on any Android version? Does this requires root? If I got errors would this damage the OS? I didn't try it yet, I am just asking to know about this project, I want to try it.
[Miscellaneous Android Development] Viva La Android R.I.P.:
Hats off to you @munjeni for this incredible piece of development. This is a must for anybody who develops or simply likes modding Android devices that use the dynamic partitioning scheme. I have two projects underway on tablets running Allwinner-A100/133; this tool has been a blessing with repackaging Livesuit/PhoenixSuit compatible firmware images. I use a combination of three utilities for the job and yours is a must on super.img extracting and repacking.

Thank you OP for this amazing tool.
[Miscellaneous Android Development] munjeni:
Sorry I don't have free time and device to fully finish this tool, just to let you know what problem this tool have, in short problem is e2fsck, so when e2fsck repair partition some files is deleted and that cause bootloop, thats a only problem in this tool! Found it while compared files before and after operation. My hope somebody figure this out.
[Miscellaneous Android Development] muhammadbahaa2001:
I want to try this tool to make system partitions rw but I have a question does this tool work for any Android version? I want to try it on Android 7.0.

If the opreation failed would this cuse damage to the Android system?
[Miscellaneous Android Development] alecxs:
which android 7 comes with ext4-dedup dynamic partitions?
[Miscellaneous Android Development] muhammadbahaa2001:
No it's just comes with ext4 no dynamic partiton, sorry i am noob and want to know if this method for only for Android 10+ or for any Android (I know Android 10+ comes with dynamic partions).
[Miscellaneous Android Development] alecxs:
so you are reading the wrong section
[Miscellaneous Android Development] devasure:
This post seems to be intented for experts,not for noobs like me.

It would be very much appreciated if the tutorial was made clearer.

Like..Should the device be connected in bootloader etc.

Thanks in advance...please help
[Miscellaneous Android Development] devasure:
Could you please explain as simply as possible how to do this on phone ?My device is redmi 9i sports.

Thanks in advance
[Miscellaneous Android Development] HemanthJabalpuri:
That's old message, it seems like worked but in real some files are silently removed when we remove a file. So new version of tool is released and I failed to get it working.
[Miscellaneous Android Development] alecxs:
Could you please read post #1 and tell us on what step you are struggling?
[Miscellaneous Android Development] devasure:
What I mean is a tutorial for noobs.My device is redmi 9i sports (downgtaded to android 10),rooted and twrp installed but no access to write to system.

This turorial seems to be of help but I dont know where to start
[Miscellaneous Android Development] Pervokur:
repack isn't working for me(vivo y31, "virtual_ab" peace of ****), that's should be a reason

Super partition layout:

super: 2048 .. 2464: system (416 sectors)

super: 2464 .. 2672: oem (208 sectors)

super: 2672 .. 2880: vgc (208 sectors)

super: 2880 .. 3643696: system (3640816 sectors)

super: 3643696 .. 3643904: vendor (208 sectors)

super: 3643904 .. 3974072: system (330168 sectors)

super: 3974080 .. 6117560: vendor (2143480 sectors)

super: 6117568 .. 6127216: oem (9648 sectors)

super: 6127216 .. 6127688: vgc (472 sectors)

super: 6910064 .. 6912320: oem (2256 sectors)

script

/data/local/tmp/losetup --offset=1368064 --sizelimit=106496 /dev/block/loop0 /dev/block/by-name/super

/data/local/tmp/resize2fs /dev/block/loop0 26

log

The filesystem size (according to the superblock) is 64 blocks

The physical size of the device is 26 blocks

Either the superblock or the partition table is likely to be corrupt!

Abort? yes

solved with another tool, now no virtual_ab, no shared blocks in system!

super: 2048 .. 5071392: system (5069344 sectors)

super: 5072896 .. 7376656: vendor (2303760 sectors)

super: 7376896 .. 7389008: oem (12112 sectors)

super: 7389184 .. 7389864: vgc (680 sectors)
[Miscellaneous Android Development] TheGhost1951:
Superrepack is working only under android, with that being stated, I take it that it does not work for OnePlus 9 Pro OxygenOS. Correct?
[Miscellaneous Android Development] TheGhost1951:
noob to oneplus, but what is the by-name in the cammand line ./superrepack /dev/block/bootdevice/by-name/super system_a
[Miscellaneous Android Development] RETIEF:
I just installed the latest update from Motorola on the Kiev. The tool no longer gives r/w access.
[Miscellaneous Android Development] Pervokur:
"by-name" is a directory which contains humans friendly names of partitions
[Miscellaneous Android Development] starbucks2010:
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.
[Miscellaneous Android Development] Atlas11010:
what do you mean by_name whhaa do I type in my device name?
[Miscellaneous Android Development] Atlas11010:
were do I get the super.sin file
[Miscellaneous Android Development] munjeni:
I'm believing samsung have it encrypted so you will need to decrypt first! For further questions see picture
[Miscellaneous Android Development] munjeni:
Seems you didn't read, see post 364 its just two posts above your question ! :)
[Miscellaneous Android Development] starbucks2010:
If this answer was intended for my post #365 then the answer is no, the image is not encrypted.
[Miscellaneous Android Development] munjeni:
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!
[Miscellaneous Android Development] starbucks2010:
@munjeni here's the photo. Thank you.
[Miscellaneous Android Development] alecxs:
how about simg2img
[Miscellaneous Android Development] munjeni:
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
[Miscellaneous Android Development] starbucks2010:
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.
[Miscellaneous Android Development] munjeni:
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.
[Miscellaneous Android Development] alecxs:
despites does not prevent you from going long way and use official tools lpunpack/lpmake
[Miscellaneous Android Development] starbucks2010:
Is there any tool that can read the features list used to create the stock f2fs .img file?
[Miscellaneous Android Development] starbucks2010:
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
[Miscellaneous Android Development] munjeni:
https://github.com/munjeni/super_image_dumper/blob/master/superrepack.cpp#L276
[Miscellaneous Android Development] PTechz:
Please help me, I got these 3 files.

1. system.ext4

2. product.ext4

3. vendor.ext4

I used this tool in Linux. Now, what to do with these three files. Please help me.
[Miscellaneous Android Development] munjeni:
Better question, whats your plan? You can use them for example to extract some library, some apps... etc. You can mount them now like this:

mkdir rr

mount -t ext4 -o,ro system.ext4 rr
[Miscellaneous Android Development] PTechz:
---------------------

Bro, how can I convert these three files into one (super.bin) file. I want to flash this file via fastboot. Please help me.

Yeah, I edited these files, removed some apps. But, don't know how to convert these three files into one (super.bin) file. Please help me, have a good day bro.

:)
[Miscellaneous Android Development] munjeni:
Take a look here https://xdaforums.com/t/script-andr...-superrw-featuring-makerw-read-write.4247311/ , those script doing the same but also convert it back to super image
[Miscellaneous Android Development] munjeni:
Also read post 376 if you have modified those partitions you have definitelly removed ton of files referenced to that what you have deleted!
[Miscellaneous Android Development] starbucks2010:
https://github.com/munjeni/super_image_dumper/blob/master/superrepack.cpp#L276

But what should I use instead the %s (losetup --offset=%s --sizelimit=%s %s %s) ?
[Miscellaneous Android Development] munjeni:
You no need losetup, that tool is used for mount partitions on the fly without extracting them. In your case you have partitions extracted allready, so skip losetup and try the rest of commands. And sorry I do not have free time for this, further questions I will probably ignore sorry. Thats a very easy and basic tool and everybody who have at least basic linux skills and C skills is able to understand whats going on, I can't help and don't have free time for this thread, in short explanation:

You got output for example like this:

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 ...

To convert this to losetup %s would be:

extent target_data x 512 = 0x800 x 512 = 0x100000

extent num_sectors x 512 = 0x336390 x 512 = 0x66c72000

losetup --offset=0x100000 --sizelimit=0x66c72000 super.img /dev/loop0
mkdir system_a
mount /dev/loop0 system_a
.... etc... etc

Free space = 0x66c72000 - 0x6526c000 = 0x1A06000

Resize your partition to 0x66c72000 because e2fsck unshare blocks feature reguire increased partition size because clone blocks is performed while unsharing blocks. Unsharing blocks is reguired to convert from dynamic partition to normal partition. so some extra free space is needed for that, but not to exceed maximum partition size in our case extent num_sectors x 512 . In short this is explanation how my tool work. My choice for using losetup is because I no need to extract partition, instead I have virtualy mounted every each partition on the fly trought offset and size calculation, in that case we know where is start and end of the every each partition. For further understanding how I have done all that things on the fly take a look at source code of my tool to understand it better, there is everything you need to know! Hope this help!
[Miscellaneous Android Development] Pervokur:
Thx for losetup! My recovery can't mount logical partitions (/system, /vendor etc).

But this method works from recovery.

lpdump:

Super partition layout:

------------------------

super: 2048 .. 4712448: system (4710400 sectors)

super: 5072896 .. 7376656: vendor (2303760 sectors)

super: 7376896 .. 7389008: oem (12112 sectors)

super: 7389184 .. 7389864: vgc (680 sectors)

offset = first number in string * 512

2048 * 512 = 1048576

sizelimit = size in sectors * 512

4710400 * 512 = 2411724800

----------

mkdir mysystem

setenforce 0

/data/local/tmp/losetup --offset=1048576 --sizelimit=2411724800 /dev/block/loop0 /dev/block/by-name/super

mount -t ext4 /dev/block/loop0 mysystem
[Miscellaneous Android Development] munjeni:
Yes thats it! Notice that how losetup is an powerfull tool! Android losetup do not have those two parameters and who have plan to use losetup must compile an true linux losetup from source code. I have booth precompiled https://github.com/munjeni/super_image_dumper/tree/master/include . When I decide t buy next phone it will be probably inevitably with included dynamic partition table, and I will than definitelly complete our tool to fully working one click solution. E2fsck need to be modified to get it work with low free space, that will prevent partition repair coruption because of lack of free space for clone block while unsharing blocks, and that's all that needs to be applied to make this tool work properly! If someone already had an idea how to do this, I would be happy to implement it in my tool!

Edit:

This need to be tried https://patchwork.ozlabs.org/project/linux-ext4/patch/20190614114530.5663-1-dongyangli@ddn.com/

Some discusion https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=956509 , https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2333701.html
[Miscellaneous Android Development] munjeni:
I'm applied patch above and it seems no files is deleted! :)

/media/hdd/sony/rom/e2fsck/sbin/e2fsck -y -E unshare_blocks -E clone=zero -E shared=preserve ./system_a.ext4

Even it worked without resizing partition :)

Edit:

I will try compare files before unshare blocks and after unshare blocks, using git tool and let you know.