• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Development [Kernel][25.11.2021][Android 11] Kirisakura 1.4.0 for Asus ROG Phone 5 aka "Anakin"

Search This thread
I know, I saw your thread and it's nice that you do this.
But I think it's also important that users learn to do that by themselves if needed. Especially if they choose to modify their phones, they should know how to revert it without too much help from outside. And it's mentioned in my OP :)

My kernel flashes a modified dtbo.img, so the three images I mentioned need to be restored if one wants to go back to stock completely.
So I think people would appreciate if you start adding dtbo.img to your thread too :)

I don't disagree with people learning to extract the payload, which is why i've explained how in previous iterations (if it was somehow dropped along the way).

You're welcome to patronize me for it, but I also understand that the average user may not be able to install the right python or patch magisk without running into trouble. We actually have a whole thread somewhere about someone flat out not being able to patch on their phone. The app does all the work, so it's not like they failed to follow instructions.
 

Madbullben

Senior Member
Feb 23, 2013
95
13
Hi, I installed this yesterday via twrp and everything seems to be working, but earlier you mentioned that the kernel doesn't flash properly through this method. I haven't bought either of the kernel managers you mentioned in the first post.

Although I swear I had franco installed many many years ago back on my Sony Ericsson 😂
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,135
16,458
Hi, I installed this yesterday via twrp and everything seems to be working, but earlier you mentioned that the kernel doesn't flash properly through this method. I haven't bought either of the kernel managers you mentioned in the first post.

Although I swear I had franco installed many many years ago back on my Sony Ericsson 😂

At the moment it´s not ideal. better to flash the 1.1.2 build from the previous page in that case.

I hope we can eventually fix that small issue in TWRP.
 

Anubarak16

Senior Member
Oct 24, 2014
139
44
ASUS ROG Phone 5
Thank you for your help, I just wanted to revert the kernel back but received the "WAITING FOR FLASHING FULL RAMDUMP" error and it didn't respond for about 10 minutes.
Before reverting the stock kernel does someone want me to do something? This issue seems to be very common and I thought phones would not recover from it.

Not sure if it's worth something but I attached the files suggested from https://www.xda-developers.com/how-to-take-logs-android/ just in case

Edit: after 3 unsuccessful tries to upload the logs here....

I'll wait a little bit just in case and revert back to stock later
 
Last edited:

Anubarak16

Senior Member
Oct 24, 2014
139
44
ASUS ROG Phone 5
Just grabbed the files and did
Code:
$ fastboot flash boot boot.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.161s]
Writing 'boot_b'                                   OKAY [  0.166s]
Finished. Total time: 4.102s

$ fastboot flash boot dtbo.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.343s]
Writing 'boot_b'                                   OKAY [  0.194s]
Finished. Total time: 3.082s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.369s]
Writing 'vendor_boot'                              OKAY [  0.145s]
Finished. Total time: 2.560s

I ended up in a bootloop, then I tried it the other way around and did dtbo.img first
Code:
$ fastboot flash boot dtbo.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.378s]
Writing 'boot_a'                                   OKAY [  0.185s]
Finished. Total time: 3.069s

$ fastboot flash boot boot.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.181s]
Writing 'boot_a'                                   OKAY [  0.227s]
Finished. Total time: 4.045s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.216s]
Writing 'vendor_boot'                              OKAY [  0.234s]
Finished. Total time: 2.493s
for whatever reason boot_a was used this time?
I wanted to restore everything via TWRP but it's not able to detect my backup anymore and my storage folder is empty.
Any suggestions?
It always boots into bootloader now and I have no way to boot the system at all
 
Last edited:

mohammed510

Senior Member
Feb 3, 2012
575
187
Dubai
Xiaomi Mi 11 Ultra
Just grabbed the files and did
Code:
$ fastboot flash boot boot.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.161s]
Writing 'boot_b'                                   OKAY [  0.166s]
Finished. Total time: 4.102s

$ fastboot flash boot dtbo.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.343s]
Writing 'boot_b'                                   OKAY [  0.194s]
Finished. Total time: 3.082s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.369s]
Writing 'vendor_boot'                              OKAY [  0.145s]
Finished. Total time: 2.560s

I ended up in a bootloop, then I tried it the other way around and did dtbo.img first
Code:
$ fastboot flash boot dtbo.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.378s]
Writing 'boot_a'                                   OKAY [  0.185s]
Finished. Total time: 3.069s

