How to flash GSIs on the Red Magic 5G/How to build super.img from other imgs

Sewex

New member
May 17, 2020
2
1
0
I have an issue.
Your device is corrupt. It cant be trusted and will not boot.
I tried to flash vbmeta, vbmeta_system, super.
But it was not enough to make my device work again.
I did not get the first part.

Part 1: Building the super image
Download tools.7z and extract it
Place the GSI image in the same folder and rename it to system.img
Execute the lpmake.sh script in a linux environment (It will say invalid headers at magic, it's not an error so just ignore it)
When it is complete there will be a super.img file in the folder (takes about 1 min)
I started from the second.

What is GSI?
 

apersomany

Member
Apr 18, 2019
26
14
0
I have an issue.
Your device is corrupt. It cant be trusted and will not boot.
I tried to flash vbmeta, vbmeta_system, super.
But it was not enough to make my device work again.
I did not get the first part.

Part 1: Building the super image
Download tools.7z and extract it
Place the GSI image in the same folder and rename it to system.img
Execute the lpmake.sh script in a linux environment (It will say invalid headers at magic, it's not an error so just ignore it)
When it is complete there will be a super.img file in the folder (takes about 1 min)
I started from the second.


What is GSI?
Well if you don't know what a GSI is, you should not be doing this.

That happens if you modify your device without unlocking the bootloader/you lock your bootloader after modifying.
To fix your problem you need to unlock you're bootloader

fastboot flashing unlock
 

Sewex

New member
May 17, 2020
2
1
0
Well if you don't know what a GSI is, you should not be doing this.

That happens if you modify your device without unlocking the bootloader/you lock your bootloader after modifying.
To fix your problem you need to unlock you're bootloader

fastboot flashing unlock
I did unlock the bootloader but my phone issue is
(Your device is corrupt. It can't be trusted and will not boot)
I tried to flash the super img and flashing goes correct but when i boot my device same note appears.
 
  • Like
Reactions: apersomany

apersomany

Member
Apr 18, 2019
26
14
0
I did unlock the bootloader but my phone issue is
(Your device is corrupt. It can't be trusted and will not boot)
I tried to flash the super img and flashing goes correct but when i boot my device same note appears.
You have to unlock with fastboot flashing unlock
NOT fastboot oem nubia_unlock NUBIA_NX659J
They are different commands
 

MR01

Member
May 22, 2012
13
4
0
Nubia's bootloader and fastbootd is **** and both can't flash images to the logical partitions like the system partition and vendor partition.
So we need to build an image for the super partition to be flashed.

If you just wanted to flash a custom rom skip part 1 and download the super.img from the link (los or havoc, havoc recommended as los's brightness control is half broken)

Requirements: An unlocked RM5G booted into the bootloader (not fastbootd, if you don't know what that is, you probably are in bootloader), An A/B GSI image (yes we need a A/B image not an A-only image, from android 9 released devices all phones are systeam as root), A linux environment (I did it in WSL), the download file

BACKUP YOU'RE SUPER PARTITION BEFORE FLASHING AND SAVE IT SOMEWHERE SAFE BEFORE FLASHING
(Seriously, tho I figured this out while trying to unbrick my phone after ****ing up my super partition. Trust me, it will be a life saver. Doing this will also break flashing stock ota rom via recovery until you flash your backup)

Part 1: Building the super image
Download tools.7z and extract it
Place the GSI image in the same folder and rename it to system.img
Execute the lpmake.sh script in a linux environment (It will say invalid headers at magic, it's not an error so just ignore it)
When it is complete there will be a super.img file in the folder (takes about 1 min)

Part 2: Flashing the super image
Before we flash the super.img we have to disable verity.
flash vbmeta and vbmeta_system with
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
(You don't have to flash these every time. Just once)
Now we can flash the super.img with
fastboot flash super super.img
You also have to wipe dalvik, cache, data
If you have twrp do it in twrp.
If you don't, you shouldn't be doing this, I told you to backup your super partition.

That's it.

Tested GSIs:
LOS 17.X : Boots, Wifi/Data/BT works, Brightness control is half broken (always at full brightness)
Android 11 DP3 : Doesn't boot
Havoc 3.4 : Boots, 3.5 doesn't work
Phh-Quack : Doesn't boot
Descendant X : Boots, same as LOS

Oh, and for people wondering about the fingerprint sensor. It doesn't work. The phone doesn't even know it has it under the display(Maybe a problem with all under display fingerprint sensor phones).

After more testing, found out slot count can be 1 instead of 2.
Can you please re-upload the files? Thanks
 

apersomany

Member
Apr 18, 2019
26
14
0
System Swapper / Generate flashable zips from system.img

This tool generate's flashable zips from system.img to flash GSIs.

Extract the file and place your system.img in that directory(It has to be named system.img)
Then run makezip.bat.
A file called system.zip will be created.
Flash the file in twrp.
 

Attachments

Last edited by a moderator:

MR01

Member
May 22, 2012
13
4
0
This tool generate's flashable zips from system.img to flash GSIs.

Extract the file and place your system.img in that directory(It has to be named system.img)
Then run makezip.bat.
A file called system.zip will be created.
Flash the file in twrp.
Thanks a lot
 

sky104hk

Senior Member
Jan 4, 2011
267
43
58
Hong Kong
I have a question which is a bit off-topic...
Just wonder any of u guy start building a flashiable zip for Twrp, if in the future GSI rom or specify rom with full function work for our RM5G will appreciated; Im also an Oneplus user too and just brought this wonderful phone, hope u guys can build a solid rom tks! ?

BTW, Im a noob in VOLTE, is there any method to test it at all? Im on stock global rom and not sure the VOLTE is working or not, sorry for the bad English Im Chinese:laugh:
 

redymedan

Senior Member
Dec 10, 2016
308
169
53
Hi @apersomany, I have sucess built flashable GSI image with systemswapper.zip but failed when install it in TWRP with error "Updater process ended with ERROR: 7", and "Failed to mount 'system_root' ( No such file or directory. Tested on Samsung Galaxy A51. I will donate $20 if you don't mind.. Is it impossible to use it for Samsung Galaxy device?? I am sure you can do that.. help pls. thank you, I am ready to be tester, telegram @redymedan
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone