[OnePlus 8 Pro  ROMs, Kernels, Recoveries, & Other ] Freak07:
Kirisakura-Kernel for the OnePlus 8 Pro

Hello everyone,

To keep it short: Here is Kirisakura - Kernel for the OnePlus 8 Pro aka InstantNoodle.

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!

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.

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. In fact this may be (and probably is) the first 4.19 msm kernel with a fully working Kernel-CFI implementation and CFI-Violations fixed on a smartphone.

The only kernels made by OEMs offering this security feature are the ones for the Pixel 3 and Pixel 4 devices.

If that 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.

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 865 that´s built into the OP8 Pro.

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 others 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.

I´d like to mention @tbalden ´s excellent CleanSlate features at this place. They improve usability by a big margin for me personally. The highly customizable sweep to sleep implementation (adjustable to different navigation settings), long tap to bring down status bar (very useful on a big device), backlight dimmer and notification reminder are very useful features that I use personally every day, which can be enabled rootless if one desires to run without root.

Another 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 OnePlus for Android 10 and intended for use on OOS-Stable releases

- compiled with Clang 11.0.3 and built with -O3 speed optimizations

- Linux-Stable-Upstream included to 4.19.146

- CAF base for the Snapdragon 865 (SD865) updated to CAF-Tag LA.UM.8.12.r1-12500-sm8250.0

- Kernel Control-Flow-Integration (CFI) andLink-Time-Optimization (LTO) ported from 4.19 kernel/common and Pixel 4/XL Kernel

- Shadow Call Stack (SCS) Security-Feature

- Use ThinLTO which was first used in the Pixel 4 XL Android R-Preview Kernel instead of full LTO

- fix various CFI-Violations found in various subsystems like OnePlus drivers and qualcomm drivers

- Link the kernel with LLD and use RELR-Relocation

- include important fixes/improvements from kernel/common

- Flashing the kernel will keep root!

- Cleanslate Features included! See @tbaldens´s CleanSlate Thread for more information

- Flashable via EXKM and FKM on a rooted system!

- Anykernel zip is based on the Anykernel3 release from @osm0sis

EAS related features:

- EAS implementation patched up to latest CAF state

- disable autogroups and use cgroups for more efficient task placement!

- Dynamic Stune Boost to inflate task utilization and not overload cores on interaction (thanks to @RenderBroken, @joshuous and @tbalden for the rootless implementation )

- updates from kernel/common

CPU related features:

- Change various drivers (WLAN, MM, audio, charger, power, thermal, glink etc) to user power efficient workingqueues. This compliments EAS

- include cpuidle patches from CAF

- improvements to cpufreq/times/stats

- improve memory allocations in binder driver

GPU related features:

- GPU driver updated to latest CAF-State

- remove POPP functionality from GPU driver to avoid constant fight about downscaling with msm-adreno-tz

- don´t wake the gpu on touch input, instead wake when receiving an ioctl

- don´t copy fence names by default to save a bit of cpu-time (explanation)

- msm: kgsl: Stop slab shrinker when no more pages can be reclaimed

File System related features:

- improve memory allocations in sdcardfs

- improve eventpoll logging to stop indicting timerfd (improves kernel wakelock readability)

- improve memory allocations in kernfs

- writeback: hardcode dirty_expire_centisecs=3000 based on this commit

UI/UX/Usability related features from CleanSlate:

- CleanSlate features made by @tbalden

- Flashlight Notification/Call blinking

- Vibrating Notification Reminder

- Sweep to Sleep touchscreen gesture - highly customizable

- DoubleTap on Sweep2Sleep's area gestures - new way to pull down android Notification Area

- Face down screen off - new gesture

- Backlight Dimmer - possibility to use lower panel brightness (switch DC dimming off in Lab settings!)

- KCAL Color Control (credit to @savoca)

Network related features:

- Wireguard Support (Details)

