yashsingh1/xdaforums huggingface dataset:
[Sony Xperia M5] mbc07:
Okay guys, the new kernels are up and I'll manage this thread differently from now:

Thread update

The first change you might have noticed is that the normal thread was converted to a DevDB thread. This allows me to upload larger files (much needed, since the previous release was nearly hitting the maximum attachment size of normal threads).

Kernel variants

Another change is that I provided different variants of the stock kernels and so I'm grouping them differently (basically by firmware version and variant). The variants available are listed in the OP.

They're now grouped by firmware version and variant. So, if I want to flash the SuperSU variant to my Xperia M5 (E5603) running firmware 30.2.A.1.21 I should download the file 30.2.x.1.21_SuperSU.zip. Single SIM variants (E5603, E5606, E5653) uses the firmware with A in the name while dual SIM variants (E5633, E5643, E5663) uses the firmware with B in the name, and on this example, 30.2.x.1.21_SuperSU.zip will have both.

Where's Magisk?

Well, I really intended to offer a kernel variant with Magisk already set and SafetyNET checks passing out of the box but I hit some problems and so I decided to not offer such variant, at least for now. The first issue is that Magisk is a little more complex to set up compared to SuperSU, so I couldn't come with a "stable" solution to make it survive factory resets like I did with the SuperSU variant. You might think that it's not a big deal, but actually it is, the way I'm sharing those modded kernels means you won't have access to the stock kernel backup the Magisk installer does when it's first installed, so, after a factory reset you would end without root access and with a messed Magisk install, and I don't find that acceptable.

