[TREBLE][Oreo][How-To] Install any Generic System Image (GSI) on the Razer Phone

Search This thread

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
Hello everyone,

I've been tinkering around with Generic System Images since the Oreo Developer Preview 1 came out for the Razer Phone. I'm glad to say I got it to work, with lots of help from @MishaalRahman, @P4Block and indirect help of @phhusson and @TheCrazyLex.

What's working as of right now:
- GPS
- Rear Camera (only one of the lenses, needs further testing/pulling the Razer camera app apk)
- Front camera
- Microphones
- Sensors, each and every of them
- Speakers, sound playback, videoplayback (needs further testing)
- Fingerprint scanner
- WiFi, Bluetooth, NFC
- 120Hz screen features
- Color adjustments from the Oreo DP1 by Razer
- 4G LTE
- In-Call audio

What needs further testing:
- 4G/LTE FIXED check out post #77!
- Once the above is confirmed to work => VoLTE on any carrier, and also testing on certain carriers like 3 UK (since they sold a version with different software).

What's broken:
- Audio in phone calls (works properly in VoIP/3rd party apps) FIXED check out post #48!

What ROMs can be booted with this (as of 30-03-2018):

Setting up your device:
You'll need:
Code:
To [URL="https://forum.xda-developers.com/razer-phone/how-to/guide-to-unlocking-bootloader-t3706462"]fully unlock your bootloader[/URL] and [URL="https://forum.xda-developers.com/showpost.php?p=74607352&postcount=8"]unlock flashing capabilities[/URL] on your device. 
[URL="https://eu.dl.twrp.me/cheryl/twrp-3.2.1-0-cheryl.img.html"]TWRP image[/URL] + [URL="https://eu.dl.twrp.me/cheryl/twrp-installer-3.2.1-0-cheryl.zip.html"]TWRP injector[/URL]
[URL="http://tiny.cc/latestmagisk"]Magisk flashable zip[/URL]
A GSI of your preference from the ones listed [URL="https://forum.xda-developers.com/project-treble/trebleenabled-device-development"]here[/URL]. PS: Use the Gapps+SU one if you choose AOSP ;)

0. Make sure you're running the Android O DP1 from Razer, or any future update to it.
THIS WON'T WORK ON NOUGAT
1. Properly install TWRP on your device: (I'll be using @Dees_Troy's guide with a few modifications to make very sure everything will work as intended)
- fastboot flash the twrp image as explained by him, in your currently active boot partition. PS: After flashing the Android O DP1, it will always be A.
Dees_Troy said:
Once you have adb working, run this command: adb shell getprop ro.boot.slot_suffix

It should say: [ro.boot.slot_suffix]: [_a] Or: [ro.boot.slot_suffix]: [_b]

Make note of whether you are currently using slot A or B. Next power off the device and boot to the bootloader using your USB cable and volume down. You want to switch to the other boot slot. If you are currently on slot A, type this: fastboot --set-active=_b Or on slot B type this: fastboot --set-active=_a

You should see something like this: Setting current slot to 'a'... OKAY [ 0.042s] finished. total time: 0.042s

