[Treble][Pie]A full guide on how to install 9.0 GSI on Razer Phone on both A/B

HO-COOH

Member
Jul 20, 2018
35
13
0
I found linuxct's guide (Link: https://forum.xda-developers.com/razer-phone/how-to/treble-install-generic-image-gsi-razer-t3770684) need to be modified to get 9.0 GSI working (at least in my circumstance). I haven't tried any Oreo Gsi but to my case, I can't properly booted to 9.0 Gsi by following exactly to this guide. That's why I want to write my own processes of getting it works. Hope it's useful to some of you.

0) I strongly recommend you to flash back to stock image from razer, if you have messed up with the partitions. !!THIS WIPES YOUR DATA, PLEASE BACKUP THE INTERNAL STORAGE!!
Code:
 (Link: https://s3.amazonaws.com/cheryl-factory-images/cheryl-o-global-6033.zip)
After flashing to stock, it should automatically reboot into the system.
/*To your convenience, please put all the required file under the adb tool folder*/

1) Enable USB debugging, reboot to bootloader by command:
Code:
adb reboot bootloader
2) Flash the prebuild boot image in linuxct's guide by command:
Code:
fastboot flash boot_a boot_linuxct_20180420_cheryl_omr0.img
(Link is mentioned above)
This boot image has TWRP and Magisk built in.
3) Reboot into TWRP by command:
Code:
fastboot reboot
4) In TWRP, tap Wipe and do a factory wipe. DON'T CHANGE THE DEFAULT WIPE SETTINGS.
5) Flash the GSI you have, then reboot to bootloader.
6) Extract and copy the stock boot image from Razer to the adb tool folder, and flash the boot.img by command:
Code:
fastboot flash boot_a boot.img
7) Reboot to the stock recovery, and do factory wipe, then reboot to bootloader.
This will decrypt the /data. (I am not sure why if I do it under TWRP, I can never boot into system, but that's the case.)
8) Flash the prebuilt image from linuxct again by command:
Code:
fastboot flash boot_a boot_linuxct_20180420_cheryl_omr0.img
9) Reboot to the system by command:
Code:
fastboot reboot
And whola, you should be able to boot into system without any decryption message. And you will have a partially functional TWRP.
If you need to flash any other GSI next time, you should first copy the GSI image through MTP in system. Because the TWRP doesn't support adb command and can't be mounted as MTP.
Once you have copied the GSI image, you can reboot into TWRP and flash image as usual.
 
Last edited:

HO-COOH

Member
Jul 20, 2018
35
13
0
Can't image I figured out to flash the second system_b so quickly lol.

0) In system_a, reboot to bootloader by command: adb reboot bootloader
1) Flash the GSI you have to system_b: fastboot flash system_b [The GSI you have]
2) Flash the stock boot image to boot_b: fastboot flash boot_b boot.img
3) Set active partition to B: fastboot --set-active=b
This is where I found linuxct's guide tricky because it should be 'b'.
'_b' doesn't work.
4) Reboot to stock recovery: fastboot reboot
5) Do a factory wipe, then go back to bootloader
6) Flash the prebuilt image to boot_b: fastboot flash boot_b boot_linuxct_20180420_cheryl_omr0.img
7) Reboot to the recovery: fastboot reboot
And it will brings you to TWRP on B partition, and you can reboot to system_b now.

And whola, and now you can have both AB system with different GSI. And you can switch to any partition by going to TWRP on either partition and switch as you like!
Here are the photos proving I have Pixel Experience and Pixel Dust working seperately on two partitions.

 
Last edited:

HO-COOH

Member
Jul 20, 2018
35
13
0
I also found that the prebuilt boot image from linuxct is breaking the wifi. Till now, you should have the TWRP patched boot image on both AB partition. So fixing that is pretty straightfoward.
1) Copy the stock boot image and TWRP installer zip to your phone in system.
Link: https://dl.twrp.me/cheryl/
I used the 3.2.1 version.
2) Boot into TWRP by command: adb reboot recovery
3) Flash stock boot.img on both A/B partition.
You can do this by first flash it to Slot A, and switch to B in TWRP. NO NEED TO REBOOT, SIMPLY SWITCH SLOT IN TWRP!!
4) Flash the twrp zip file.
This should fix your wifi.

