[KERNEL][MIUI/CM]ZD Kernel || 20160806

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
Code:
#include <std_disclaimer.h>
/*
* 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 ROM
* 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.*/
Features
You get the usual set of well known tweaks, mods and other improvements. Please check commits of the source repo which will be mentioned below for detailed list of changes. The key ones are -
  • Live Kernel flashing with backup support for previous kernel - Liverepack implementation of @psych.half is used, which also backs up your previous kernel (boot.img) and other system files which would be changed.
  • KCAL - A well known display parameters calibration driver for MSM devices, written by @savoca.
  • Dynamic Fsync 1.2 - We all know what it is about, dont we? Credits - @faux123
  • ThunderPlug - A hotplug driver by @varun.chitre15.
  • Kernel Add-on support - For CM based ROM only. More about it in later posts.

More features will be eventually added.
Kernel Adiutor will list 90% of stuff that can be tweaked by the kernel, rest will be mentioned in further posts.

What does not work?
  • Various display tweaks by Xiaomi like Reading mode etc in MIUI ROMs - That is because Xiaomi did not open source that aspect of the kernel. The same will probably not work on any Kernel that is compiled from source. But thanks to KCAL, this tweaks can be worked around, check further posts.
Compatibility
This kernel is only meant to be flashed on lollipop based MIUI 7/8 ROMs.
This kernel is also compatible with Official CM and other similar source based ROMs.

Version naming
I gave up on maintaining proper versions of a kernel, its lot of hard-work. Instead, naming scheme of CyanogenMod and other prominent ROMs has been used, reflected in the zip naming. LOCAL_VERSION will be same for all versions hence we will talk about versions on date of build basis.

Installation
Make sure the ROM on which you are going to flash is compatible. Once done, simply flash it through TWRP.

Reporting Bugs
  • In case an error has occurred during flashing, please report it with /sdcard/liverepack.log.
  • In case of kernel errors, please get me a dmesg.

Feature Requests
I mainly focus on quality rather than quantity. But still, you can request a feature you would like and I will see what can be done.

Download - Here
If you want to download MIUI version, please download the file with no suffix (zd-20160803-kenzo.zip). Suffix will come in the next MIUI update.
If you want to download CM version, please download the file with cm suffix (zd-20150806-kenzo-cm.zip).
Add-ons can be found in Addons folder. Only CM based kernel supports Addons.

Source/ Tools used

XDA:DevDB Information
ZD Kernel, Kernel for the Xiaomi Redmi Note 3

Contributors
corphish
Kernel Special Features:

Version Information
Status: Stable

Created 2016-08-02
Last Updated 2016-08-06
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
Reserved

Kernel Addons
There are certain features which some people want in the kernel, whereas others do not want that at all (they even dont want the feature to be present in the kernel o_O).
So to meet the needs, we would have to maintain to separate kernel builds, one with the feature, one without it.
Which is where kernel add-on comes to play,
Here the users will need to flash the main kernel. Then, if they choose to, they can flash the kernel addon (which generally contains a feature).
If users choose not to, that feature wont be present at all (just as they wanted), whereas for those who flashed the addon, the feature will be present.
It makes lives of both us and users easier, right?
Addons are low in size flashable zips, as the name suggests. You will need to flash addons if you choose to, after flashing the kernel.
Only CM based ROMs support addons, as init.d support is needed, which is not present in MIUI.
Also, by distributing addons, I guarantee that no copyright infringements are made.

Addons available
-Thunderplug

Workaround for Xiaomi's display tweaks
We will use different values for tweaking offered by KCAL. To do that, open Kernel Adiutor and go to 'Screen' page.

Reading mode
Set Blue to 196.

Colour mode: Warm
Set Green to 240, Blue to 208

Colour mode: Cool
Set Red to 208.

You can also tweak contrast values and other stuffs.
If you are not satisfied, feel free to tweak similarly.

Thunderplug
For some reason, TZ app crashes on MIUI, and kernel adiutor does not fully have support for ThunderPlug.
By default, ThunderPlug does sched based hotplugging. Hence stuffs like endurance mode wont work as it only works when hotplugging is done on per-core basis.
To enable hotplug on per-core basis, open terminal and type:
Code:
su
echo 1 > /sys/kernel/thunderplug/hotplug_style
To go back to sched based hotplug:
Code:
su
echo 2 > /sys/kernel/thunderplug/hotplug_style
 
Last edited:

donalberto17

Senior Member
Apr 14, 2014
411
201
0
Obregon
Working great here, thank you, I have one question, Did you implement Adreno idler? Because my gpu is going to 19mhz, and also Can you please explain the sched and per core mods of thunderplug? Thax
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
Working great here, thank you, I have one question, Did you implement Adreno idler? Because my gpu is going to 19mhz, and also Can you please explain the sched and per core mods of thunderplug? Thax
No Adreno idler is not implemented yet.
In sched based hotplugging, the load is shared among cores, there are no practical differences with the stock setup.
In per core basis of hotplugging, cpu cores are only plugged in when its really required, otherwise they are off.

It has the bug of the battery of -2%
dmesg: http://pastebin.com/df8fBgme
Alright, could you tell me when does this happen? When the battery is very low?
And looks like its a well known bug heh?
 

mega-samu

Senior Member
Aug 1, 2011
141
54
0

donalberto17

