[Android Software/Hacking General [Developers Only]] lebigmac:
This Linux-only version is pretty much deprecated at this point. Please use the BRAND NEW UNIVERSAL VERSION instead! Thank you.

Ladies and gentlemen. Let me present to you my very first release here at the XDA forums:

Welcome to:

makeSystemRW v1.04

automated bash script by lebigmac for Android 10 and above
​

Creation date:

February 2021

Updated:

March 2021

Requirements:

​

LINUX ONLY!

Android 10 or newer

This version only supports devices with super image.

Check if you have super by running ls -Alg /dev/block/by-name

phone must be rooted + bootloader unlocked + 10 GB free space on phone

at least 20 GB free space on computer for dumping data

adb and fastboot commands should be in your $PATH environment variable

I'm not 100% sure if this is a necessary requirement but I also disabled dm-verity and verification on my device just in case by simply booting into TWRP and then executing these 2 commands:

adb disable-verity

adb shell avbctl disable-verification

Description:

A script for all Android power users that wish to make their read-only Android 10+ system read-write-able again to remove bloatware and make more thorough customizations to their device.

In a nutshell this is what the script is doing:

dumps your existing super image to your pc

extracts the embedded read-only partitions (system, vendor, product, etc...)

makes these partitions read-write-able

joins everything back together to new flashable super.img

flashes it to device

User data is not affected.

Usage:

Simply call the script from the shell.

Optional arguments (replace x with your custom value) :

in=x : With this flag you can specify an existing super.img and skip the entire dumping of the super image process. Here you can use the super_original.img which you dumped earlier with makesysrw or the official super.img from your downloaded firmware. You probably have to unsparse the official super.img first using the included simg2img tool for superunpack to recognize it properly. If omitted, makesysrw will dump super image from phone to ./super_original.img

out=x : With this argument you can specify the output path. If omitted, default output value is ./super_fixed.img

size=x : With this parameter you can specify the extra free space (in megabytes) that will be added to each partition. If omitted, default extra size is 0 (shrink to minimum)

Examples:

# Run this command if you're first time user:
# Specify the extra free space in megabytes for each partition:
./makesysrw.sh size=100

# Plug an existing raw super image into the script like this:
./makesysrw.sh in=./super_original_raw.img size=100

# Specify both the input file as well as the output destination:
./makesysrw.sh in=./super_original_raw.img out=./super_fixed.img size=100

# For unsparsing the (sparse) super.img from your phone manufacturer's firmware you can do:
./tools/bin/simg2img ./super_sparse.img ./super_raw.img

NOTE:

I did not come up with all this by myself. After searching for a solution for countless days without success, going even as far as learning hex editing - I coincidentally came across a couple of very interesting threads burried deep inside the new forum interface where this technique has been described and discussed by various enthousiasts (links can be found below in the credits section). So I take absolutely no credit for the underlying core mechanisms of the script. I'm only the amateur who put it all together into a compact script so that everybody can enjoy an Android system that's read-write-able again. Just like it used to be in Android 9 or earlier. Before this annoying 'shared_blocks feature' was implemented.

Credits:

Big thanks to @munjeni for allowing me to use his amazing superunpack tool instead of the default lpunpack. Source code can be found here.

Also big thanks to @Brepro1 without your awesome tutorial guiding me I couldn't have created this script.

Thanks @AndyYan your interesting thread also helped me a lot for automating the script especially the lpdump part.

More thanks @gabrielfrias for his helpful comment

Thanks @YOisuPU and of course @topjohnwu for discovering the 'shared_blocks feature'

Thanks @bynarie for making available his otatools package! A part of it is now bundled with the archive

Disclaimer:

This is open source software and is provided as is without any kind of warranty or support whatsoever. By using and viewing this software you agree to the following terms:

Under no circumstances shall the author be held responsible for any damages or negative consequences that may arrise from the (inappropriate) use of this software.

All responsibility and liability lies with the end-user. You hereby agree not to abuse this software for illegal purposes. Use this software at your own risk!

Please feel free to improve this script as you see fit (as long as you don't add anything malicious)

and make sure to post your feedback, suggestions and improvements in the official thread right here.

View attachment 5235937

View attachment 5235935

View attachment 5235941

View attachment 5235933

View attachment 5235931

Mod Edit: Download link removed

Please click my like button below if you like it! Thanks​