$ fastboot flash boot boot.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.181s]
Writing 'boot_a'                                   OKAY [  0.227s]
Finished. Total time: 4.045s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.216s]
Writing 'vendor_boot'                              OKAY [  0.234s]
Finished. Total time: 2.493s
for whatever reason boot_a was used this time?
I wanted to restore everything via TWRP but it's not able to detect my backup anymore and my storage folder is empty.
Any suggestions?
It always boots into bootloader now and I have no way to boot the system at all
Format data in TWRP (not factory reset). Try if you can flash latest ota in TWRP after formatting data. You can also try to switch active partition from a to b or vise versa.. good luck!
 
  • Like
Reactions: Anubarak16

Anubarak16

Senior Member
Oct 24, 2014
139
44
ASUS ROG Phone 5
Tried that but I'm not able to format data.
The error is
Code:
unable to mount storage
unable to mount /data/media/TWRP/.twrps
Error opening: 'data/recovery/.version' (no such file or directory)
E: unable to check merge status
updating partition details
...done
unable to mount storage

edit: however just changing the active boot partition to b via TWRP fixed it...
I'm back on stock and rooted.. even tho I have no idea what happend.
Thank you very much @mohammed510
 

Madbullben

Senior Member
Feb 23, 2013
95
13
At the moment it´s not ideal. better to flash the 1.1.2 build from the previous page in that case.

I hope we can eventually fix that small issue in TWRP.
What is the issue with flashing in twrp? Also is it flashing both the kernel and dlkm or just the kernel? Not sure if the dlkm is just for diagnostic stuff which you were doing.
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,135
16,458
Thank you for your help, I just wanted to revert the kernel back but received the "WAITING FOR FLASHING FULL RAMDUMP" error and it didn't respond for about 10 minutes.
Before reverting the stock kernel does someone want me to do something? This issue seems to be very common and I thought phones would not recover from it.

Not sure if it's worth something but I attached the files suggested from https://www.xda-developers.com/how-to-take-logs-android/ just in case

Edit: after 3 unsuccessful tries to upload the logs here....

I'll wait a little bit just in case and revert back to stock later

thanks for the logs.
Right at the beginning of the kernel log I can see your device is being detected as a normal ROG 5. Why that is I have no idea.

Can you grab the same logs but from a rooted stock kernel on your Ultimate?


Just grabbed the files and did
Code:
$ fastboot flash boot boot.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.161s]
Writing 'boot_b'                                   OKAY [  0.166s]
Finished. Total time: 4.102s

$ fastboot flash boot dtbo.img
Sending 'boot_b' (98304 KB)                        OKAY [  2.343s]
Writing 'boot_b'                                   OKAY [  0.194s]
Finished. Total time: 3.082s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.369s]
Writing 'vendor_boot'                              OKAY [  0.145s]
Finished. Total time: 2.560s

I ended up in a bootloop, then I tried it the other way around and did dtbo.img first
Code:
$ fastboot flash boot dtbo.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.378s]
Writing 'boot_a'                                   OKAY [  0.185s]
Finished. Total time: 3.069s

$ fastboot flash boot boot.img
Sending 'boot_a' (98304 KB)                        OKAY [  2.181s]
Writing 'boot_a'                                   OKAY [  0.227s]
Finished. Total time: 4.045s

$ fastboot flash vendor_boot vendor_boot.img
Sending 'vendor_boot' (98304 KB)                   OKAY [  2.216s]
Writing 'vendor_boot'                              OKAY [  0.234s]
Finished. Total time: 2.493s
for whatever reason boot_a was used this time?
I wanted to restore everything via TWRP but it's not able to detect my backup anymore and my storage folder is empty.
Any suggestions?
It always boots into bootloader now and I have no way to boot the system at all
Tried that but I'm not able to format data.
The error is
Code:
unable to mount storage
unable to mount /data/media/TWRP/.twrps
Error opening: 'data/recovery/.version' (no such file or directory)
E: unable to check merge status
updating partition details
...done
unable to mount storage

edit: however just changing the active boot partition to b via TWRP fixed it...
I'm back on stock and rooted.. even tho I have no idea what happend.
Thank you very much @mohammed510

It seems something triggered your slot to be switched. That usually happens if you try to flash a firmware zip or in some way cause the A/B system to get confused (wiping restoring data in twrp might trigger this too).
When the slot is switched you might end up in an unbootable state and your device crashes to ramdump or bootloader screen.

Glad you got it back up and running.

What is the issue with flashing in twrp? Also is it flashing both the kernel and dlkm or just the kernel? Not sure if the dlkm is just for diagnostic stuff which you were doing.

It´s a bit hard to explain in a simple fashion, but I´ll try anyways.
Usually drivers are built directly into the kernel image. you flash that kernel image and are done.
However there´s the possibility of build the drivers externally as so called dynamically loadable kernel modules (DLKM). That allows those to load those drivers via a command at will.

