Development [r12] arter97 kernel for OnePlus 9 series

Search This thread

NinoLatif

Member
Mar 10, 2018
43
14
I did not. I didn't know that needed to be a thing. It just ended up bootlooping after going back. Flashing stock boot and formatting didn't help. Tried flashing fastboot stock and that hard bricked it
Reboot to bootloader and reboot to fastboot. Next boot TWRP img file through adb fastboot tool as command: fastboot boot (drag img) [press enter]..

TWRP : https://androidfilehost.com/?w=files&flid=326293

Soon you'll be on TWRP recovery and do press the (advanced) button left below, reboot to EDL while you have already opened the MSM tool and have chosen O2 instead of Target above. As soon as the tool says COM is connected, press start and wait for a while. Your phone shall be new as it was. You need to unlock OEM again. Greetings

Get the file here: https://www.droidwin.com/unbrick-oneplus-9-pro-msm-download-tool/

Do choose the Global version if you want to be the first to get the updates.
 
  • Like
Reactions: Samuel Holland

arter97

Recognized Developer
Oct 14, 2012
3,802
34,150
24
Seoul
Another alpha build is up.
You should now be able to use more apps without reloading.

This build will now start to override ROM files using execprog (meaning it's still systemless).
The most notable ones are zram and optimized cpuset.

In theory, this build should consume much less power than previous builds with hopefully unnoticeable degradation in performance.

r1a8

Swap/zram enabled
zram writeback enabled (see here for more info)
zram/zsmalloc backported from mainline Linux
Display-related processes' CPU affinity adjusted for better power efficiency
Readahead optimized
 

gorilla p

Recognized Contributor
Nov 30, 2011
3,677
2,838
Milwaukee
Xiaomi Mi Pad 4
OnePlus Nord N10 5G
Reboot to bootloader and reboot to fastboot. Next boot TWRP img file through adb fastboot tool as command: fastboot boot (drag img) [press enter]..

TWRP : https://androidfilehost.com/?w=files&flid=326293

Soon you'll be on TWRP recovery and do press the (advanced) button left below, reboot to EDL while you have already opened the MSM tool and have chosen O2 instead of Target above. As soon as the tool says COM is connected, press start and wait for a while. Your phone shall be new as it was. You need to unlock OEM again. Greetings

Get the file here: https://www.droidwin.com/unbrick-oneplus-9-pro-msm-download-tool/

Do choose the Global version if you want to be the first to get the updates.
Thank you for attempting to assist. Unfortunately, it is beyond that point now. After attempting the fastboot ROM flashing to restore, nothing will come on the screen. I'm playing the MSM Tool game now, but repeatedly getting "Device not match image" after starting. Tried EU, IN, Global, all same result.
 

xontax

Senior Member
Dec 17, 2011
224
41
  • Like
Reactions: najahiii

abduleo77

Senior Member
Mar 27, 2011
257
21
Samsung Galaxy S22 Ultra
FLashe r1a8 over r1a7 through FKM and now my phone won't work. It boots to lock screen but I cannot enter my passcode and then it reboots to boot loader. How could going from one version of this kernel to the next cause so much damage? I am on vacation and without a computer to fix it.
 

freddienuxx

Senior Member
Dec 11, 2012
1,672
338
Google Pixel 6 Pro
Thank you for attempting to assist. Unfortunately, it is beyond that point now. After attempting the fastboot ROM flashing to restore, nothing will come on the screen. I'm playing the MSM Tool game now, but repeatedly getting "Device not match image" after starting. Tried EU, IN, Global, all sam

Thank you for attempting to assist. Unfortunately, it is beyond that point now. After attempting the fastboot ROM flashing to restore, nothing will come on the screen. I'm playing the MSM Tool game now, but repeatedly getting "Device not match image" after starting. Tried EU, IN, Global, all same result.
open open up msm tool for your device target 2 click light firehouse then hit start on msm tool. then put your device into edl mode. then it should work
 
  • Like
Reactions: Shooter7889

gorilla p

Recognized Contributor
Nov 30, 2011
3,677
2,838
Milwaukee
Xiaomi Mi Pad 4
OnePlus Nord N10 5G
open open up msm tool for your device target 2 click light firehouse then hit start on msm tool. then put your device into edl mode. then it should work
Still not working. I tried that with every msm tool available. The only one that worked was OP9 Pro India.
Now I'm running the OP9 Pro India image and need to get back to OP9 GLobal. I have tried using the MSM tool go get back to it, but I keep getting the same thing I was getting when trying to use the correct MSM tool before "Device not match image".

Update: Once on the India OP9 Pro image, I was able to flash the full OTA zip via TWRP for my correct device. It looks like I'm on the right track now.
 
Last edited:

freddienuxx

Senior Member
Dec 11, 2012
1,672
338
Google Pixel 6 Pro
Still not working. I tried that with every msm tool available. The only one that worked was OP9 Pro India.
Now I'm running the OP9 Pro India image and need to get back to OP9 GLobal. I have tried using the MSM tool go get back to it, but I keep getting the same thing I was getting when trying to use the correct MSM tool before "Device not match image".
try vol+ and power for ~20 sec
 

arter97

Recognized Developer
Oct 14, 2012
3,802
34,150
24
Seoul
r1a10 is up. (r1a9 is skipped as an internal build)

This build now drastically changes the file-system code, bringing it from v5.4 to v5.15 (mainline Linux) with 13K code line changes.

While I expect it to be stable, there might be a possibility that it may end up causing incompatibilities with the OnePlus 9's encryption code.

So please, back up your data before using this build if you haven't already.

Another notable change is that the USB OTG and Type-C audio jack is also fixed.

r1a10

Merged the latest Qualcomm LA.UM.9.14.r1-18300-LAHAINA.0 tag
Fixed USB OTG and Type-C audio jack
Merged the mainline f2fs from Linux v5.15
 

GolovaRaoul

Senior Member
Nov 18, 2018
50
15
Screenshot_20210924-200750.jpg
Its better then stock OnePlus kernel for me, feels way more 'snappy' and battery lasts around an hour longer for me. Great work, thanks!
 

tathagatab

Senior Member
Dec 31, 2014
426
188
Kolkata
OnePlus 9 Pro
Before installing this kernel, I used

"dd if=/dev/block/by-name/vendor_boot_a of=/sdcard/disk_images/vendor_boot_a.img"

and so forth to back up my partitions.

Now I have

boot_a.img
boot_b.img
vendor_boot_a.img
vendor_boot_b.img
dtbo_a.img
dtbo_b.img

Is this adequate? If so, can I use dd to restore the partitions while the phone is running? Is there any particular order in which they must be restored?

And how do I know whether I'm currently on A or B? I want to keep that set and delete the other.
 

noobzayt

Member
Aug 17, 2019
13
3
So, what worked for me to flash back to stock kernel.... Make sure to use the images from your current rom version.

In bootloader
Flashed boot.img
Flashed dtbo.img
and finally flashed vendor_boot.img

I haven't had an issue.
Hope this can help someone so no one else has another bricked phone.
How do we flash backed up images? From fastboot or in an app?

If it is fastboot, can you please share the command lines?
 

bsimpson1

Senior Member
Jun 16, 2013
275
85
Is it possible with this kernel to bypass the battery and use the charger for AC power? I think they call it "Battery Idle Mode" in the Advanced Charging Controller app.

The stock kernel on the OP7 Pro had this feature accessible from sysfs under "battery/op_disable_charge" and "battery/input_suspend"
 

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    A major new testing release is up.

    Changes made in this round is big enough that I've decided to name it r20.

    While the build has been stable for me, I'm marking this an alpha as a lot changed.

    r20a1 marks the first Linux v5.4 based kernel to have MGLRU backported.

    MGLRU is a big deal in everything Linux related, especially for Android.
    Esper have a great article on what is MGLRU in a nutshell: https://blog.esper.io/android-dessert-bites-22-linux-memory-management-38419756/

    TL;DR:
    According to Google’s fleetwide profiling, multi-generational LRU yields an “overall 40% decrease in kswapd [the kernel daemon that manages virtual memory] CPU usage,” an “85% decrease in the number of low-memory kills at the 75th percentile,” and an “18% decrease in app launch times at the 50th percentile.”

    Personally, I've noticed a sharp decrease in swap usage and improvements in general performance.

    Besides MGLRU, there are other numerous patches that are worth noting.

    I've brought back updated arm64 routines that were once tried in a beta release but removed later due to random kernel panics (mostly notable from Netflix). The mainline Linux kernel have gotten new updates since then, so r20a1 includes that.
    Also, some memory patches made by Sultan are also picked, and I've confirmed that those also help improving responsiveness.

    With all these memory stuffs going on, I've also changed swap/zram's parameters. You'll notice a difference in how many apps you can keep open, etc.

    The excessive RMNET_DFC wakelock that annoyed some users are now also gone by incorporating a fix from Snapdragon 8 Gen 1.

    All in all, this is indeed a pretty big release.
    I'm expecting mixed feedback, so please let me know how the new kernel behaves.

    /* Full changelog */

    Backported MGLRU
    Fixed full system crash on some custom ROMs (by LibXZR)
    Added a few memory patches to improve responsiveness (by Sultan)
    Tuned swap/zram configurations
    Backported updated arm64 memory functions for better performance
    Fixed excessive RMNET_DFC wakelock
    Fixed OnePlus charging code to handle worker failure
    Backported more BFQ commits from mainline
    Backported mm/mremap fix from mainline
    Latest WireGuard merged
    LA.UM.9.14.r1-19400-LAHAINA.QSSI13.0 merged
    Linux v5.4.190 merged
    Wi-Fi drivers updated to 2.0.8.28K
    2022-04-05 security patch merged
    Latest f2fs from Linux v5.18 merged
    Now built with the latest Clang 14.0.5
    Device-tree updated to LA.UM.9.14.r1-19300-LAHAINA.QSSI13.0
    8
    r20a4 is up.

    Some bug fixes here and there and continued testing for memory management.
    7
    New alpha build r20a2 is up.

    Due to some memory issues causing major lags, I've decided to revert MGLRU for now and take r20 alpha rounds to debug more memory-related issues.
    Simple LMK by Sultan (kerneltoast) is back to speed up memory debugging.

    Please consider joining the Telegram group and sending feedback/logs.

    Thanks.
    2
    Is it just me, or does anyone get this weird bug when sometimes I turn off Wi-Fi and make use of mobile data, a process/script(?) called clatd-rmnet_data1 -i rmnet_data1 -m 0xf0075etc. (it's longer but I omitted it) runs in the background at full CPU speed when checking top -m 10, making the phone heat up super fast and drain the battery? It happens sometimes when turning off Wi-Fi, but always happens everytime after going to bed and waking up seeing my phone at 1%, or when charging overnight I see it super hot and phone threw the overheating notice at one point. I'm on latest OOS11 if that matters.
    2
    I had this Problem too. In my case the solution was to reset the CR-Droid Settings to default. The icon at the top right (see screenshot). After the reset i've never seen this bug again.
    It's unfortunate but I already switched over to DerpFest. They are both very fast ROMs and benchmark the exact same, but DerpFest I haven't had any issues and it just has more features.
  • 54
    arter97-xda.png



    arter97 kernel for OnePlus 9 series running OxygenOS

    /* Features */

    Supports OnePlus 9 series
    Fully rebased kernel without unnecessary OnePlus code
    Latest CAF msm-5.4 kernel fully merged
    Latest Linux v5.4 subversion merged
    Latest Google’s security fix merged
    BBR as the default TCP network congestion control
    Features the latest WireGuard
    Modules support disabled for lighter kernel
    Latest Wi-Fi drivers from Qualcomm with customized config
    Built with Clang 13 and ThinLTO
    Power optimizations
    Memory management optimizations
    Latest SELinux subsystem backported from mainline
    Latest f2fs backported from mainline
    Latest BFQ I/O scheduler backported from mainline
    mmap/mremap backported from mainline for a major performance boost
    Touchscreen optimizations for lower latency
    Uses LRNG for better performance

    /* Details */

    - Fully rebased kernel without unnecessary OnePlus code -



    This kernel is not based on the stock OxygenOS kernel source provided by OnePlus. Instead, it’s based on the latest and greatest Qualcomm has to offer. Only the necessary parts from the OnePlus kernel have been cherry-picked, such as OnePlus 9 specific device drivers.

    This effectively kills all kernel modifications/optimizations from OnePlus, including the infamous app throttler.
    Due to the completely different base, this kernel will behave drastically different from other kernels, in both good and bad ways.


    - Power optimizations -


    This kernel makes some conscious decisions for reducing power consumption.

    First, the stock OnePlus configuration forces display-related processes to use the big cores exclusively.
    This configuration brings a huge power regression since it makes every frame dispatch to wake up and use the power-hungry cores.

    This kernel resets this profile to use the configuration Google recommends, which is to use the LITTLE cores exclusively instead. (Reverted in r2 as it seems like that little cores aren't enough to drive 120 Hz fluidly.)
    This kernel allows these processes to use little and middle cores (0-6), depending on the load.

    Second, this kernel disables wakelocks upon Wi-Fi’s RX unicast packet transmissions. qcom_rx_wakelock is one of the major culprits to increased idle power consumption. Although its total wakelock time is quite low, it's catched very frequently and prevents the system from entering suspend repeatedly.

    As dropping unicast or local ARP packets doesn’t pose practical issues on Android, this kernel disables qcom_rx_wakelock.

    Third, this kernel reduces the duration of the Bluetooth ISR wakelock from 2 seconds to 100ms. This was done from an observation that the average userspace response time from ISR is less than 10ms.
    My kernels have been doing this for years and no Bluetooth-related issues were reported.

    Fourth, the vibrator driver used in this kernel no longer controls the cpuidle driver. The stock kernel disables the cpuidle whenever the vibrator is used. This kernel disables it as the vibrator is not that sensitive to deadline misses.

    There are other small improvements throughout the kernel tree as well.


    - Memory management optimizations -


    This kernel disables LMKD and uses an in-kernel solution called SimpleLMK, made by kerneltoast. You can track how often SimpleLMK kicks in by monitoring:
    Code:
    /sys/module/lowmemorykiller/parameters/lmk_count

    This kernel also changes a lot related to swap and zram.

    The swap-related code has been backported from Linux v5.9 (link1, link2) to efficiently support fast swap device and allow swappiness over 100. This kernel currently sets swappiness to 160 on < 6GB of RAM, 120 on 8GB and 90 on 12GB.

    zram has been also backported from mainline Linux and further tweaked to use block device writeback. This is equivalent to the recent “RAM Plus” feature that companies have been marketing that uses the internal storage to extend RAM.

    This kernel uses zram writeback to offload idle pages (i.e., really, really unused RAM) to the internal storage. As it's extremely slow to bring pages back from UFS, writeback code works quite conservatively. It'll start to writeback pages that haven't been used for a day or two. It makes use of the hidden 2GB “last_parti” partition from the UFS storage.

    Along with zram writeback, this kernel also enables deduplication with xxHash. Each page stored in zram is checked for deduplication to further save memory. With these 2 features combined, RAM reaching 1GB is additionally saved, but your mileage may vary.

    The post boot script used in the stock ROM is also overridden and it sets the readahead to 128KB. As I/O workload under Android is mostly random, high readahead doesn’t help and only increases memory thrashing.

    This kernel also incorporates a lot of patches to reduce/optimize memory allocations used throughout the entire kernel.

    mmap/mremap code was also backported from Linux v5.10 to optimize ART (see here for more info).


    - Latest subsystems -


    This kernel backports the SELinux subsystem from mainline Linux. This includes caching improvements that drastically reduces time spent on lookups. 10K lines of code has been changed.

    This kernel also backports f2fs (Flash-Friendly File System) from mainline Linux. This includes bug fixes and performance improvements such as shorter discard latency, more optimized GC logic for Android, and checkpoint merging.

    BFQ I/O scheduler has also been backported from mainline Linux for better I/O performance.


    - LRNG -


    This kernel ditches the traditional RNG driver from the Linux kernel in favor of LRNG. See here and here for more info.

    A rudimentary throughput benchmark shows an improvement of 10.5% (keep in mind that this is only one aspect of an RNG metric).


    /* Notice */

    OxygenOS 12 is unsupported.
    Non-OxygenOS custom ROMs are supported, but your mileage may vary wildly. Most notably, gesture orientations on some ROMs may be inverted.

    This kernel touches vendor_boot and dtbo partitions, meaning you'd need to restore said partitions whenever you're switching to another kernel or stock.
    Please make a back-up of these partitions. The installer doesn’t do this automatically for you. Installing the stock ROM with a full OTA restores said partitions as well.

    /* Disclaimer */

    Your warranty is now void.
    I am not responsible for bricked devices, dead SD cards,
    thermonuclear war, or you getting fired because the alarm app failed. Please
    do some research if you have any concerns about features included in this kernel
    before flashing it! YOU are choosing to make these modifications, and if
    you point the finger at me for messing up your device, I will laugh at you. Hard. A lot.

    /* Thanks to */

    Vishalcj17
    kristofpetho
    kdrag0n
    kerneltoast (SultanXDA)

    /* Instructions */

    1. Read the above. Please.
    2. Flash the zip file from FK Kernel Manager. Any other installation methods are untested.

    /* Downloads and links */

    arter97.com
    Kernel source
    Telegram chat link
    18
    A major new testing release is up.

    Changes made in this round is big enough that I've decided to name it r20.

    While the build has been stable for me, I'm marking this an alpha as a lot changed.

    r20a1 marks the first Linux v5.4 based kernel to have MGLRU backported.

    MGLRU is a big deal in everything Linux related, especially for Android.
    Esper have a great article on what is MGLRU in a nutshell: https://blog.esper.io/android-dessert-bites-22-linux-memory-management-38419756/

    TL;DR:
    According to Google’s fleetwide profiling, multi-generational LRU yields an “overall 40% decrease in kswapd [the kernel daemon that manages virtual memory] CPU usage,” an “85% decrease in the number of low-memory kills at the 75th percentile,” and an “18% decrease in app launch times at the 50th percentile.”

    Personally, I've noticed a sharp decrease in swap usage and improvements in general performance.

    Besides MGLRU, there are other numerous patches that are worth noting.

    I've brought back updated arm64 routines that were once tried in a beta release but removed later due to random kernel panics (mostly notable from Netflix). The mainline Linux kernel have gotten new updates since then, so r20a1 includes that.
    Also, some memory patches made by Sultan are also picked, and I've confirmed that those also help improving responsiveness.

    With all these memory stuffs going on, I've also changed swap/zram's parameters. You'll notice a difference in how many apps you can keep open, etc.

    The excessive RMNET_DFC wakelock that annoyed some users are now also gone by incorporating a fix from Snapdragon 8 Gen 1.

    All in all, this is indeed a pretty big release.
    I'm expecting mixed feedback, so please let me know how the new kernel behaves.

    /* Full changelog */

    Backported MGLRU
    Fixed full system crash on some custom ROMs (by LibXZR)
    Added a few memory patches to improve responsiveness (by Sultan)
    Tuned swap/zram configurations
    Backported updated arm64 memory functions for better performance
    Fixed excessive RMNET_DFC wakelock
    Fixed OnePlus charging code to handle worker failure
    Backported more BFQ commits from mainline
    Backported mm/mremap fix from mainline
    Latest WireGuard merged
    LA.UM.9.14.r1-19400-LAHAINA.QSSI13.0 merged
    Linux v5.4.190 merged
    Wi-Fi drivers updated to 2.0.8.28K
    2022-04-05 security patch merged
    Latest f2fs from Linux v5.18 merged
    Now built with the latest Clang 14.0.5
    Device-tree updated to LA.UM.9.14.r1-19300-LAHAINA.QSSI13.0
    18
    r2 is up, and it's a big release.

    Changelog is quite self-explanatory.

    r2
    Display-related processes are now allowed to use the middle cores as well for better smoothness
    Enabled more mremap() performance improvement that was missing from r1
    LA.UM.9.14.r1-18400-LAHAINA.0 merged
    LA.UM.9.16.r1-08100-MANNAR.0 merged
    LA.UM.10.9.1.r1-00300-QCS610.0 merged (contains a lot of new improvements including power optimizations)
    Linux v5.4.159 merged
    Wi-Fi drivers updated to 2.0.8.25M
    2021-11-06 security patch merged
    Watermark boosting disabled to fix aggressive app killings (by Sultan)
    Workaround added to fix unwanted doubles presses from the power button
    15
    After using the kernel myself and daily driving for few days and monitoring how the kernel behaves, I now feel comfortable to mark it stable.

    r1 is released.

    The original post is re-written to feature what's special with this kernel.
    Please take your time and re-read the original post.
    15
    After months of tests, r3 is up and it's a major release that should fixes all major bugs from previous versions and improve performance.


    It turned out that using SimpleLMK causes random soft reboots due to page allocation failures.
    This kernel reverts back to using the stock lmkd until this issue is sorted out.
    You may experience a slight decrease in how many apps you can leave in the background.

    Also, random app crashes and freezes are fixed too.
    This was specific to OxygenOS, which freezes apps with cgroup and expects the kernel to un-freeze them, but with my kernel lacking that feature from OnePlus, using my kernel led to app crashes and freezes.
    This was fixed by forcefully disabling that feature from the kernel.

    Some Bluetooth and USB stuffs were also fixed with this release.


    Bug fixes alone make this a noteworthy release, but it also comes with nice performance improvements.

    With the Qualcomm HDK, I've managed to debug why using Clang 13 leads to boot failures.
    r3 has that issue sorted out and now the kernel uses the latest Clang 13.0.2 instead of 12.

    Read-write semaphore backported from Linux v5.16 will also give some nice latency improvements under heavy I/O.
    These patches are actively being talked in the f2fs mailing list for backporting to older Android devices.

    From Sultan (kerneltoast), r3 also has SLUB per-CPU partial caches disabled for better latency.


    r3
    SimpleLMK disabled for now to fix random soft reboots
    Fixed random app crashes and freezes due to op_cgroup
    Bluetooth drivers re-worked to fix Bluetooth-related issues
    USB malfunctions fixed (dwc3)
    LA.UM.9.14.r1-18900-LAHAINA.0 merged
    LA.UM.10.9.1.r1-00800-QCS610.0 merged
    Linux v5.4.174 merged
    Wi-Fi drivers updated to 2.0.8.26T
    2022-01-05 security patch merged
    Latest WireGuard merged
    Latest f2fs from Linux v5.17 merged
    Latest LRNG v43 merged
    Read-write semaphore backported from Linux v5.16 to improve smoothness under heavy I/O
    Now built with the latest Clang 13.0.2
    Disabled SLUB per-CPU partial caches for better latency (by Sultan)