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

apersomany

Member
Apr 18, 2019
26
14
0
I made a better way to flash GSIs
https://forum.xda-developers.com/nubia-red-magic-5g/development/swapper-generate-flashable-zips-img-t4133591
Go here and use that.

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.
 
Last edited:

nadejo

Senior Member
Jun 28, 2010
2,419
1,273
193
keep it up. the fingerprint sensor is a goodix sensor it was the problem on other devices too. we will need to ask nubia for the goodix sources to fix it.
is the fan, gaming triggers and 144hz working? also what about the slider any functionality?
 

apersomany

Member
Apr 18, 2019
26
14
0
Wow amazing, so we can use any other gsi except the one forced by these guys

Sent from my NX659J using Tapatalk

---------- Post added at 09:55 AM ---------- Previous post was at 09:53 AM ----------

Also does everything work like the air triggers and the fan ect

Sent from my NX659J using Tapatalk
Sadly air triggers, fans, 144hz, slider doesn't work (Maybe it'll work if we port the app to the rom)
For the fingerprint sensor I'm gonna try some things.
 
Last edited:
  • Like
Reactions: cavjr08

VZTech

Senior Member
Dec 31, 2019
420
53
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, though the treble info app says that our device is A-only, it's not), 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 all works, Brightness control is half broken (always at full brightness)
Android 11 DP3 : Doesn't boot
Havoc 3.4 : Boots, So far everything works, Probably will stay on this

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).
So you got your phone working again! Nice Is volte calls working on havoc?

And it looks like you uploaded the converted gsi images? Thanks

NO WIFI for me on havoc
 
Last edited:

apersomany

Member
Apr 18, 2019
26
14
0
So you got your phone working again! Nice Is volte calls working on havoc?

And it looks like you uploaded the converted gsi images? Thanks

NO WIFI for me on havoc
That's probably because you're boot.img is not from the same version as mine (2.46) try flashing the one I uploaded to google drive
 

nadejo

Senior Member
Jun 28, 2010
2,419
1,273
193
there seems to be a workaround to keep Fingerprint functionality while rooting and even with twrp installed. it seems it's even possible to lock the bootloader at the same time. will wait for xda guides to explain as i don't understand it yet. i saw video evidence and it's pretty easy. the guy even forgot oem unlock in dev options and it still worked for him.
only cn rom supported it seems. and it's a similar guide to the redmagic 3.
 

apersomany

Member
Apr 18, 2019
26
14
0
Wondering if we could add the ims.apk to the image??? Its needed for volte. If its done on the os, the phone doesnt boot.
Thanks. I used that ones too. I extracted the system image, added the file, repacked, then used the tool to convert to super, but it wouldnt boot.
Hmm... That's weird.
Have you increased the size of the partition that you've added the file to in the script? (If it was added to the system img probably won't matter as I've set the value to something like 3gigs if I remember correctly)
So doing it without adding the file works, but if you add it it won't boot right?
 

mslezak

Senior Member
Dec 12, 2016
266
248
43
Houston
there seems to be a workaround to keep Fingerprint functionality while rooting and even with twrp installed. it seems it's even possible to lock the bootloader at the same time. will wait for xda guides to explain as i don't understand it yet. i saw video evidence and it's pretty easy. the guy even forgot oem unlock in dev options and it still worked for him.
only cn rom supported it seems. and it's a similar guide to the redmagic 3.
Yes in our forum in Telegram: ZTE Nubia Redmagic 5G Channel people are using the Chinese ROM and bypassing the bootloader unlock. I have not yet tried. We are perfecting the process ATM. We even got a guy to restore a TWRP backup of Global ROM. It isn't an easy process. You have to be very, very careful. There are a lot of wipes that go on in between. Will post once we have a 100% working solution. Under the Bootloader Unlock tutorial in XDA for this device.
 
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