Due to the "nature" or rather the coding of some of the drivers on the ROG phones and (also due to Google introducing GKI and CAF doing their own thing with QGKI), it´s at the moment not possible to build just everything directly into the kernel image.
So the kernel.zip automatically installs a magisk module that includes two DLKMs, which I load via a script during booting. If kernel is flashed via TWRP this magisk module is broken and those two drivers are missing.

If you want to flash via TWRP and want to end up with the "same" as when flashing via a kernel manager you should flash the kernel.zip and the DLKM magisk module in TWRP.
 
  • Like
Reactions: Anubarak16

JazonX

Senior Member
Dec 16, 2009
1,891
754
Xiaomi Mi 11 Ultra
there is no stock kernel.zip.
you need to extract boot.img, vendor_boot.img and dtbo.img from the payload.bin inside the full firmware zip available on asus support site.
Flash all those three .imgs via fastboot and you´re back to stock. If you want to stay rooted patch boot.img via magisk-manager prior to flashing it via fastboot.
You can extract them with this tool for example:


attached is a more recent build of the kernel alongside a magisk module.

To try them, boot to TWRP, first flash the kernel.zip and directly afterwards the DLKM zip. Reboot.
After reboot go to terminal and do the lsmod command again and show me the output please :)


Hey @Freak07 Mate;

I flashed both the zips over TWRP, No errors so far.

Can you check whether I need both these modules?
ak3-Helper is from the previous version. Should I keep both ?


ModulesDLKM.png





Second, Here's the lsmod output if you didnt get it yet -
This is from ROG 5 Ultimate - on WW latest.


lsmod.png
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,135
16,458
Hey @Freak07 Mate;

I flashed both the zips over TWRP, No errors so far.

Can you check whether I need both these modules?
ak3-Helper is from the previous version. Should I keep both ?


View attachment 5414761




Second, Here's the lsmod output if you didnt get it yet -
This is from ROG 5 Ultimate - on WW latest.


View attachment 5414763
yes the "bandaid" is working for you. the ak3 helper module is one that is broken when zip is being flashed from TWRP. you can see that it´s broken as there´s no proper description for the module in magisk manager.

If it doesn´t bother you, you can keep the ak3 helper module if flashed from TWRP as it won´t get loaded anyway and will be reinstalled on every flash via TWRP. Just now that the DLKM module replaces the function of the ak3 helper module.

That´s how the "description" of the ak3 helper module should look if it´s flashed correctly.
Screenshot_20210921-074018358 (1).jpg


We´re working on resolving the issue. So hopefully the bandaid will at one point no longer be needed.
 

Madbullben

Senior Member
Feb 23, 2013
95
13
Hi, just wondering if it's possible now or in the future to change the voltage settings of the cpu+gup?
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,135
16,458
Hi, just wondering if it's possible now or in the future to change the voltage settings of the cpu+gup?
CPU is not possible on modern QCOM chips.
GPU is possible, but I'd suggest you don't mess with it. There have been a few fried ROG 3 devices in the past, because people played with it.
It's also something that will never end up in my kernels, because I value stability. And there are always those very few devices that have with even the slightest changes there.
Instead of undervolting I suggest to restrict max GPU (same for CPU) freq a few steps via armoury crate for gaming and see if the game still runs smooth. Excellent tool is game genie where you can check fps in real time.

However if you want to experiment with this kind of stuff:
There's a tool called Konabess or something similar. It's open source and available on GitHub. It will probably do the trick for you. ;)
Just remember that playing with these kind of things can introduce the most mysterious and strange bugs. :)
 
Last edited:

Madbullben

Senior Member
Feb 23, 2013
95
13
CPU is not possible on modern QCOM chips.
GPU is possible, but I'd suggest you don't mess with it. There have been a few fried ROG 3 devices in the past, because people played with it.
It's also something that will never end up in my kernels, because I value stability. And there are always those very few devices that have with even the slightest changes there.
Instead of undervolting I suggest to restrict max GPU (same for CPU) freq a few steps via armoury crate for gaming and see if the game still runs smooth. Excellent tool is game genie where you can check fps in real time.

However if you want to experiment with this kind of stuff:
There's a tool called Konabess or something similar. It's open source and available on GitHub. It will probably do the trick for you. ;)
Just remember that playing with these kind of things can introduce the most mysterious and strange bugs. :)
Thanks for clear answer! I'll stick with your recommendation and just leave the voltages where they are intended to be if they do indeed introduce bugs or even kill my device, not worth it, our device already seems quite sensitive to changes so doing this will probably just mess things up.

I was trying to reduce the amount of power that the device consumes, but unsure of how to do it, besides lowering the voltages and cpu frequency, even when not gaming as I'm not a huge gamer on phones anyway, its the other specs on the phone which massively drawn me into it.
 