DON'T FLASH MAGISK! I found flashing even the latest magisk v18.0 breaks wifi again.
 
Last edited:

tay200k

Senior Member
Jan 13, 2009
312
24
0
Magisk still breaking WiFi and 4g? I played around with 9.0 gsi's ages ago and that was the only thing stopping me from using it. Have anyone tried the latest canary builds of magisk also?
 

parky169

Senior Member
Jan 8, 2011
121
14
38
Leeds
It worked for me following the guide unfortunately had to go back to stock (no WiFi) shame was looking good too thanks for the guide though helped at least getting system up and booting
 

parky169

Senior Member
Jan 8, 2011
121
14
38
Leeds
Apologies for not clearing one thing up,I installed android 8.1 and it all
Worked I didn't realize at first it was android 9 that was having WiFi breaking,I haven't tried that one yet.sorry if I was misleading anyone
With my post.
 

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,072
5,927
203
Sheffield
I also found that the prebuilt boot image from linuxct is breaking the wifi.
Using an MR0 image on MR3 is not recommended, and using Magisk will break RIL (data connectivity) and WiFi.
If you want to run Pie GSIs, forget about using Magisk and run phh-su. Lastly, if you want your front camera and Bluetooth A2DP to work, use latest phh-gsi image v109. Using older versions than v108 is discouraged for breaking the mentioned.

Current status:
1. Cheryl specific overlays are not yet merged into phh source code because I'm a lazy assh*le. If you want your device to have Adaptive brightness, gestures, and fix the strong vibration, place the following apk inside /system/overlay or /vendor/overylay

2. Razer Power Service and NFC are faulty and will spam your logcat, which may, in the end, reduce your battery life. You need to extract [email protected] from both /system/lib and /system/lib64 from Razer's stock ROM and place them respectively into /vendor/lib and lib64. I've conveniently extracted them for you (Folder named 32's file should be extracted onto /vendor/lib and folder named 64's file should be extracted onto /vendor/lib64).
To kill NFC until we find a proper solution, go into your GSI's filesystem path /system/app/NfcNci and delete or change NfcNci.apk's filename into anything else, like NfcNci.bak.

3. Common to MSM8998, and I believe several other Qcomm based smartphones, Bluetooth In-Call audio is not working, and audio gets redirected to Earpiece.

4. Everything. Else. Works. :)

Please thank @phhusson for his amazing job in this project!

---------- Post added at 09:16 ---------- Previous post was at 09:13 ----------

As an extra, if you would like to erase your data/userdata partition without messing up with recoveries, you could just issue the following fastboot command:
Code:
fastboot format:ext4:0xc72dd3000 userdata
Where 0xc72dd3000 is the userdata partition size with FBE enabled.
If you are running a bootimage without FBE, the partition size might be 0xC72DD7000, so the command would be:
Code:
fastboot format:ext4:0xC72DD7000 userdata

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

As a result, a summary of OP would be:
0. Flash latest cheryl fastboot image just like explained in OP.
1. Download the Android 9.0 GSI of your preference.
2. Reboot into fastboot.
3. Wipe your userdata partition with:
Code:
fastboot format:ext4:0xc72dd3000 userdata
4. Flash the system image you downloaded with:
Code:
fastboot flash system IMAGENAME.img
Where IMAGENAME goes your system image name. In our bootloader, you don't need to specify the partition you want to flash, and fastboot flashing into just "system" will flash the current slot.
5. Follow the steps from 1 and 2 from the Current status section above to get all the perks to work.
 
Last edited:
  • Like
Reactions: HO-COOH

sinkoo1979

Senior Member
Oct 29, 2016
541
78
28
Yigo
Tried multiple android 9 GSI roms and some boots but no wifi and data (some don't even boot).
Wifi fix (works on Arrow OS) on post #4 doesn't work. After flashing twrp 3.2.1.0, the phone does not boot on any android 9 GSI roms. Anyway thanks for your work trying to make GSI work on Razer phone.
 
Last edited: