yashsingh1/xdaforums huggingface dataset:
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Root by Magisk

Click Here For MR0

Click Here For MR1

fastboot flash boot_a boot.img

fastboot flash boot_b boot.img

fastboot reboot

If you get this error

Your device is corrupt. It can’t be trusted and may not work properly.

Use a terminal app or use computer and type this.

su

reboot "dm-verity enforcing"

MR0 rooted to MR1 failed to install workaround

If you're already on rooted MR0 and OTA installation failed for the MR1 Update.

You must boot into fastboot mode and flash MR0 stock boot.img , vendor.img , system.img then check for update follow instructions below.

https://s3.amazonaws.com/cheryl-factory-images/aura-p-global-3040.zip

fastboot flash boot_a boot.img

fastboot flash boot_b boot.img

fastboot flash vendor_a vendor.img

fastboot flash vendor_b vendor.img

fastboot flash system_a system.img

fastboot flash system_b system.img

fastboot reboot
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Fixed link
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
I managed to capture the OTA... All I got was payload.bin. How do extract my own boot.img so I can patch it?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] jonchance_84:
I googled how to extract bin files. Install python on your PC. There's a package that will unpack the payload.bin file.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Flippy125:
Thanks for this! Was stuck at work when I pulled the OTA and couldn't do it myself. Saved me a few steps
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] blackknightavalon:
This saves us time. Razer won't put the image on the developer portal for another week
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] th3cavalry:
The problem I have is it now says my device is corrupt even after side loading the whole OTA file. Still got the error right after the side loading.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Guys, the payload.bin doesn't contain the full images. It contains bdiff delta files. YOU CANNOT TYPICALLY FLASH THE IMAGES EXTRACTED FROM THE PAYLOAD.

You need to patch the previous factory images with the diff. I'm downloading the update now and will gladly post a stock boot image when I get it (and if nobody else does it before :P )

Not really needed now though thanks to OP

Edit: Major version upgrades do appear to have flat images, but that shouldn't be an expectation. Always check the patch method in the metadata (extractor programs should at least write this to the console) is image and not bdiff.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Use a terminal app or use computer and type this.

su

reboot "dm-verity enforcing"
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] FellpeSoares:
i need erase user data? i get boot loop after flashing boot.img
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] RKBD:
are you sure that you are installing it on pie?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] FellpeSoares:
yes
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
Is anyone having issues with Google Pay? I have been passing Safety Net with no issue. I even removed all of my modules and still can't make a payment with Google Pay. I noticed the only way to get it working is to go to Magisk Manager and check "Magisk Core Only Mode" so I can then use it. Anyone else having this issue?

Edit:

Razer Phone 2 Android 9

Magisk 18.1
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] simplegek:
I did the same way but after flashing the patched boot its booting normaly but i am still stuck in bootanimation.

If i flash again stock boot img works normaly.

what can be the reason for that ?

Best Regards

SimpleGek
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
I must of gotten lucky then. I extracted the boot.img from the payload.bin then used magisk to patch the boot.img for root. No issues so far.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
It is certainly possible from what I can tell. Most probably a guarantee when there's an OTA to the next version of Android(deltas would probably be bigger than a flat image). I'm more implying that this shouldn't be an expectation. If you tried to patch the boot.img extracted from the payload in the OTA for O-MR0 to O-MR2 there would most definitely have been problems, for instance.

So 'twas just a warning. That WAS lucky ;)
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Gamesoul Master:
Alright, so, I'm gonna be the one to ask the stupid question. All a completely stock user has to do to get root now (on an unlocked RP2) is... Update to Android Pie normally, unlock the bootloader, and then follow the OP?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] simplegek:
Do you working now with diff ? so how i understand diff means that we need merge RP2 with RP0 boot.img ?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Ok, so the OTA packages work like this:

The package has some metadata and a number of "payloads"(concatenated in a single file)

There is one sub-payload per partition in a firmware slot(A or B)

The metadata specifies the checksums, sizes etc of each payload, along with a patch method

The patch method tells the update engine how it should go about patching the matching partition with the payload.

Most of the time this patch method will be a bdiff(binary diff).

When its bdiff, the payload is not a full image, hence the previous image is required. This previous image can be extracted from a factory image, and the diff combined with it to form a flat image which you can flash directly (and patch with magisk)

SOMETIMES (like with a major upgrade where a diff will likely be larger than a image) the patch method is image, where the payload is a flat disk image of the partition which is simply written to the partition.