I found the bootloader on the Razer Phone to be extremely finicky and I had to run the command multiple times until I got it to run successfully. You may have to hold the power button for 15 seconds to force power off the device and then re-enter fastboot mode. Keep trying until it works. Once it's on the right boot slot, type this: fastboot flash boot twrp-3.2.1-0-cheryl.img && fastboot reboot
2. Once you're in TWRP, DO NOT SLIDE to allow modifications, but tap on Mount as Read Only. Plug in your USB cable, and adb push the boot image from the Android O DP1 factory image to your sdcard, as well as the TWRP injector and the Magisk zip. That can be done with the following commands:
Code:
adb push twrp-installer-3.2.1-0-cheryl.zip /sdcard
Code:
adb push path/to/the/factoryimage/boot.img /sdcard
Code:
adb push Magisk-16.0.zip /sdcard
3. Go into Reboot, then make sure you're on partition A. Else, tap on the button to set A as the active partition.
Now go back, tap Install, then tap on 'Install Image' then choose the boot.img you just pushed, and flash it as boot image.
Now go back, into Reboot, and move to partition B and repeat the step above.
Once you're sure both partitions only contain the unmodified boot images, set the partition A as active, go into Install, choose the twrp-installer-3.2.1-0-cheryl.zip and flash it.
Once it finishes, do the same with the Magisk zip file.
4. Go into Reboot, press on Bootloader.
5. Connect the usb cable, and flash the GSI system image onto your system_a partition through fastboot from your pc. This can be done with the command:
Code:
fastboot flash system_a system-arm64-ab.img
5.b If you wish, you can install a different GSI onto your system_b partition, and that can be done with the following commands:
Code:
fastboot set_active b
Code:
fastboot flash system_b system-arm64-ab-gapps-su.img
5.c If you wish to go back to the system_a partition, you can execute:
Code:
fastboot set_active a
6. Reboot and enjoy.
Prebuilt boot image:
If doing the steps from 1-4 seems messy or you don't get it to work properly, I've published the image I made following them with the latest Magisk and TWRP versions available as of April 20th 2018.
You can download it from here. You can then flash it from fastboot by using the commands:
Code:
fastboot flash boot_a boot_linuxct_20180420_cheryl_omr0.img
Code:
fastboot flash boot_b boot_linuxct_20180420_cheryl_omr0.img
SHA-2: 2f0c7348ac906f2f81fa39df7b24b69392783bd2379d5da357777be444c67d97​

Old version (from ODP1 - may experience the bootloader issues):

You can download it from here. You can then flash it from fastboot by using the commands:
Code:
fastboot flash boot_a boot_linuxct_20180330_cheryl_odp1.img
Code:
fastboot flash boot_b boot_linuxct_20180330_cheryl_odp1.img
SHA-2: 8f763162415167b2e919a450654f9a46f69b81f6853013bcabf362dfeb2a115e


Many thanks to everyone that helped me today to get this to work properly!
 
Last edited:

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
Want some screenshots? ;)
 

Attachments

  • Screenshot_20180329-234803.png
    Screenshot_20180329-234803.png
    164.2 KB · Views: 3,268
  • Screenshot_20180329-234837.png
    Screenshot_20180329-234837.png
    152.4 KB · Views: 3,202
  • Screenshot_20180329-234849.png
    Screenshot_20180329-234849.png
    133.2 KB · Views: 3,172
  • Screenshot_20180329-235233.png
    Screenshot_20180329-235233.png
    126.3 KB · Views: 2,932
  • Screenshot_20180330-003423.png
    Screenshot_20180330-003423.png
    76.3 KB · Views: 2,862
  • Screenshot_LineageOS_Settings_20180330-010816.jpg
    Screenshot_LineageOS_Settings_20180330-010816.jpg
    67.7 KB · Views: 2,855
  • Screenshot_Settings_20180330-010443.png
    Screenshot_Settings_20180330-010443.png
    187.5 KB · Views: 2,781
  • Screenshot_Settings_20180330-010701.png
    Screenshot_Settings_20180330-010701.png
    131.5 KB · Views: 2,730

PupPupG

Member
Apr 2, 2016
22
6
Thanks for all the hard work!

I've followed the guide but after flashing the GSI I get stuck at the Android logo and the system never boots?
Any help would be appreciated :)
 

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
Thanks for all the hard work!

I've followed the guide but after flashing the GSI I get stuck at the Android logo and the system never boots?
Any help would be appreciated :)

Did you follow all the steps carefully? Did you make sure you flashed Magisk?
Magisk is needed since it disables DM-Verity, which is what IMO gets the device stuck at first boot.
Oh, and also, sometimes during first boot your device gets encrypted. Mine took a bit extra that time (specifically booting the LineageOS image).

If you can't still get it to work, try with the prebuilt boot image.
 
  • Like
Reactions: RUNNERX

PupPupG

Member
Apr 2, 2016
22
6
Did you follow all the steps carefully? Did you make sure you flashed Magisk?
Magisk is needed since it disables DM-Verity, which is what IMO gets the device stuck at first boot.
Oh, and also, sometimes during first boot your device gets encrypted. Mine took a bit extra that time (specifically booting the LineageOS image).