Freak07

Recognized Developer / Recognized Contributor
Jan 2, 2011
5,135
16,458
@Freak07 so.. is 165hz possible on Rog 5? 😎
No idea. But there´s no "hidden" 160fps mode as on ROG3, so I´m not sure the system would even support it even if the kernel would make the panel run at 160fps, if the panel is capable of that. The panel works different than ROG3 too. FPS handling is different than ROG3. So probably not unfortunately.
What I´d be more interested in is to make the 90fps mode usable, without the quality degradation.
Maybe I´ll give it a try at one point. :)

Thanks for clear answer! I'll stick with your recommendation and just leave the voltages where they are intended to be if they do indeed introduce bugs or even kill my device, not worth it, our device already seems quite sensitive to changes so doing this will probably just mess things up.

I was trying to reduce the amount of power that the device consumes, but unsure of how to do it, besides lowering the voltages and cpu frequency, even when not gaming as I'm not a huge gamer on phones anyway, its the other specs on the phone which massively drawn me into it.
undervolting probably won´t kill any device (besides random instability that might be introduced, can also be temperature based as to what works fine during summer won´t work during winter etc.). Usually people want to overclock the GPU to show of some Antutu Scores.
Undervolting/underclocking the GPU won´t save you much power anyway if you´re not gaming.
Same as the CPU the GPU goes into idle states if it´s not being used, especially during light usage.
That means even if kernel managers report certain CPU freqs, the CPUs actually go to Idle C-States during that time. The more so, the lighter the usage.

There´s a feature in the kernel I haven´t documented yet that lets you restrict the max CPU freqs on kernel level. So no powerhal can boost "above" those limits. I´ll put some documentation for that into one of the first posts soon.
This is why I've been with Kirisakura since my HTC U11 ~
Did I thank you enough for coming onboard the ROG 5 ?