The Pie update evidently contained a flat boot image. So in this case, you DO NOT need to merge the images. But with with subsequent smaller updates, we likely will need to do that.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] simplegek:
Thank you for the Intensive information.

Can you tell then , What propably can be my Problem , that i am stucking at the Bootanimation with patched boot.img(Magisk).
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] kirschdog1:
Deleted.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
The link still works.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
I'm not sure to be honest. Which stock boot.img are you using which is working normally? Have you tried using magisk manager to patch that stock boot image yourself?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
Thanks so much for that information! I'll make sure to remember that. How would one go to manually patch it to prepare the boot.img for flashing? Gather this latest release and hold on to it for smaller updates?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Yes. The factory image should be released by the time the next OTA comes, so you can use that to patch up the smaller updates.

I forgot the exact methods. It involved a lot of fiddling, I'll try to consolidate it at some point. I should mention this wouldn't be needed to root anymore in light of the "install to other slot" methodology I've seen recently. It's purely for early recovery/insurance before the factory images drop for any given update.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] FellpeSoares:
you need delete userdata
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] simplegek:
Yes i got it fix , Unfortunately i did this , so its working.

Can Dalvik Cache be the reason of this ?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] MystikMan97130:
Hello, i need to somethinh before flash? like enable debug option or other?

Edit: Just a driver problem i'm rooted now.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Veggiesama:
I had 8.1, updated to 9.0, and spent a while trying to downgrade. Thanks to this post, I don't need to.

For the longest time, fastboot was giving me issues: write to device failed, unknown command, request download size is more than max allowed, etc. I switched between a few different cables, but none of my 2-way USB-C cables were working. What finally worked was USB-A to USB-C.

Now I've got 9.0 and root. Thanks.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dmw_4814:
So, I'm on Android 8.1 on my Phone 2, rooted with Magisk. Am I understanding correctly that in order to get Android 9 on my phone and be rooted, I should first unroot, then take and install the Android 9 update my phone keeps telling me is available, and then follow the instructions in the first post of this thread? Thanks.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Youssarian:
Easier than that. What I did from memory...

I took the first oreo update. Then setup as usual, signed in to google apps, etc. Installed magisk, and rooted.

Close any open apps.

Then take the pie ota download and install. Do

NOT

reboot.

Open magisk manager and install / patch magisk to open slot.

Close magisk manager and reboot the ota.

Kept all my settings, etc.

You should be good to go.

That's it. :)

Mine:

Unlocked RP2 from USA Best Buy.

Carrier: TMO.

< As usual, if you chose to do this, I am not responsible for anything your actions do, or don't do. >

<I was never here.>
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dmw_4814:
Thanks; I'm on Pie now, rooted and with EdXposed installed.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] balathegame:
I have updated to Pie, can any one guide me how to root my phone??
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] jonchance_84:
Read the OP. It's kinda easy.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] ekoandrew:
odd, not able to download boot.img from googledrive
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Castanoff:
Worked great but Magisk says I pass saftynet but Google pay still not work
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Trippyy Doee:
You shouldn't even be here if you can't follow the simple instructions in the post.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Just a guess, but you'd probably need to clear data for play services and Google pay.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Castanoff:
Thank you that worked. Cleared cash and rebooted and it works now.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
It seems a new update for Pie just came out! Quite a few bug fixes.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Punk_Oll:
OP do you have a copy of the untouched/original boot.img ?

As it would be useful for people like myself who are wanting to install the MR1 OTA

Thanks
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Stock boot.img

https://xdaforums.com/showpost.php?p=79161604&postcount=122
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] andy1011:
Razer phone 2 Pie root

i had previously had 8.1 with root on the phone using the same method above. however, after upgrading to pie (after a full wipe) i am trying to get root again. i followed the instructions above many times perfectly, and the flash is successful, however, the manager never sees that the new boot.img is installed leaving me without root. im no expert, but not new either, any ideas?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] blackknightavalon:
I'm getting this after flashing the patched MR1 boot images to boot_a and boot_b
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] andy1011:
same here

same here. its not seeing the new boot.img i guess.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dmw_4814:
Are you talking about the system update I got a notification about during the night, last night? It says it contains "audio fixes and improvements; the latest GMS apps, and other bug fixes and improvements". It's 223MB in size.