That's why I decided to offer the DRM Fix variant instead: with it it's up to the user to install the root solution or SafetyNET bypass method they want and as bonus they'll still keep the DRM Fix library, so if a new SafetyNET bypass method or another rooting solution surfaces in the future, it's just a matter of reflashing the DRM Fix variant then installing that new method or root solution. It also prevents me from wasting time of, for example, including Magisk with a factory reset survival mod on the stock kernel then porting it over to the other versions (we're already at 6 different versions if you count the 3 Marshmallow firmwares currently released to Xperia M5 + the single and dual SIM variants) just to find SafetyNET was updated again and no longer works on the kernel variant you've just released.
[Sony Xperia M5] ih8redsn0w:
Does it work if I flash it using Sony Mobile Flasher by Androxyde with the bootloader locked?
[Sony Xperia M5] Ninoh-FOX:
where is the kernels files?
[Sony Xperia M5] crisaegrim:
In the dowload section,

Check the first post and youll see 3 tabs at the very first,

Regards,
[Sony Xperia M5] Ninoh-FOX:
Thanks!! With the supersu kernel I go back to pogo!! XD

Enviado desde mi E5603 mediante Tapatalk
[Sony Xperia M5] ataraxist:
Can you share your setup with which kernel, xposed and pogo? SuperSU kernel won't pass safetynet...
[Sony Xperia M5] ataraxist:
Amazing work! Thank you very much!
[Sony Xperia M5] Ninoh-FOX:
Supersu kernel + suhide + commands in su.d + xposed 86.2 + root switch, pass safetynes.

Enviado desde mi E5603 mediante Tapatalk
[Sony Xperia M5] ataraxist:
What is commands in su.d? Can elaborate?
[Sony Xperia M5] Ninoh-FOX:
su.d is how the old init.d

the files is:

00xposed (from xposed 86.2)

01ramdisk (from root switch 1.3.3.2 patch)

02xsetprop (from a module for magisk v8)

05suhide (from suhide 0.55)
[Sony Xperia M5] ataraxist:
Frankly, I don't know how to use this. Care to explain?
[Sony Xperia M5] ataraxist:
I flashed the supersu kernel. Then I flashed the fotakernel recovery. I can't boot to recovery... What's your setup?

Can someone recommend a Recovery.img for the .21 kernel?
[Sony Xperia M5] Ninoh-FOX:
In .21 the command "reboot recovery" not work, you only can load recovery with fisical key (power on + vol -), I have the same problem.

Enviado desde mi E5603 mediante Tapatalk
[Sony Xperia M5] ataraxist:
Vol- did not work for me.

Did u Go to the*/system*and delete*recovery-from-boot.p?
[Sony Xperia M5] Ninoh-FOX:
I have how recovery-from-boot.bak

Enviado desde mi E5603 mediante Tapatalk
[Sony Xperia M5] mbc07:
With the phone turned off and no USB cable attached, hold Vol Down THEN press Power Button, until it vibrates. Doing that will get you in recovery (if you have flashed one), It's important to do that without the USB cable, otherwise you'll be sent to flash mode. And I would avoid modifying the system partition, most time this causes SafetyNET checks to fail...
[Sony Xperia M5] ataraxist:
Finally I got into recovery. Thx mbc07, and all the great work !
[Sony Xperia M5] ataraxist:
[MENTION=5604590]mbc07[/MENTION]

i flashed the superSU kernel and access the system app and delete some bloatware. then i flashed back Stock Kernel and it couldn't reboot. It is stuck at SONY logo startup. Can you advise me?

i am using A.21 kernel.
[Sony Xperia M5] mbc07:
Verified boot. Modify a single byte in the system partition and the stock kernel won't boot anymore. If you want to use the stock kernel, you must not modify anything on /system. BTW, you'll need to reflash the system partition with FlashTool (or do a repair through Xperia Companion) to get your device booting again on stock kernel.
[Sony Xperia M5] ataraxist:
Yea I did a reflash and it's fine.

So there is no other way to modify system and keep stock?
[Sony Xperia M5] mbc07:
Nope.
[Sony Xperia M5] D1kiy:
Where can I download this kernels? It's nothing in attachment
[Sony Xperia M5] crisaegrim:
Refer to this:
[Sony Xperia M5] D1kiy:
/del
[Sony Xperia M5] D1kiy:
I don't understand one think. I have to flash TA keys on Android 5, then update to Android 6 and flash kernel?

Or I have to flash TA keys after updating on Android 6?
[Sony Xperia M5] Toldo:
You need to BACKUP keys on android 5, then FLASH the prepared keys on android 6.
[Sony Xperia M5] D1kiy:
I already did backup.

So now I must install Android 6 after that flash first TA keys and then kernel?
[Sony Xperia M5] Toldo:
You need to modify the TA.img first. Read the instructions in the first post, they can't get any clearer. Read them through a couple times. If You don't understand what to do, then You might want to stop doing anything because You might brick Your phone.
[Sony Xperia M5] D1kiy:
I did. I have DK.tft. I just dont understand when is better to flash it, now or after installing new firmware.
[Sony Xperia M5] Toldo:
It doesn't matter. Default settings in Flashtool don't touch the trim area.
[Sony Xperia M5] Miryo:
Androi 6 ROOT help

First sorry my bad english, im Hungarian!

So i brought an Xperia M5 but i not knowt that this mess to ROOT it...

The mobile is: Xperia M5 E5603 with Android 6.0 the buildversion is 30.2.A.1.21. Bootloader unlock allowed: no.

Can anyone who have succesfully rooted the device how to ROOT it step by step? (Its 2years warranty and i want not mess up...so pls yust someone who is sure about it) i know its a big deal but i would by thankfull to christmas XD...Also SNS would by better.....PM is ok also...somewhere were i can reply how i going.

THX
[Sony Xperia M5] mbc07:
You've got an unit with a permanently locked bootloader (from a carrier, probably?). There's no way to root it on Marshmallow, and it probably will remain like that due Verified Boot (dm-verity). You can still root it under the older Lollipop firmware, through...
[Sony Xperia M5] ataraxist:
Unless someone find a way to exploit...u can't root until u unlock bootloader.

Not sure kingroot has any update on this phone.
[Sony Xperia M5] mbc07:
*sigh*

Here we go again

Do not expect root access on locked bootloader devices if you're on Marshmallow or newer, even with a working exploit (and we already have working exploits on the newer firmwares, like Dirty COW). As I already said on other threads, Marshmallow firmware on Xperia M5 enabled Verified Boot (dm-verity), so, it means you can not modify anything on system partition (if you modify a sigle byte of it, the device will refuse to boot). This fact alone prevents gaining permanent root access since you need to write into system partition (althrough you can get temporary root access with an exploit just fine, e.g. to make a TA backup). The only way to disable dm-verity is by flashing a modified boot image, something users with permanently locked bootloader devices ("Bootloader unlock allowed = no") will never be able to do.

In other words, Xperia M5 users with permanently locked bootloaders wanting root access are currently stuck in the old Lollipop 5.1 firmware, which don't have dm-verity at all (and can be rooted with iovySU, for example)...
[Sony Xperia M5] Unitedinred:
I have the Xperia M5 e5603 on the 30.2.A.1.21 FW except I do have an unlocked bootloader. Will this work for me?
[Sony Xperia M5] simonepignotti:
Thanks for your work man! :good:
[Sony Xperia M5] Rodrigo Pi:
Great job, my friend!

I unlocked the bootloader and did no backup of the TA partition. Consequently I lost all DRMs! Thanks to our friend "MBC07" and his work, my E5643 is running the latest firmware, stock 30.2.B.1.21, with root access and all DRMs running perfectly! It's as if it had not unlocked the bootloader, "Rooting Status: Bootloader unlock allowed: Yes". More is unlocked! Until the date my warranty came back. This proves that all DRMs are working perfectly. :cool:

Thanks MBC07, and congratulations for the work! :good:

Happy New Year to all members of XDA!

---------- Post added at 08:58 PM ---------- Previous post was at 08:40 PM ----------

To do this, just flash the files, "boot_m5_ss_30.2.A.1.21_drmfix.img" and "boot_m5_ss_30.2.A.1.21_supersu.img", in that order!

And you will have root access and your DRMs back!

Good luck. Pi :good:
[Sony Xperia M5] mbc07:
There's no need to do that, they can just flash "boot_m5_ss_30.2.A.1.21_supersu.img" directly. Also, keep in mind that since you didn't have a TA backup to extract the keys, the DRM Fix library is running in emulation mode, most of DRM related features will work except for apps that depends of Widevine. Those can only work with the unique device key from your phone that you don't have since you've unlocked the bootloader without backing up the TA partition first...
[Sony Xperia M5] Rodrigo Pi:
Yes. I've read your post, about the TA running emulated, and the Widevine dependent APP DRMs do not work! More in my case I had already unlocked the bootloader without the TA backup. In the case of our friend Unitedinred. I understood that it unlocked Bootloader, without TA backup. What I gave to him, solved for me! Thanks for correcting. :good:
[Sony Xperia M5] knight84:
Hi i'm trying to flash a rom( Xperifirm.) i got this Warning message:

Flashtool: Those data not in FSC script and will be skipped: AUTO-BOOT , OSV-Restriction

Do you want to continue?

shall i click yes??
[Sony Xperia M5] aidfarh:
My phone gets stuck on Sony logo when booting with DRM Fix version of the kernel (boot_m5_ds_30.2.B.1.21_drmfix.img). It boots fine when I use the SuperSU version (boot_m5_ds_30.2.B.1.21_supersu.img).
[Sony Xperia M5] mbc07:
That's normal. Stock and DRM Fix flavors does not disable Verified Boot (dm-verity). You've modified your system partition, so dm-verity checks will fail and thus you'll be stuck at Sony logo if you use Stock or DRM Fix flavor.
[Sony Xperia M5] aidfarh:
I see. Is it possible to make a DRM Fix version, but with Verified Boot disabled?
[Sony Xperia M5] mbc07:
Yes, it is possible, however I have no plans of providing such flavor, at least not for now. You can flash the DRM Fix flavor currently available then proceed with Magisk or systemless SuperSU instalation through TWRP, that will also patch dm-verity checks. I'm also experimenting with an alternative way to restore DRM Fix without requiring the LD_PRELOAD and libdrmfix.so trick but I have nothing to share at moment, maybe soon...
[Sony Xperia M5] aidfarh:
The thing is, I want to be able to make modifications to /system via recovery, then boot with dm-verity disabled. However some banking apps I use are complaining if my phone is rooted. So I need a kernel with dm-verity disabled, but without root. I would appreciate very much if you could help me with this.
[Sony Xperia M5] mbc07:
Although I haven't tested, I'm pretty sure that flashing the DRM Fix flavor then installing Magisk in TWRP and enabling Magisk Hide will make root access completely stealth on any app (it can even bypass the troublesome SafetyNET checks!). Other alternative I could think is flashing the SuperSU variant then choosing full unroot option inside SuperSU app. The thing is, I wish I could just provide you a version of DRM Fix flavor without dm-verity but I'm very busy with other projects so I have no idea of when I'll have time to do this, please try these workarounds or try some kernel patching tool in the meanwhile...
[Sony Xperia M5] aidfarh:
I tried flashing the SuperSU variant, then choosing full unroot, but it didn't work. I'm not really familiar with Magisk but I'l try it with Magisk Hide when I have the chance. Thanks for the suggestion.
[Sony Xperia M5] D1kiy:
Hello. Can somebody help me with repacking one of this boot.img?

I unpacked one of them with Carliv Kitchen, but after repacking with same tool and flashing to device, device doesn't boot. Even without changes in boot.img.

I would like to add custom kernel to boot.img, but first I must learn to repack image.
[Sony Xperia M5] vic1997:
Hello, i do all the steps and all works except for the final, when I flash DRMfix, i see Sony logo and then I read the pages and saw that it was necessary to flash SuperSU, that what I did but he boot also on Sony logo.

Help me, i don't know what i need to do.

Thank you in advance

EDIT : Ok, I found the solution, I had forgotten to install Marshmallow again, since I am not English-speaking and I am a beginner, I understood that the update was in the new kernel. Anyway, thanks to you!

EDIT2 : It will be cool if you make a little tutorial for DRMfix + Magisk, for SafetyNet bypass. (sorry for my english). Thank's !
[Sony Xperia M5] zak3l7:
Hi,

do you have any news about the offline charging bug? Is there any way to get this solved?

Thank you in advance!
[Sony Xperia M5] mbc07:
Nope. What I know is that it works fine until you flash a rooting solution like Magisk or SuperSU, after that it stops working. It's probably some conflict in the init.rc scripts that get modified by the rooting solution, but to be honest I hadn't investigated any further since those findings...
[Sony Xperia M5] ch3mn3y:
Could someone tell me how to use systemless variant of the kernel? For MAGISK i need TWRP and for TWRP i need to have root before to remove that file from /system partition.

So how to make it work, so I have TWRP, MAGISK and do not trigger SafetyNet by modifying /system partition with SuperSU?
[Sony Xperia M5] mbc07:
I don't know where you got that info, but it's wrong. To get TWRP, you just unlock the bootloader then flash TWRP image into FOTAKernel partition with fastboot, no other changes required. Then, you can flash the DRM Fix variant of the kernel (either from fastboot or from TWRP) then proceed flashing Magisk ZIP file from TWRP. From Magisk Manager, you then enable Magisk Hide, reboot one more time and you're done.
[Sony Xperia M5] ch3mn3y:
@ mbc07

I don't have M5 (asked for a friend),so all I know I read in TWRP thread: https://xdaforums.com/xperia-m5/development/recovery-twrp-3-0-2-2-touch-recovery-t3461728

And there is that You need to remove that file.

It's great that it's not needed as it makes everything a lot easier. Thanks.
[Sony Xperia M5] TRXteam:
Root is not required in order to flash twrp, my friend started that thread... Sory for wrong information
[Sony Xperia M5] tyrael11:
WIFI Problems

Hey guys,

i'm new to the forum but i have a bit of experience in flashing and stuff, so not a complete rookie.

i recently experienced a strange problem with the WIFI signal of my M5 E5663 Dual after flashing the stock kernel with root / drm fix.

- everything went totally fine. i followed every step of the original post: downgraded to lollipop -> rooted witough probs -> backed up the TA / DRM keys -> unlocked bootloader -> FLashing my device DRM keys -> updating to marshmallow -> flashing the modified kernel (SuperSU image)

- the phone passes security tests (so there isn't a problem with the DRM keys)

- i did all of it to bring back the EngineerMode to MM because i wanted to stop the Shutdown Bug from happen (cutting off the 900mhz frequency from UMTS; i have a E5663 Dual from India, Living in Germany -> so i don't have the right of getting the phone battery replaced under warranty, because you cannot buy this variant of the Phone here. in addition i ordered a new 3rd revision battery yesterday to get rid of the shutdown permanently)

- somehow the strength of the phone's wifi module is now weak as heck (not because of the signal itself or internet probs -> it works just as normal on my other phone and my pc)

- mobile data works just flawless (even with the 900mhz cut out form UMTS)

- wlan is just slooooooow

- is this a common prob with unlokcing the bootloader or rooting my phone? or a known issue with the SUperSU image?

- any suggestion how i can fix it?
[Sony Xperia M5] andi ilham:
any people speak Indonesia?
[Sony Xperia M5] munjeni:
Sorry being offtopic, can I invite somebody? https://xdaforums.com/xperia-m5/help/help-comfirming-related-to-flashing-t3625133 Many thanks!
[Sony Xperia M5] Darkimmortal:
Have these modifications been released somewhere?
[Sony Xperia M5] mbc07:
I would like to announce I'm officially retiring from all Xperia M5 development, so the modded kernels I provided on this thread, alongside dd Flasher Minimal and iovySU, are now essentially unmaintained. The current release still works fine despite the offline charging bug, but that's all, I don't own the M5 anymore so even if I wanted, it would be very difficult to investigate and provide any new bug fix or release for them, and I would rather spend that time which is already scarce developing for my new main phone, the Xperia X.

As a farewell, I've included the kernel variants info in the OP, alongside with some other cleanups, and I hope your fellow M5 owners find someone else willing to help or maybe even develop something new for the Xperia M5, a very good device that unfortunately got plagued by its limited availability and manufacturing issues...
[Sony Xperia M5] fralyx:
Does this will be applicable to the X Performance too?
[Sony Xperia M5] Sirius_Balzier:
Hey guys. I have spent much time using my M5 with TWRP + Magisk kernel. A weeks ago, my phone suddenly started rebooting, each 4 - 5 days. Now, when i reboot it myself, it gets stuck at the waves animation, so i press the reset button (the tiny hole besides sd card slot). But when i power on, my apps are reorganized in a random order, my apps' folders are deleted, and apps got spreaded along the whole menu, my widgets deleted themselves (no widgets on first screen) an so on. When i apply some changes on some xposed modules and reboot, there aren't any changes and then, it repeats the same history mentioned above. The point is: What can i do? What do you suggest me to do? This is annoying, rebooting and encountering these issues.

Thanks in advance :)
[Sony Xperia M5] Medeon:
extracting the device key

I'm a little confused, help me out please. I have downloaded the rootkernel tool and unzipped the files in my adb folder because I thought it would be most likely the correct location for it. Should I run the command Promp from here and flash my device key?
[Sony Xperia M5] mbc07:
There's no "correct" location to it, you can unzip Root Kernel anywhere. Then, you use the command described on the OP inside the folder you've extracted...
[Sony Xperia M5] Yosako:
Apparently the M5 could get a Nougat update as long as any dev gets to port it from the LeEco Le1s, which also features a Mediatek Helio X10 SoC (CPU runs at 2.2GHz, M5's runs at 2.0 GHz), and there are several Nougat ROMS available on XDA.
[Sony Xperia M5] Medeon:
Almost there

I unlocked the bootloader, flashed the device key's and the DRM Fix kernel succesfully but my phone entered into a Sony logo and android started up the phone as usual, but it didn't enter into recovery mode.

Powered of the phone, held down Vol Down + Power up, but still didn't enter into recovery mode. The phone just booted up normally.

Is there any step that I missed?

Thanks in advance
[Sony Xperia M5] mbc07:
You can't enter recovery if you haven't installed one. I don't cover this part on this thread but there's a TWRP port for M5 available in the Development subforum...
[Sony Xperia M5] Medeon:
Thanks for the quick reaction. Custom recovery is now installed :) Should I reflash the DRM fix kernel or can I continue flashing Magisk?
[Sony Xperia M5] Medeon:
Done

Never mind though. My phone is rooted now and I'm all good to go! :D Thank you very much! :good:
[Sony Xperia M5] vuvantruongxd:
[MENTION=5604590]mbc07[/MENTION]

I followed your instructions. My E5663 has rooted. TWRP + Magsik v15.3 installed successful.

I check *#*#7378434#*#*

Service Test/ Security:

Blobs: generic error!
HUK: generic error!
PRODID_AID:004 [Key OK] [Active]
OTP_LOCK_CONFIG: 003 [Key OK] [Active]
OTP_LOCK_STATUS: LOCKED [Key OK] [Active]
AUTH_ENABLE: 01 [Key OK] [Active]
DIVICE_ID: f81***63 [Key OK] [Active]

Is that normal? I mean, if someone do all the steps you guide right, and check Service Test/ Security, Does the result error Blobs & HUK like me?

Thank in advanced
[Sony Xperia M5] mbc07:
You did something wrong. Getting generic error means the DRM Fix library weren't loaded at all. Check also your bootloader status in service menu, if it also says "Bootloader unlocked: yes" then the DRM Fix library definitely didn't get loaded at all...
[Sony Xperia M5] Medeon:
Same here

Thats odd! Same thing happened to me. Generic error on Blobs and HUK, the rest passed the security test. Also the bootloader status say's "Bootloader unlocked: yes" . I also did steps and proceeded the process carefully. I did a bootloader check to see if the ADB drivers were installed correctly. Wich assured me the device is connected in fastboot so that should be okay. By the way the DRM related functions are working just fine. Pictures from the camera look just as sharp like before I opened the bootloader so that should be okay. I have no idea what possibly went wrong while flashing the device key and the DRM fix kernel variant. It all finished without errors. Could it be because of an update on the firmware, I don't know?:confused:
[Sony Xperia M5] mbc07:
It's certainly not what you guys would like to hear but... Generic error in the security test and "Bootloader unlocked: yes" in Service Menu means the DRM fix isn't working at all. If the library is not working, none of the Sony enhancements will work (including noise reduction algorithm in low-light photos and Mobile BRAVIA Engine).

Could you guys try flashing the SuperSU variant, just to make sure the device key was correctly flashed? If the generic error in the security test go away with the SuperSU variant, I'm afraid something changed in Magisk which broke the DRM Fix library preloading. If that's the case, I unfortunately can't fix this as I don't own the Xperia M5 anymore :(
[Sony Xperia M5] Medeon:
Sure, I'd like to flash the SuperSu variant some day soon now after doing a backup with titanium backup. As an alternative might it be possible to flash an older version of Magisk? I kinda like the Magisk functionality with the possibility to download modules and Safetynet pass.
[Sony Xperia M5] vuvantruongxd:
[MENTION=5604590]mbc07[/MENTION]

I confirm this error!

My phone: 5663 ( 30.2.B.1.21)

*/ Yesterday, I flashed: Kernel DRM fix + Magsik 15.3. Result: Blobs and HUK: GENERIC ERROR

*/ Then I reflash Kernel SuperSU. Everything in *#7378423#* : OK [KEY ACTIVE]

Thanks [MENTION=5604590]mbc07[/MENTION] very very much. (Y)