- advanced TCP algorithms enabled

- includes new bbr and bbr2

Memory related features:

- Speculative Page Faults left enabled (1. 2) (CAF default)

- various fixes for PSI-Monitor, which is used by the userspace lowmemorykiller-daemon

- Fix various memory leaks in different subsystems

- improved mm with patches from mainline

- various other changes from mainline

- included zstd as an option for ZRAM-algorithm (lz4 is probably the best all around, so only change it if you know why and what you are doing)

- improve memory allocations in various subsystems

Security related features:

- Control-Flow-Integration (CFI) and Link-Time-Optimization (LTO) ported from 4.19 kernel/common and Pixel 4/XL Kernel

- Use ThinLTO which was first used in the Pixel 4 XL Android R-Kernel instead of full LTO

- fix various CFI-Violations found in various subsystems like OnePlus drivers and qualcomm drivers

- enable init_on_alloc for even more security, more information can be found in the commit message

Misc Features:

TCP Congestion Algorithms:

- advanced algorithms enabled, enable them with your favorite kernel manager

- includes new bbr2

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:

- 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

- add support for steam controller

- add support for nintendo switch controller

Feature section for the "non visible" but perceptible improvements:

- updated binder section (responsible for interprocess communication)

- updated sdcardfs ; have a read about it here:

Requirements

- unlocked Bootloader

- USB-Debugging in developer options enabled

- latest adb and fastboot binaries

- working adb and fastboot environment

- magisk root

How to flash the Kernel:

1. Download the latest kernel.zip and make sure you have properly updated to the latest matching OnePlus firmware. When OOS receives an update it takes OnePlus 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.

1a. Optional: While it may not be necessary all times, you may want to restore stock boot.img, re-root with magisk and optionally install twrp.zip if coming from another kernel. Before reporting issues make sure you do that! Thank you!

2. Make sure to use latest Magisk-stable, if you choose to use Magisk.

3. Flash the kernel.zip via latest EXKM or FKM app, or TWRP (haven´t tested TWRP myself as I don´t need it) and do a full reboot.

4. Reboot and profit.

DOWNLOAD:

Download is located always in this folder:

https://www.androidfilehost.com/?w=files&flid=313864

Important: Read after Download

Please take a look at the second post after flashing the kernel!

Changelog:

Android 10

1.0.0 Initial Release

1.2.0 https://xdaforums.com/showpost.php?p=83260487&postcount=67

1.2.2 https://xdaforums.com/showpost.php?p=83521551&postcount=119

1.2.4 https://xdaforums.com/showpost.php?p=83539543&postcount=125

Donations:

Donations are not mandatory but very welcome if you want to support development or just buy me a coffee :)

If you like my work: http://paypal.me/freak07

Credits:

@osm0sis for all his work, including the ak3 installer!

[MENTION=3088420]tbalden[/MENTION] for being the best HTC wingman!

[MENTION=398245]LeeDroid[/MENTION] and @mwilky for their awesome roms and work!

[MENTION=1162986]Captain_Throwback[/MENTION] for all the mentoring and guidance!

[MENTION=5687366]Eliminater74[/MENTION] for bringing me into the game and the Inspiration

[MENTION=6842057]nathanchance[/MENTION] for his upstream guidance and assistance

[MENTION=5438598]RenderBroken[/MENTION] for helping me out

[MENTION=4684315]flar2[/MENTION] for all his work

[MENTION=6745491]joshuous[/MENTION] for all the help he provided to me in the past!

@arter97 for giving me advice

@kdrag0n for his help too

@topjohnwu for magisk!

XDA:DevDB Information

Kirisakura Kernel, Kernel for the OnePlus 8 Pro

Contributors

Freak07

Source Code: https://github.com/freak07/Kirisakura_OP8PRO_InstantNoodle

Kernel Special Features:

Version Information

Status: Stable

Created 2020-06-19

Last Updated 2020-09-20