What will happen if I take this update (I'm on Pie, of course - rooted, with EdXposed installed)? Will I lose root? If so, I can just re-root, correct?

Thanks.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
Yeah, it's the same update.

Well, you have to relock your bootloader to take the OTA and by doing that you'll factory reset just as you did when you unlocked your bootloader. Then you'll have to go through the whole process of rooting as you did before instead you'll need an updated boot.img that comes from this latest update.

To be honest going through all that again is what's stopping me.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dmw_4814:
Man, you ain't kidding! It literally takes me about a full day to get my phone set back up the way I like it, and I dread resetting the phone & wiping everything out because of that!

Is there no way of using fastboot to like "dirty flash" the update and not lose all my data/settings, or do I not understand that applying a system update like this just automatically means your data will be wiped?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
I got the OTA update to work by flashing MR0 stock boot.img vendor.img and system.img both in slot A/B
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
OP updated
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Check OP
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] blackknightavalon:
I already posted on another thread how I fixed it. Basically I downgraded to Oreo, updated via normal update paths (leaving my bootloader unlocked), waited until I updated to MR1 that way, installed Magisk Manager, patched the boot image, uninstalled Magisk Manager, flashed the boot image, then reinstalled Magisk Manager and that did it
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
So, this will keep all our settings and such? No need to relock bootloader and factory reset? We'll only have to configure Magisk and modules again?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Correct.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] GoomerHD:
If I understand correctly, it can be easier.

If you have already installed the last ota and lost the magisk you can:

open fastboot

-fastboot set_active b (if the current active slot is a)

-fastboot reboot

The previous firmware version will be loaded.

you can install the magisk use method from this topic:

xdaforums.com/showpost.php?p=79021594&postcount=21

Install the last ota but do not reboot.

Open magisk -> install -> Install in an inactive slot (After OTA)

Profit, no changes will be lost
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] jonchance_84:
Thanks warrior! Easy and didn't lose a thing. Hopefully by the next MR, we will have TWRP and make all of this a little faster.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
You're welcome. Yeah it definitely will.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dmw_4814:
So, this MR1 image from March, 2019 on Razer's website is the factory image WITH this latest 223MB update my phone keeps nagging me about, correct?

Thanks.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
The MR1 is the March 2019 update but the files I have posted are only boot.img to have Magisk and Superuser support. So if you're rooted on MR0 and the MR1 update won't install follow the instructions I posted about the workaround. But If you're already on the MR1 firmware then just download the MR1 boot.img I have in the OP and just flash that for Magisk and Superuser support.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Can somebody do me a favour and run the following command on a rooted Pie MR1 and tell me if there's a lot of lines in the resulting file? Preferably a device that doesn't have the "device is corrupted" bootloader splash I managed to get on mine.

cat /proc/kmsg | grep denied > /sdcard/kmsg.log

I'm getting an abnormally large amount of SE denials on mine
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
Here you go I ran it twice letting the 2 run longer.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
That's perfect thanks. Seems to not just be me

It looks like Razer messed up a bit on the Pie security policies. Lots of denials with minimal ROM changes...
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] jonchance_84:
Here's my log. Rooted pie mr1, never got the corrupted message.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] CurtisMJ:
Hmm. Same as the others. Seems like that for everybody. Thanks guys!

For those interested, I think Razer may not have added some exceptions for some Pie stuff into their security policy and now the system is blocking itself and wasting some CPU cycles on security audits. SELinux is stupidly efficient so it's negligible usually, and AFAIK a common mistake in ROM building. I could also be wrong about how legitimate the audit denials (I don't build ROMs lol). But this was mostly for my own sanity in case the corrupt flag on the bootloader is the reason some bootloader props are getting blocked.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] dankickcan:
Need help, PC won't flash mr0 boot vendor or system img, fastboot fails to send gets hung up on sending, also gives me error for it being to big or something, I also flashed mr1 boot img over mr0 and broke audio and video but flashed mr0 over and everything is fine now, I think. Trying to update to mr1 and get bug fixes with root, but can't get it too go through, should I try another PC?

Edit: managed to use twrp from arter97's kernel build to factory install mr0 and update to mr1 but now I get error for phone corrupt, will try terminal in twrp to run su command

Edit: got rid of the corrupt message ran into issue of installing kernel and losing magisk, fixed by installing kernel and flashing magisk image inside of twrp everything is fine now mr1 with root and twrp
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
It's coming.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Lucifer6:
Every single time that I have attempted to type in fastboot flash boot_a boot.img,

it stays stuck indefinitely and does not do anything... I'm on MR1.