If you can't still get it to work, try with the prebuilt boot image.

I tried again using all of the info but they closest I've gotten to a boot is the Android logo and then a prompt to decrypt but no matter what I enter I get "Decryption Unsuccessful" and it just brings me back to TWRP :(
 

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
I tried again using all of the info but they closest I've gotten to a boot is the Android logo and then a prompt to decrypt but no matter what I enter I get "Decryption Unsuccessful" and it just brings me back to TWRP :(

Flash the Oreo DP1 image and start over.
 

ThatGuy94

Senior Member
Jan 10, 2014
160
56
Atlanta
Flash the Oreo DP1 image and start over.

From what I can tell, TWRP cannot format the data partition properly which is what causes LOS to appear as encrypted and won't finish booting. I was able to successfully able to get it to boot by flashing the stock boot.img and booting to stock recovery and factory reset that way. After doing that, flash your ROM of choice and Magisk and it should be usable.
 
  • Like
Reactions: el4nimal

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
From what I can tell, TWRP cannot format the data partition properly which is what causes LOS to appear as encrypted and won't finish booting. I was able to successfully able to get it to boot by flashing the stock boot.img and booting to stock recovery and factory reset that way. After doing that, flash your ROM of choice and Magisk and it should be usable.

Flashing the Oreo DP1 image actually flashes an empty, non-encrypted userdata image. That's why I requested to start over.
That can also be another solution, bit messier than starting over but it's good.
 

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
Does anyone have Magisk fully working with this? I still get ctsprofile:false

Aside from this, excellent work!

I do. Try installing the latest beta of Magisk and then, if that didn't solve it, try setting a new Build fingerprint with a tool like MagiskHide Props Config (PS. Just to be sure, set the Google Pixel 2 XL one since that's the only 8.1.0 build fingerprint provided by that tool).
 
  • Like
Reactions: M1cky

el4nimal

Senior Member
Mar 12, 2018
89
17
From what I can tell, TWRP cannot format the data partition properly which is what causes LOS to appear as encrypted and won't finish booting. I was able to successfully able to get it to boot by flashing the stock boot.img and booting to stock recovery and factory reset that way. After doing that, flash your ROM of choice and Magisk and it should be usable.

Could you please tell me how you flash Magisk? After I flash a ROM I'm not able to boot into TWRP to flash Magisk
 

linuxct

Recognized Contributor & Social Contributor
Aug 10, 2012
2,078
6,007
Sheffield
Have no idea where I went wrong but after I had RR up and running I rebooted and It went into download mode.

Yes, it happens sometimes. Let me explain this briefly:

1. This bootloader seems to forget what the active partition was when it was told to reboot the device instead of turning itself off, and I don't know why yet. It happens 1/5 times I press on "Reboot", more or less.
2. You need to re-set the active partition to the one you were using, in my case A, so with a cable and my pc I run
Code:
fastboot set_active a && fastboot reboot
Tired of typing, I made myself a script named razer in my /usr/bin
Code:
#!/bin/zsh

fastboot set_active a && fastboot reboot

So, be careful when rebooting the device if you don't have a close-by PC with fastboot to make it work again, instead, fully turn it off and turn it back on.
 

el4nimal

Senior Member
Mar 12, 2018
89
17
Just fire up a terminal with ADB and type in
Code:
adb reboot recovery
It should be more than enough, no need for root privileges or anything.

I'm trying to boot into LineageOS 15.1 but it keeps saying "Decryption Unsuccessful". I followed your guide step by step, and I also tried the pre-built image you provided.
I started over from Oreo DP1 image many times and I've been getting the same error over and over again.
Then, I noticed that @ThatGuy94 mentioned he was able to get it to boot, by flashing stock boot.img and factory reset it that way, and then install the ROM and Magisk.
But I can't figure out how to install Magisk without installing TWRP, is there any fastboot command to install Magisk from the command line?
 

ThatGuy94

