[kernel][v3.5] leanKernel: minimalistic kernel (1/28/16)

Search This thread


Senior Member
Oct 2, 2009
Redmi Note 10 Pro
Bonus Calibration - D7400K
While the reference calibration looks great in controlled lighting we tend to use our phones in several bright conditions. As a result you may be drawn to a slightly cooler color temperature of D7400. Note - I believe Apple calibrates the iPhone 6 displays to this temperature.

I obtained this with the following settings:
Red - 237
Green - 235
Blue - 255

Hi :) I'm on AICP 8.0, getting these color values in thousands, how to get similar result with these values, any idea?


  • Screenshot_20171113-084736.png
    85.6 KB · Views: 375
  • Like
Reactions: tathanhlam66

Top Liked Posts

  • There are no posts matching your filters.
  • 230
    [kernel][v3.5] leanKernel: minimalistic kernel (1/28/16)

    leanKernel is not for everyone.

    My philosophy is to keep the kernel footprint as small as possible by trimming as much fat as possible, and at the same time keeping it stable, power efficient, and fast. leanKernel is designed to be a drop in replacement for stock kernel, and so it tries not to deviate too far from stock.

    You will find that it's lacking some of the bells and whistles of other custom kernels, so if you like features you came to the wrong thread. :)

    Here's a longer post on what leanKernel is about.

    Also folks, please read the FAQ before asking questions.

    If you like to stay as close to stock as possible: 1) Download and flash the normal leanKernel build here (find the latest zip file) in recovery. 2) Reboot and enjoy better performance and battery life (hopefully). That's it! There's no need to flash stock kernel first, or to wipe caches.
    If you like to customize, read through the feature list below, the FAQ (post #2), the changelogs, and optionally the entire thread. Then you'll know what to do. :)

    DOWNLOAD (flash in recovery)
    v1.x is for Android 5.0, and v2.x is for Android 5.1

    Unlocked bootloader, custom recovery installed

    Push bullet channel: imoseyon

    • custom voltage control - use your favorite app
    • updated to latest 3.10 Linux
    • interactiveX - screen_off_maxfreq support (default 2.2Ghz)
    • sw crypto drivers updated (to use arm NEON instructions) for better encryption/decryption performance. Sequential 180MB/s reads, 60MB/s writes (using dd)
    • latest Linaro gcc 4.9 toolchain (optimized for a15 - thanks to Christopher83)
    • fat trimmed and various performance tweaks
    • f2fs support (updated to latest source from Samsung)
    • force encryption turned off (changed to encryptable)
    • overclocked to 2.9ghz (experimental - available as a separate build for now)
    • underclocked to 223mhz (experimental - available as a separate build for now)
    • Async Fsync
    • init.d support
    • cpu-boost control - enable/disable via lkconfig
    • lkconfig script for customizing leankernel (open terminal app, become superuser, then type "lkconfig" without quotes)
    • patched mpdecision to prevent changing min/max freq provided as flashable zip (in util directory)
    • color control (thanks to @savoca)
    • charging led support
    • a lot of unnecessary stuff removed from stock kernel
    • some components updated to Linux 3.18
    • random generation optimization including e/frandom support
    • pc/usb charging with boosted current ~300-400mA
    • some selinux fixes, selinux is enforced by default - staying true to stock (you can easily disable using lkconfig)
    • SLUB allocator updated to Linux 3.18
    • wake gesture control from flar2, modified for leankernel (also disabled in-call)
    • vibe strength control
    • much of the code is up to date with latest from CodeAurora
    • (mostly for devs) /sys/module/selinux/parameters/force_audit sysfs node to audit all/hidden selinux denies.
    • power aware cpu scheduling
    • faux sound enable/disable by sysfs (and lkconfig)
    • wakelock control (smb135x, wlan_rx, msm_hsic and sensor_ind)
    • leanKernel core control script
    • user option to prevent mpdecision/msm_thermal from changing min/max frequencies: frequency mitigation preventer
    • supports kexec for multirom

    You can use lkconfig script to make custom changes to leanKernel (along with popular apps like Kernel Tweaker and Trickstermod). To run lkconfig, open terminal app, "su" (without quotes) to become superuser, enter, and then type "lkconfig" without quotes, then enter.
    shell@shamu:/ $ su
    root@shamu:/ # lk
    leanKernel configurator
    0) display current settings
    1) cpu frequency control
    2) wake gesture control
    3) wakelock control
    4) charging led
    5) rgb/picture control (advanced)
    6) rgb/picture control (simple)
    7) vibe strength
    8) power saving mode for cpu scheduler
    9) faux sound control
    10) selinux mode
    11) min/max freq change prevention
    21) check top 10 wake locks (ie. wakeup sources)
    please enter a number (or press enter to exit):


    Thanks to @guitarshredder87, @Wera750, @akellar, and @grisha1 for testing test builds!

    XDA:DevDB Information
    Leankernel: Minimalistic Kernel, Kernel for the Nexus 6

    Source Code: https://github.com/imoseyon/leanKernel-shamu

    Kernel Special Features:

    Version Information
    Status: Stable

    Created 2014-11-26
    Last Updated 2016-01-31
    Color Calibration!

    I had a chance to use my X-rite i1 Pro meter ($1000) and Calman software to calibrate the color temperature on my Nexus 6 today. I'm a big home theater display calibrator and spent a part of my life doing it professionally.

    A quick overview - When equal parts of Red, Green and Blue are applied you obtain a neutral gray or what's called D6500k. This is the "reference" white point at which content is produced. If you're very much into photography or video creation you're well aware of this concept.

    Disclaimer - The following results are taken with my Nexus 6. Production differences and factory calibrations means your results will most definitely vary.
    Stock measurements
    My Nexus came out of the box with warmer than reference temperatures. This can be perceived as a bit "yellow" to some people. You can see from the graph below that there's not enough Blue which is causing the warmer D6200 color temp.


    I started dialing in the display using 50% brightness and 60% IRE gray pattern.

    Reference Calibration
    I obtained this using the following RGB settings:
    Red - 248
    Green - 246
    Blue - 255

    You can see that R/G/B line up perfectly and create a perfect shade of gray and D6500K


    Bonus Calibration - D7400K
    While the reference calibration looks great in controlled lighting we tend to use our phones in several bright conditions. As a result you may be drawn to a slightly cooler color temperature of D7400. Note - I believe Apple calibrates the iPhone 6 displays to this temperature.

    I obtained this with the following settings:
    Red - 237
    Green - 235
    Blue - 255

    Results are shown below:



    If you have an application that can set RGB profiles the above settings are a good starting point. If you're in controlled lighting and want to do critical movie or picture viewing obviously the D6500k setting is for you. However I generally recommend the D7500k setting for all other use cases.

    Thanks and enjoy!
    Color Calibration Part Deux

    Got a chance to calibrate the display for a few hours and here's what I came up with

    Reference Calibration
    Goals - As close to reference as possible. D6500k color temperature and natural colors
    Calibration notes - Unfortunately the color controls don't help in reigning in the over-saturated primary colors. I had the best luck tuning the tint control enough to help the primary colors (R,G,B) with a small sacrifice in the secondaries.

    If you've become accustomed to the color "pop" of the N6 OLED screen, the saturation setting of 20 might seem a bit washed out at first. I encourage you to give it some time to adjust to a natural setting. However in the end everyone's different so treat this setting as your "season to taste".

    Red: 250
    Green: 250
    Blue: 255
    Saturation: 20
    Value (Gamma): 123
    Contrast: 128 (default)
    Hue: 1515

    Color Before:

    Color After:

    Color temperature:



    Cool color setting
    Goals - Cooler D7500 temperature with a bit more "pop".

    Red: 232
    Green: 228
    Blue: 255
    Saturation: 26 (again season to taste)
    Value (Gamma): 126
    Contrast: 128 (default)
    Hue: 1515

    Color temperature:


    Enjoy everyone!

    I'm having trouble waking the phone sometimes. Help!
    We haven't really figured out exactly what's causing it - but there seems to be evidence that it's not limited just to leanKernel. One thing to try: if your ROM has a feature that prevents accidental wakeups, disable it!

    I can't seem to get min and max freq to stick! What are these mpdecision zip files in the util directory?
    * Read this post: http://forum.xda-developers.com/showpost.php?p=58135730&postcount=1474
    * Short version: This is actually by design of mpdecision. If you want this behavior to change, I recommend that you 1) flash latest stable leankernel, 2) flash the custom no-freq mpdecision, and then 3) disable cpu-boost via lkconfig. Do not disable mpdecision if you go this route. Also, if you flash ROM, you must re-flash custom mpdecision. To go back to normal, flash the stock mpdecision file.. Launch lkconfig, choose core control, and choose one of the options in core control.

    Will flashing leankernel decrypt my phone storage?
    If you're already encrypted, then it will stay encrypted after flashing kernel, *until* you format data. Once you format you will stay decrypted until you decide to encrypt again (see below). If you're already decrypted, leanKernel will not force encrypt automatically.

    What do I do to encrypt again?
    There are several ways to do this. One way (easiest for me at least) is to adb in (or in terminal emulator):
    root@shamu:/ # start encrypt
    You will see the phone hot boot and once it comes up you will be encrypted again. Keep in mind that if you want to decrypt again you'll have to wipe.

    How do I check the PVS BIN of my cpu?
    root@shamu:/ # cat /proc/cpu/msm_acpu_pvs
    The number you get should range between 0 and 15 (inclusive). If you ended up with 15 congratulations. If you ended up with 0, go get it exchanged! :) Stock frequency/voltage table: http://pastebin.com/ZyGA9Tec

    Which kernel control app do you recommend?
    When v1.0 gets released it should come with "lkconfig" for tweaking some of the options. Otherwise, I tried Trickster and KernelTweaker, and they both seem to work ok.

    What are ondemandX and interactiveX?
    ondemandX and interactiveX are very very close to "stock" ondemand and interactive governors, respectively. The only difference is screen_off_maxfreq sysfs support. This means that it gives you the ability to limit phone's max frequency when screen is off. This feature could be effective in reducing battery usage, especially if you have a misbehaving app (or two) that consume cpu cycles while screen is off. The default value is 2265600 - if you change the value to your top speed you're effectively disabling the feature and restoring stock behavior completely. You can use an app like Trickster or Kernel Tweaker to modify screen_off_maxfreq.

    HELP! I messed up with lkconfig - how do I go back?
    Do not fret. Flash lkconfig_cleaner.zip from the "util" directory.
    (If you want to do this manually), reboot the phone into recovery, mount /data, and delete everything in /data/data/leankernel. Once things are back to normal, re-run lkconfig to re-do your settings.

    What is cpu-boost?
    Read this post: http://forum.xda-developers.com/showpost.php?p=57215289&postcount=535

    What is the best RGB setting?
    http://forum.xda-developers.com/showpost.php?p=57265483&postcount=620 (old)
    http://forum.xda-developers.com/showpost.php?p=59092146&postcount=3017 (new)

    What is power aware scheduling?
    Read this post: http://forum.xda-developers.com/showpost.php?p=58313978&postcount=1651
    leanKernel philosophy

    Ok I think it's time for this post. :)

    Those of you who used my kernels in the past on thunderbolt, gnex, galaxy s3, note 3, nexus 7, etc. already know what leanKernel is all about.

    I develop leanKernel *almost* in a total vacuum. I rarely ever look at other devs work, nor do I visit their threads. In fact, I don't even know who most of them are. It's been this way for years (yes i've been doing this for a while). The only time I ever collaborated with another community dev was with @franciscofranco - great guy, I highly recommend his kernels if you're not on leanKernel.

    This is what makes leanKernel unique. Aside from my usual desire to keep the experience as stock and as lean as possible, I didn't want leanKernel to be like other kitchen sink custom kernels out there. This also limits leanKernel users obviously, as it's targeting a smaller niche group of users. I believe android kernels actually should do as little as possible, and let the ROMs do their thing, but at the same time there are tons of enhancements are optimizations that can be done to stock kernel.

    I have a very demanding full time job (I work with Linux) and a family, so this philosophy actually kinda works out for me due to my limited time for kernel development. :)

    So what does this mean? I encourage everyone to try other custom kernels - tons of great smart devs out there like faux, franco, flar2, etc (especially on a nexus device). I think a lot of you will come back to lean. :D