Senior Member
Apr 14, 2014
411
201
0
Obregon
Well I discovered 2 bugs, when I change the style to per-core basis it doesnt stick after a reboot, another bug is when I change to per-core basis the Fingrepint sensor stops working
 
  • Like
Reactions: Alvaro's

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
The mistake happens after flash the kernel. I think that it is for that xiaomi the new one put in indicator of battery, in the recent xiaomi.
I leave this post you, for if it can use you as help:
http://forum.xda-developers.com/redmi-note-3/how-to/fingerprint-battery-issues-custom-roms-t3429464
Ok. Have you flashed any other ROMs or kernel in which this issue isnt there.
Looks like xiaomi has done quite some changes in kernel since release.

Well I discovered 2 bugs, when I change the style to per-core basis it doesnt stick after a reboot, another bug is when I change to per-core basis the Fingrepint sensor stops working
That change wont persist through reboot, you will have to do it everytime, or perhaps write an init.d script. Not any app supports this toggle which can provide set on boot.
And all I can make from this FP sensor issue when per core basis is it requires like all 6 cores to function, because in stock, I never saw any core go offline.
 

mega-samu

Senior Member
Aug 1, 2011
141
54
0
Ok. Have you flashed any other ROMs or kernel in which this issue isnt there.
Looks like xiaomi has done quite some changes in kernel since release.
In cm13 santosh with the patch camera fix or in mokee official, does not happen to me.
Nowadays I have the miui 8 of xiaomi.eu, that does not happen with the kernel stock either.
 

B!GBOY

Senior Member
Jul 22, 2010
478
409
93
??
Ok. Have you flashed any other ROMs or kernel in which this issue isnt there.
Looks like xiaomi has done quite some changes in kernel since release.
I havn't tried your kernel but as i'm one of people with newer devices that have this problem, i can answer the question :D
mokee rom doesnt have this problem and the camera fix mentioned in here fixes the problem on CM maybe you can take a look and see what is the fix in that file.
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
In cm13 santosh with the patch camera fix or in mokee official, does not happen to me.
Nowadays I have the miui 8 of xiaomi.eu, that does not happen with the kernel stock either.
Alright, I am making a new build and will upload it as soon as its done.
Unfortunately I cant verify whether the battery bug is fixed or not.
Could you flash it and see then?

Thanks both of you for bringing this to my notice.
Let me know if there are any other breakages.

Edit
Here it is - https://www.androidfilehost.com/?fid=24659325368664523
Could you flash this and see? @mega-samu
 
Last edited:
  • Like
Reactions: hasan05 and himfa71

mega-samu

Senior Member
Aug 1, 2011
141
54
0
Alright, I am making a new build and will upload it as soon as its done.
Unfortunately I cant verify whether the battery bug is fixed or not.
Could you flash it and see then?

Thanks both of you for bringing this to my notice.
Let me know if there are any other breakages.

Edit
Here it is - https://www.androidfilehost.com/?fid=24659325368664523
Could you flash this and see? @mega-samu
I have just proved it and it continues the bug.
Edit: The camera does not work


Edit2: In the kernel radon they finish of fix.: http://forum.xda-developers.com/redmi-note-3/development/kernel-t3414884/post68012485#post68012485

Enviado desde mi Redmi Note 3 mediante Tapatalk
 
Last edited:

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
I have just proved it and it continues the bug.
Edit: The camera does not work


Edit2: In the kernel radon they finish of fix.: http://forum.xda-developers.com/redmi-note-3/development/kernel-t3414884/post68012485#post68012485

Enviado desde mi Redmi Note 3 mediante Tapatalk
Alright, could you test yet another build soon?

Edit:
Here you go, this build has same name as previous one but they are different build, separately made and uploaded - https://www.androidfilehost.com/?fid=24591000424951734

Also check whether camera works fine or not @mega-samu
 
Last edited:
  • Like
Reactions: hasan05

sasaboor64

Senior Member
Mar 10, 2013
406
51
0
hyderabad
Workaround for Xiaomi's display tweaks
We will use different values for tweaking offered by KCAL. To do that, open Kernel Adiutor and go to 'Screen' page.

Reading mode
Set Blue to 196.

Colour mode: Warm
Set Green to 240, Blue to 208

Colour mode: Cool
Set Red to 208.

You can also tweak contrast values and other stuffs.
If you are not satisfied, feel free to tweak similarly.

Thunderplug
For some reason, TZ app crashes on MIUI, and kernel adiutor does not fully have support for ThunderPlug.
By default, ThunderPlug does sched based hotplugging. Hence stuffs like endurance mode wont work as it only works when hotplugging is done on per-core basis.
To enable hotplug on per-core basis, open terminal and type:
Code:
su
echo 1 > /sys/kernel/thunderplug/hotplug_style
To go back to sched based hotplug:
Code:
su
echo 2 > /sys/kernel/thunderplug/hotplug_style
if i change to echo1 fingerprint sensor is misbhaving ... one finger works other doenst and also a little bit of irresponsiveness
 

corphish

Recognized Developer / Inactive Recognized Contrib
Apr 16, 2014
1,012
2,448
113
Durgapur
if i change to echo1 fingerprint sensor is misbhaving ... one finger works other doenst and also a little bit of irresponsiveness
Yeah I realized that.
Looks like all CPU cores are needed for it properly function.
As in stock all cpu cores are always on, I never saw anyone go off.
I might remove hotplug in next build.
 
  • Like
Reactions: sasaboor64