Senior Member
Jan 10, 2014
160
56
Atlanta
I'm trying to boot into LineageOS 15.1 but it keeps saying "Decryption Unsuccessful". I followed your guide step by step, and I also tried the pre-built image you provided.
I started over from Oreo DP1 image many times and I've been getting the same error over and over again.
Then, I noticed that @ThatGuy94 mentioned he was able to get it to boot, by flashing stock boot.img and factory reset it that way, and then install the ROM and Magisk.
But I can't figure out how to install Magisk without installing TWRP, is there any fastboot command to install Magisk from the command line?

Unless you have overwritten it, boot to download mode and use fastboot to switch to the other slot which will allow you to boot into TWRP and install Magisk. If you have overwritten TWRP, flash it on the other slot (for example if you have LOS installed in A, flash TWRP into B).
 
  • Like
Reactions: el4nimal

RUNNERX

Senior Member
Feb 1, 2009
321
74
New Orleans
So, be careful when rebooting the device if you don't have a close-by PC with fastboot to make it work again, instead, fully turn it off and turn it back on.
It has happened after a power off also, would putting the same rom in a&b slot stop it? system_other is not bootable so the phone enters download mode? I don't understand the working of the a/b system.
And THANK YOU so much for working on this, so nice to be back on custom roms!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    Hello everyone,

    I've been tinkering around with Generic System Images since the Oreo Developer Preview 1 came out for the Razer Phone. I'm glad to say I got it to work, with lots of help from @MishaalRahman, @P4Block and indirect help of @phhusson and @TheCrazyLex.

    What's working as of right now:
    - GPS
    - Rear Camera (only one of the lenses, needs further testing/pulling the Razer camera app apk)
    - Front camera
    - Microphones
    - Sensors, each and every of them
    - Speakers, sound playback, videoplayback (needs further testing)
    - Fingerprint scanner
    - WiFi, Bluetooth, NFC
    - 120Hz screen features
    - Color adjustments from the Oreo DP1 by Razer
    - 4G LTE
    - In-Call audio

    What needs further testing:
    - 4G/LTE FIXED check out post #77!
    - Once the above is confirmed to work => VoLTE on any carrier, and also testing on certain carriers like 3 UK (since they sold a version with different software).

    What's broken:
    - Audio in phone calls (works properly in VoIP/3rd party apps) FIXED check out post #48!

    What ROMs can be booted with this (as of 30-03-2018):

    Setting up your device:
    You'll need:
    Code:
    To [URL="https://forum.xda-developers.com/razer-phone/how-to/guide-to-unlocking-bootloader-t3706462"]fully unlock your bootloader[/URL] and [URL="https://forum.xda-developers.com/showpost.php?p=74607352&postcount=8"]unlock flashing capabilities[/URL] on your device. 
    [URL="https://eu.dl.twrp.me/cheryl/twrp-3.2.1-0-cheryl.img.html"]TWRP image[/URL] + [URL="https://eu.dl.twrp.me/cheryl/twrp-installer-3.2.1-0-cheryl.zip.html"]TWRP injector[/URL]
    [URL="http://tiny.cc/latestmagisk"]Magisk flashable zip[/URL]
    A GSI of your preference from the ones listed [URL="https://forum.xda-developers.com/project-treble/trebleenabled-device-development"]here[/URL]. PS: Use the Gapps+SU one if you choose AOSP ;)

    0. Make sure you're running the Android O DP1 from Razer, or any future update to it.
    THIS WON'T WORK ON NOUGAT
    1. Properly install TWRP on your device: (I'll be using @Dees_Troy's guide with a few modifications to make very sure everything will work as intended)
    - fastboot flash the twrp image as explained by him, in your currently active boot partition. PS: After flashing the Android O DP1, it will always be A.
    Dees_Troy said:
    Once you have adb working, run this command: adb shell getprop ro.boot.slot_suffix

    It should say: [ro.boot.slot_suffix]: [_a] Or: [ro.boot.slot_suffix]: [_b]

    Make note of whether you are currently using slot A or B. Next power off the device and boot to the bootloader using your USB cable and volume down. You want to switch to the other boot slot. If you are currently on slot A, type this: fastboot --set-active=_b Or on slot B type this: fastboot --set-active=_a

    You should see something like this: Setting current slot to 'a'... OKAY [ 0.042s] finished. total time: 0.042s

    I found the bootloader on the Razer Phone to be extremely finicky and I had to run the command multiple times until I got it to run successfully. You may have to hold the power button for 15 seconds to force power off the device and then re-enter fastboot mode. Keep trying until it works. Once it's on the right boot slot, type this: fastboot flash boot twrp-3.2.1-0-cheryl.img && fastboot reboot
    2. Once you're in TWRP, DO NOT SLIDE to allow modifications, but tap on Mount as Read Only. Plug in your USB cable, and adb push the boot image from the Android O DP1 factory image to your sdcard, as well as the TWRP injector and the Magisk zip. That can be done with the following commands:
    Code:
    adb push twrp-installer-3.2.1-0-cheryl.zip /sdcard
    Code:
    adb push path/to/the/factoryimage/boot.img /sdcard
    Code:
    adb push Magisk-16.0.zip /sdcard
    3. Go into Reboot, then make sure you're on partition A. Else, tap on the button to set A as the active partition.
    Now go back, tap Install, then tap on 'Install Image' then choose the boot.img you just pushed, and flash it as boot image.
    Now go back, into Reboot, and move to partition B and repeat the step above.
    Once you're sure both partitions only contain the unmodified boot images, set the partition A as active, go into Install, choose the twrp-installer-3.2.1-0-cheryl.zip and flash it.
    Once it finishes, do the same with the Magisk zip file.
    4. Go into Reboot, press on Bootloader.
    5. Connect the usb cable, and flash the GSI system image onto your system_a partition through fastboot from your pc. This can be done with the command:
    Code:
    fastboot flash system_a system-arm64-ab.img
    5.b If you wish, you can install a different GSI onto your system_b partition, and that can be done with the following commands:
    Code:
    fastboot set_active b
    Code:
    fastboot flash system_b system-arm64-ab-gapps-su.img
    5.c If you wish to go back to the system_a partition, you can execute:
    Code:
    fastboot set_active a
    6. Reboot and enjoy.
    Prebuilt boot image:
    If doing the steps from 1-4 seems messy or you don't get it to work properly, I've published the image I made following them with the latest Magisk and TWRP versions available as of April 20th 2018.
    You can download it from here. You can then flash it from fastboot by using the commands:
    Code:
    fastboot flash boot_a boot_linuxct_20180420_cheryl_omr0.img
    Code:
    fastboot flash boot_b boot_linuxct_20180420_cheryl_omr0.img
    SHA-2: 2f0c7348ac906f2f81fa39df7b24b69392783bd2379d5da357777be444c67d97​

    Old version (from ODP1 - may experience the bootloader issues):

    You can download it from here. You can then flash it from fastboot by using the commands:
    Code:
    fastboot flash boot_a boot_linuxct_20180330_cheryl_odp1.img
    Code:
    fastboot flash boot_b boot_linuxct_20180330_cheryl_odp1.img
    SHA-2: 8f763162415167b2e919a450654f9a46f69b81f6853013bcabf362dfeb2a115e


    Many thanks to everyone that helped me today to get this to work properly!
    9
    In-call audio fix for Android O DP1

    After a lot of effort, I've got in-call audio to work.

    Just download the following attached zip file which you need to flash on top of an existing GSI set up you should have done, or use the Magisk Module attached too.

    If you want an in-depth explanation of what has been going on, check out this thread I've posted in the general section in hopes it'll be useful for some other devices out there.
    Thanks to everyone who has helped me on this.

    NOTE: ONLY FOR OREO DP1, DO NOT TRY ON LATER VERSIONS!!!
    5
    Want some screenshots? ;)
    3
    Phh should be getting the Razer phone I shipped him by the end of the week, expect fine tuning and more fixes then, if you can wait a week.

    Sent from my taimen using XDA Labs
    3
    I've updated this thread's OP with a new boot image, based on Oreo MR0 release, for anyone who needs it.
    And btw, those of you who were experiencing the bootloader going to Download mode on its own after some reboots, Oreo MR0 seems to fix it so I recommend going for it.
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