Someone please help!
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Proxy983:
So I have a question about this, I rooted magisk to both a and b partitions and was wondering if I can redo it and let's say flash TWRP to a and magisk to b? Would there be any repercussions to doing this or should I unroot both partitions first, flash stock image to both partitions and then go ahead with flashing both TWRP and magisk? As of now phone seems to be running fine, but since I technically have no recovery due to both partitions being filled. I did have an issue of sudden root loss yesterday, but I fixed it by a hard reset and data wipe and root returned once I ran root checker. Any advice would be appreciated, also I pass all the safety net checks with np.

Edit : I'm thinking I should at least flash stock image on a partition again, I have titanium backups in place as well.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Warrior1988:
I would just in case go ahead and flash the custom Kernel to boot_a and boot_b just to play it safe. Then download magisk manager and download the flash able zip from within magisk manager then reboot to twrp and flash it.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] JDubbed:
Anyway to get Google Pay to work with Magisk installed? I tried to hide all Google apps in Magisk but during setup Google Pay says my phone is rooted and will not allow me to continue the setup.

Never mind found the answer in case anyone else is wondering.

https://www.google.com/amp/s/xdafor...on-google-pay-magisk-discussion-t3906703/amp/
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] JDubbed:
Is there an MR2 version of this?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] mattwheat:
I had the same problem. And when I asked the very same question I was told I didn't have the right fastboot driver's installed. Makes sense but I'm not 100% sure that's what's wrong. I haven't had a chance to install the other ones and try it out. Can't hurt to try.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] popeye2468:
Here's what I did makes life easy if your on windows

Download ADB link

https://www.jocala.com/

Install it

Plug in your device and get it to fastboot

Open control panel then device manager

Look for your device right click select update drivers

Select let me pick

Select browse(have disk)

Locate the folder for ADB link and USB drivers (c:\adblink\usb driver)

Wait for the correct driver to be found and install job done
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] rogeriskira:
Hey Warrior! I wanted to know if you made any progress with the rom? As those substratum images you showed were awesome! I appreciate all the time you put into this.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] mps105:
I believe so, yes. You can't install OTA updates when rooted.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] ChronosTrigger:
How do I know which "boot.img" to download and use?

MR0 or MR1?

What is the difference?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] _Sherrif:
I believe the difference is patches and updates. Personally, I would flash the boot.img which corresponds to the current stock version i have installed. Not sure if flashing one that did not match your current build would bork anything, but if it does you could always flash the System ROM from RAZERS Site.

Take a look in settings, system info, there you will see which version you have; then flash either MR0 or MR1 boot.img according to the stock version you currently have installed.

Take a NANDROID before you do anything
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] JDubbed:
So if one cannot OTA update while rooted how would I get important security patch updates? Should I just unroot, OTA and then reroot every couple months? Can I install security patches manually?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] ROCKYCRAYZO:
Arter's Kernel

Will there be a problem if I flash Arter's Kernel after flashing this boot?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] _Sherrif:
No it will not be a problem.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] peixeskim:
I tried to flash but doesn't boot help anyone?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Yahyoo:
Stuck on "your device is corrupt"

, trying full day and flash stock firmware didn't help , my phone is brick now
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Yahyoo:
Solved ,,, i used a normal USB cable type C to Usb PC

Using the Fast charging cable didn't help + downgrade to Oreo

Happy Yah :)
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] Gamesoul Master:
Yeah, that's one of those things that's usually mentioned in more user-friendly OP's. Never use the cable included with the phone for doing anything important like this. If I recall correctly, even Razer themselves says not to use it for unlocking the bootloader or side-loading anything.
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] kubalolxd1:
can someone help me ? I have done bootloader installed magisk everything is fine root access I have. But dolby atmos is not working I dont have any sound at all means nobody can hear me wthrough calling, cant lsiten any music. Even yooutube is not working I cannot watch an yvideo please help me

So I came back to original firmware I even had ota update. so Its fine. But I still would like to root that phone with any problems like working dolby atmos and everything. Can someone help me which image should I download when I flash that image which commands should I put the one with a or b ? or both of them ?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] SynGreis:
i did fastboot boot_a nd boot_b with reboot but now im stuck on razer loading screen. does this mean im stuck in a bootloop?
[Razer Phone 2 ROMs, Kernels, Recoveries, & Other D] kountry83:
[MENTION=5943303]SynGreis[/MENTION]

What firmware are you on and is bootloader unlocked? Sometimes it takes a while on first boot to configure kernel.