Cheers, and keep up the great work!
thank you for the kind words :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Big update for .196 firmware dropping soon.

    About stability for the previous versions here's a screenshot. Over 30 days without rebooting the phone and a single crash.
    Those that suffered from them, remove all magisk modules, don't disable any system apps, don't remove them or do other mods. Pretty sure problems are caused by this.

    On zf8 (which shares a lot of the codebase) there were a few users that also crashed to ramdump or otherwise and all of those were caused by using either mods or what I described above while running my kernel.

    Screenshot_20211124-093932319.jpg
    3
    Update to 1.4.0

    Hey guys and girls,


    I hope everyone is having a good day or starting into one. Here´s the next update. It´s a rather big one.
    I´m a bit short on time, so I don´t have time for a bigger writeup, but the changelog is below. All of that adds up to quite a lot.

    The kernel is updated for the latest firmware:
    18.0840.2111.196. Make sure to update to the latest firmware before flashing the kernel to have no compatibility issues.

    Flashing the zip should now work fine from everywhere as the ak3 zip has been updated.

    The link to the WW firmware can be found here:


    More changes in the Changelog below:


    Changelog:
    - Import ASUS_I005_1-18.0840.2111.196 source code
    - Linux-Stable Upstream to 5.4.161
    - Merge CAF (QCOM) upstream
    - remove logging while device is suspended
    - improvements to deep sleep power consumption (ufs driver, auto hibernate)
    - reduce auto suspend delay in various other drivers
    - improvements on various subsystem like memory management, bluetooth, display, gpu etc
    - implement LRNG (thanks @arter97, see arter kernel OP for more info )
    - updates from kernel common for several subsystems
    - updated ak3 zip, thanks to @osm0sis


    Download:



    Instructions can be found in the OP!
    But look at this post too :)

    Have fun, enjoy the kernel and your phone.

    Donations are not mandatory but very welcome.
    If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
    2
    Hey @Freak07

    New firmware out for ZS673KS

    photo6064405728334032498.jpg





    EDIT : Current 1.2.0 Version of the kernel works!
    1
    Hello, I do not know about you, but for me the original karnel the phone keeps the battery about 20% longer
  • 8
    Kirisakura-Kernel for the ROG Phone 5

    Hello everyone,

    To keep it short: Here is Kirisakura - Kernel for the Asus ROG Phone 5 aka Anakin. The ROG Phone line-up internal codenames are traditionally derived from Yedi-Characters of the Star Wars universe. Three years ago the 1st gen ROG Phone bore the generic title "Yedi", the ROG Phone 2 was codenamed "Yoda" and the Rog Phone 3 bore the title "Obiwan".
    I would appreciate if everybody that flashes the kernel, reads at least once through this opening post and the following ones.

    Kirisakura - Kernel is designed to bring a handful of beneficial features to the device, while ensuring excellent performance and smoothness to get you safely through the day!
    If you expect a custom kernel to magically improve your devices battery life manifold and this is your only priority then this might not be the right place for you.
    However the kernel is built to keep battery life close to the same as you would experience the on stock kernel while being tuned to perform better in various UI related benchmarks. The same benches are used by google to verify and ensure UI smoothness on the Pixel devices. The scheduler is tuned to yield lower jitter and reduce jank frames.
    There´s also a cpu-battery saver mode that cuts back the CPU max- freqs, but without the disadvantages like delayed notifications from built into the system user-space power-saving modes.
    If that got your curious, I welcome you to continue reading if you´re still interested!


    This project aims to keep most of the subsystems updated, way ahead of the stock kernel, thereby improving security and performance, while keeping stability as the foucs during testing! This includes Linux-Stable, CAF-Upstream and kernel/common.


    A very positive development. Google pushed for CFI and SCS to be enabled by default in the android-common kernel. In this years generation ( 5.4 linux kernel base/ SD 888 ) CFI and SCS are enabled by default. It was a lot of work to get these features working nicely on the kernels I did develop on for the past few year. So it´s nice to see this is now there by default in everybody can profit from it.
    I put the explanations and links in hide tags here.

    Kernel Control Flow Integrity (Kernel-CFI), which is achieved by linking the kernel with LLD and Link Time Optimization (LTO), more precisely ThinLTO, are quite unique security features.
    The recently released Kirisakura-Kernel for the OnePlus 8 Pro was featured on the XDA-Portal due to the inclusion of CFI. The featured article explains CFI in great details, is easy to understand and definitely worth to read.
    If possible the latest Kirisakura-Kernel releases for various devices aim to include CFI in enforcing mode so users can benefit from this security features.

    Another security feature is Shadow Call Stack (SCS).
    SCS is another security patchset that is aimed at preventing attacks via return oriented programming (ROP).
    ROP is a technique where the attacker gains control of the kernel stack to overwrite function return addresses and redirect execution to carefully selected parts of existing kernel code.
    If you´re interested here are a few good links:
    Google Security Blog explaining SCS.
    LLVM doc about SCS
    Android DOCs documenting SCS

    If reading about linux or caf/qcom upstream in the paragraph above got you curious, have a read about Linux-Stable and why it is important here. The stable-process is not the same for every subsystem, but the general idea, rule of thumb and benefits are applicable for other subsystems as well.
    Read more about the Release-Model following this link.
    This conversation on the LKML mailing list also shows the power of Linux-Stable and why it´s very beneficial to not just say it´s not worth and a potentiol source for bugs:
    Starting with the Initial Message , the following reply and a good summarizing statement.


    Quick explanation of CAF-Upstream. CAF is short for Codeaurora-Forums. This is the place where development from Qualcomm for their SoCs happens. This includes the Snapdragon 888 that´s built into the different SKUs of the ROG Phone 5.
    The kernel-bases available on the Codeaurora-Forums, are basically the foundations OEMs use, to build their own kernel additions on top for devices featuring Qualcomm SoCs.
    The Qualcomm developers push regular updates to the bases of the different SoCs, a bit similar to how Linux-Upstream works. OEMs usually stop updating the initial base after the phone is released.
    This kernel focuses amongst the other features to provide the latest CAF-Updates merged in a regular manner, to provide updates, improvements and enhancements for SoC specific drivers and subsystems! This might take a while, because a lot of device specific testing is done on my end to ensure stability.

    The kernel includes a lot of improvements and contributions from other developers as well. Without this kernel would not exist.
    A big part of improvements originate from @arter97´s, @kdrag0n´s and @Sultanxda´s work. Many others contributed in some way or another to this kernel.
    A big thanks to all of them at this place!

    Now lets continue with a list of features in the next paragraph!


    Main Features:
    - Based on latest kernel sources from Asus for Android 11 and intended to be used on the latest Asus Stock-Firmware (currently 18.0840.2111.166)
    - compiled with Clang 13.0.1 and built with -O3 speed optimizations
    - Linux-Stable-Upstream included to 5.4.161
    - upstreamed CAF base for the Snapdragon 888 (qcoms internal codename "lahaina")
    - include important fixes/improvements from kernel/common
    - tune scheduler for improved jitter and less jank frames
    - reduce power consumption during deep sleep
    - remove logging while device is suspended
    - remove sleep debugging from Asus for release build
    - disable various debugging mechanisms for drivers which are not needed on a perf build (for example touchscreen, fingerprint reader, display, binder)
    - disable various debugging configs, that are not needed in a perf kernel build according to google.
    - disable selinux auditing (we don´t have to adress selinux denials running a stock rom)
    - display tweaks to reduce power consumption on statically rendered images
    - disable unnecessary CPU errata for our specific SoC
    - disable per cgroup pressure tracking to reduce overhead
    - free up RAM by removing reserved mem regions used only for debugging
    - implement LRNG (thanks @arter97, see arter kernel OP for more info )
    - Flashing the kernel will keep root!
    - Flashable via EXKM, FKM or TWRP (if available) on a rooted system!
    - Anykernel zip is based on the Anykernel3 release from @osm0sis


    EAS related features:
    - Implement dynamic WALT-Window size depending on current FPS, collecting information about CPU-Load to provide more precise information for the scheduler
    - EAS implementation patched up to latest CAF state
    - updates from kernel/common
    - scheduler updates from sd888/ 5.4 kernel
    - scheduler update from sony xperia 1 III kernel aiming to improve WALT

    CPU related features:
    - Power saving workingqueues enabled by default (toggleable in EXKM)
    - Change various drivers (WLAN, MM, audio, charger, power, thermal, glink etc) to use power efficient workingqueues. This compliments EAS in general
    - improvements to cpufreq/times/stats
    - vdso32 patches as found on Google Pixel devices (brief documentation here) (CAF 5.4 default, keep for documentation)
    - remove event debug logging
    - disable broken irq detection, disable debugmon
    - improve suspend/resume from audio driver (caf-upstream for audio-kernel)
    - cpuidle: wake only cpus for which qos has changed (this allows cores to keep idle states better)
    - disable debugging during sleep states as per qcom recommendation
    - remove RTB logging to reduce overhead
    - disable trace_printk as it shouldn´t be used on production/perf kernel builds
    - disable edac and coresight (following google on the pixel kernels)
    - disable jtagv8 debugging as recommended by qcom for perf builds to avoid potential power, performance and memory penalty
    - disable s2idle in favor of deep idle state -> improves deep sleep drain (google initially used 2idle for improved suspend/resume latency on pixel 3 and pixel 4, but disabled it on pixel 5. qcom followed suit for sd 888, but apparently didn´t see google reverting it on pixel 5. Other OEMs such as Xiaomi or OnePlus already disabled s2idle on their SD888 devices in favor of deep- read more about s2idle vs deep here)
    - raise LTO-inlining -> more info

    GPU related features:
    - GPU driver updated to latest CAF-State
    - gpu/kgsl improvements from pixel 4/pixel 5 kernel
    - add low_prio_worker thread for gpu driver (Improves performance when tearing down processes (eg, via LMK) and not blocking currently running UI from submitting work to the GPU
    - remove POPP functionality from GPU driver to avoid constant fight about downscaling with msm-adreno-tz
    - increase gpu worker thread priority
    - don´t wait for fenced GMU writes

    File System related features:
    - upstream BFQ-MQ to latest state in linux-mainline and default to 128KB readahead
    - improve memory allocations in kernfs
    - ufs improvements from pixel 4/ pixel 5 kernel
    - improve GC as to not interfere while user interaction is happening and prevent possible jitter or latency spikes
    - improvements to deep sleep power consumption (ufs driver, auto hibernate)

    Audio related features:
    - provide option to override audio profile based on impedance measurement (run 16ohm headphones in 64ohm mode, dangerous use with caution!)
    ----> more information/explanation how to control the feature linked here

    Display related features:
    - Backlight Dimmer (reduce minimal brightness below stock limit)

    Network related features:
    - Wireguard Support (Details)
    - advanced TCP algorithms enabled
    - use bbr as default TCP congestion algorithm (fasted algo according to this excellent research from @kdrag0n found here )
    - improved networking drivers from caf-upstream (especially wifi)
    - remove unnecessary wakelock from WLAN driver to reduce thousands of very short wakeups during a 7 hour deep sleep period
    - improved bluetooth performance (¹, ²)
    - Enable support for TTL spoofing

    Memory related features:
    - Speculative Page Faults left enabled (1. 2) (CAF 5.4 default, keep for documentation)
    - Fix various memory leaks in different subsystems
    - improved mm with patches from mainline
    - patches from kernel/common
    - improve memory allocations in various subsystems, video encode/decode, kernfs, cgroup
    - Backport to enable CONFIG_HAVE_MOVE_PMD (see here) , thanks @arter97
    - Backport to enable CONFIG_HAVE_MOVE_PUD (commit here) , thanks @arter97
    - free more RAM by removing unused reserved memory regions
    - mm: Micro-optimize PID map reads for arm64 (improves game performance, especially unity based games such as genshin impact)

    Security related features:
    - Control-Flow-Integration (CFI) and Link-Time-Optimization (LTO) (CAF 5.4 default, keep for documentation)
    - Use ThinLTO which was first used in the Pixel 4 XL Android R-Kernel instead of full LTO (CAF 5.4 default, keep for documentation)
    - Shadow Call Stack (SCS) Security-Feature ( 5.4 default, keep for documentation)
    - enable init_on_alloc for even more security, more information can be found in the commit message (CAF 5.4 default, keep for documentation)


    Misc Features:

    Wakelock Blocker:
    - advanced wakelock blocker with the ability to block any wakelocks (dangerous, use with caution)
    - please read [URL="https://arstechnica.com/gadgets/2018/08/p-is-for-power-how-google-tests-tracks-and-improves-android-battery-life/"]this for further info
    - blocking a kernel wakelock should only be done in case of firmware incompatabilities (WiFi network at work (can´t be changed) causes deep sleep to not work on the phone.) That´s the only use case I see for this feature. The kernel does not features this to improve battery life!

    Other features:
    - clean up asus drivers and fix a few warnings in kernel log
    - disable logging and debugging to make the kernel more lightweight in various places (includes binder, mm, vma, gpu, ipa etc)
    - fix several coding issues detected by newer Clang-Toolchains
    - enlarge dmesg size to ease debugging


    Flashing Guide, Download and Changelog

    Requirements:
    - unlocked Bootloader (this will void warranty and kill future OTA updates on all asus phones at the moment)
    - USB-Debugging in developer options enabled
    - latest adb and fastboot binaries
    - working adb and fastboot environment
    - magisk root
    - a backup of stock boot.img, vendor_boot.img and dtbo.img so you can go back to stock conditions (simplest way is TWRP or to extract from stock firmware)

    How to flash the Kernel:
    1. Download the latest kernel.zip and make sure you have properly updated to the latest matching Asus Stock-Firmware (check the feature list for the current firmware the source is based on). When the ROG Phone 5 receives an OTA update it takes Asus a while to release the source code for the new OS and me a while to build a new kernel. If you don´t want to face any issues, wait until I either release an updated kernel or give green light because there were no kernel changes.
    Always make sure to run the firmware the kernel is built for!
    If you feel adventurous and try in advance, make sure you have a backup ready!

    2. Flash the kernel.zip via latest TWRP (if available), EXKM or FKM app and do a full reboot.
    2a. Important: If flashing the kernel via TWRP, flash the DLKM magisk module found in the download folder that matches the kernel version.

    3. Reboot and profit.


    DOWNLOAD:
    Download is located always in this folder:

    Important: Read after Download
    Please take a look at the second post after flashing the kernel!

    Changelog:
    Android 11

    1.0.0 Initial Release
    1.1.0 https://forum.xda-developers.com/t/...-rog-phone-5-aka-anakin.4333363/post-85637825
    1.2.0 https://forum.xda-developers.com/t/...-rog-phone-5-aka-anakin.4333363/post-85709075
    1.4.0 https://forum.xda-developers.com/t/...-rog-phone-5-aka-anakin.4333363/post-85998687

    Donations:
    Donations are not mandatory but very welcome if you want to support development or just buy me a coffee/tea :)
    If you like my work: http://paypal.me/freak07

    Credits:
    Asus for the development device, giving me the opportunity to create this project!
    @osm0sis for all his work, including the ak3 installer!
    @tbalden for being the best HTC, Pixel, OnePlus and now Asus wingman!
    @LeeDroid and @mwilky for their awesome roms and work I used on multiple devices!
    @Captain_Throwback for all the mentoring and guidance!
    @Eliminater74 for bringing me into the game and the Inspiration
    @nathanchance for his upstream guidance and assistance
    @RenderBroken for helping me out
    @flar2 for all his work
    @joshuous for all the help he provided to me in the past!
    @arter97 for giving me advice
    @kdrag0n for his help and advices!
    @topjohnwu for magisk!


    Source Code: https://github.com/freak07/Kirisakura_ANAKIN_ROG5
    4
    F.A.Q:

    Question:
    Is root preserved when flashing this kernel?
    Answer: Yes, the AnyKernel.zip will detect root and keep it.

    Question: Safetynet does not pass on my phone since I unlocked the phone, why is this so?
    Answer: Google introduced hardware backed attestation recently. Unfortunately the old kernel tricks to still get safetynet passing won´t work. Instead you will have to rely on some magisk modules. Short guide in post #4 below.

    Question: How do I return back to stock or another kernel.
    Answer: Extract boot.img, vendor_boot.img as well as dtbo.img from matching firmware you are on (you can do so by using this tool or similar ones found on XDA and when googling around) and flash them via fastboot. If you want to keep root flash back the magisk_patched_boot.img. Or dirty flash your rom and re-root.

    Question: Why is having Magisk installed mandatory for this kernel?
    Answer: The kernel uses a ramdisk overlay to apply some settings after boot. If you are not rooted these settings will not get applied and you miss some of the optimizations.

    Question: How to report bugs properly?
    Answer: Have a look at post #3 in the linked thread. The linked guide is a pretty good starting point.
    Before reporting any bug make sure you´re running on a stock configuration. That´s means you´re not using any mods, tweaks in kernel managers or other root tweaks , magisk modules, scripts or other modifications that alter various functions like sound mods, data traffic, sleeping behaviour, scheduler, magical battery tweaks etc.
    Try to describe the issue as detailed as possible! Give your exact setup, like rom, magisk version, kernel version.
    Is the issue reproducible? Does it happen frequently?
    Provide logs, otherwise debugging is a lot harder. If you can already reproduce the issue and provide logs it greatly limits the amount of time I have to spent until I figure out how to reproduce it.

    If the device force reboots/randomly reboots (that means you see the bootloader unlocked screen!) provide a .zip of /asdf.
    Easiest way is immediately after booting up, with a root explorer navigate to /asdf. Copy the contents to your internal storage, zip it up and send it to me.

    If the issue happens while the device is running provide a dmesg plus a logcat that you take while/shortly after the issue happens. This will log what´s running in the current session. Try to be as detailed as possible what´s happening when the issue appears. It will also help me in reading the log!
    4
    Update to 1.1.0

    Hey guys and girls,


    I hope everyone is having a good day or starting into one. Here´s the next update.
    I forgot to include wireguard in the release. That´s now added.

    Since we´re not building a QGKI kernel, but rather a standalone kernel an important config that feeds information to the powerhal daemon didn´t get fully built, since the QGKI dependency wasn´t met. This resulted in lags in games like NieR.

    Also fix certain games like 7DS (com.netmarble.nanagb) crashing frequently on startup.

    thanks to @twistedumbrella for reporting the bugs and noticing wireguard missing.


    More changes in the Changelog below:


    Changelog:
    - add wireguard
    - enable qgki part of msm_performance to fix lags in certain games
    - fix some games ( for example 7DS (com.netmarble.nanagb)) frequently crashing during startup




    Download:



    Instructions can be found in the OP!
    But look at this post too :)

    Have fun, enjoy the kernel and your phone.

    Donations are not mandatory but very welcome.
    If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
    3
    How to pass Safetynet after unlocking the bootloader

    With the introduction of hardware backed safetynet attestation, passing safetynet has become a lot more complicated.
    Some probably remember a while ago, flashing a kernel that forced some flags was enough to pass it. However these days are gone.
    Below is a short guide how to pass safetynet on phones that are flagged to use HW attestation (such as the ROG 5).

    1. Make sure you´re running with a working magisk environment on your phone.
    2. In Magisk Manager install both the "base" Riru module and Riru-LSPosed magisk module and do a reboot.
    3. After reboot make sure magisk hide is enabled in magisk manager
    4. Download the latest Universal Safety Net Fix from @kdrag0n ´s github and flash it in Magisk Manager. Reboot.
    5. Profit


    Screenshot_20210920-073118073.jpg
    Screenshot_20210920-073032443.jpg
    3
    Update to 1.4.0

    Hey guys and girls,


    I hope everyone is having a good day or starting into one. Here´s the next update. It´s a rather big one.
    I´m a bit short on time, so I don´t have time for a bigger writeup, but the changelog is below. All of that adds up to quite a lot.

    The kernel is updated for the latest firmware:
    18.0840.2111.196. Make sure to update to the latest firmware before flashing the kernel to have no compatibility issues.

    Flashing the zip should now work fine from everywhere as the ak3 zip has been updated.

    The link to the WW firmware can be found here:


    More changes in the Changelog below:


    Changelog:
    - Import ASUS_I005_1-18.0840.2111.196 source code
    - Linux-Stable Upstream to 5.4.161
    - Merge CAF (QCOM) upstream
    - remove logging while device is suspended
    - improvements to deep sleep power consumption (ufs driver, auto hibernate)
    - reduce auto suspend delay in various other drivers
    - improvements on various subsystem like memory management, bluetooth, display, gpu etc
    - implement LRNG (thanks @arter97, see arter kernel OP for more info )
    - updates from kernel common for several subsystems
    - updated ak3 zip, thanks to @osm0sis


    Download:



    Instructions can be found in the OP!
    But look at this post too :)

    Have fun, enjoy the kernel and your phone.

    Donations are not mandatory but very welcome.
    If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07