Remove All Ads from XDA
Honor 9 Lite

[Kernel][Sense 4] crpalmer | August 25, 2013

2,999 posts
Thanks Meter: 8,278
By crpalmer, Recognized Developer on 7th February 2013, 12:36 PM
Post Reply Email Thread
The goal of this kernel is above all stability with the secondary goals of increased performance and increased battery life. I use this phone for several hours a day for work and therefore it must be reliable. I am not focusing on providing a million options for governors, etc. In addition to those main goals of the kernel, I have an additional secondary goal of removing as much HTC code as possible from the kernel.

This is based on the 2.04 kernel source release from HTC with a huge number of modifications. Thanks to faux123, showp, harsh, mdeejay, zarboz and dsb9938 whose kernels I have pulled some commits from.

The unique features of this kernel are:

New init.d scripts to allow some tweaking without needing any 3rd party apps
* See the next post for details.

Replaced HTC's mpdecision with a new custom hot-plug driver that I created:

* This hot-plug driver is more aggressive about bring cores on and off-line to match the load on the system.
* Bringing cores online earlier makes your phone more responsive / smooth.
* Taking cores offline earlier improves battery life.
* It ramps up very quickly on resume to avoid lag.

Replace HTC's thermald with a new custom thermal driver that I created:

* Unlike all other thermal drivers, it uses "trip-points" to let the phone tell the kernel when it is overheating. The other thermal drivers poll every X ms and read the temperature instead.
* By using trip-points, there is 0 battery consumption unless the phone is overheating.
* By using trip-points, there is an instant reaction to temperature changes.
* It's probably nearly impossible to cause thermal shutdown without being in a desert!

Replaced HTC's bluetooth drivers with Code Aurora Forums (CAF) version.

Replaced HTC's lightsensor table with one that is more sensible and that matches what other devices use. If you have custom auto-brightness settings, you'll probably need to tweak them after installing this kernel.

There are many additional changes to boost performance and battery life:

* Linaro -O3 compiled (Linaro 4.8).
* Overclocking from mdeejay's kernel.
* Underclocking to 192MHz.
* I disable tons of HTC debugging crap left enabled and needlessly consuming battery.
* Improvements to the core locking code of the kernel.
* Patches that transform traditional locks into RCU backed data structures.
* CAF version of the ondemand and conservative governors.
* hsic wakelock changes from dsb9938's kernel.
* CAF changes to power management to sleep faster and waste less CPU during suspend.
* Improved code for moving data to/from user-space and manipulating strings within the kernel.

Other features:

* Include all mainline Linux changes to keep up-to-date on bug fixes.
* Voltage control (faux123) to allow user-space under-volting.
* BFQ I/O scheduler.
* CAF lowmemorykiller.
* Force fast charge.


A link to each version is included in the changelog entry. Scroll down to the changelog to download the latest version.

Source (GitHub):
* Kernel source
* Merging of upstream into the stock kernel
* Build tools

Installation Instructions:

If you are S-OFF you can flash the in recovery.

If you are S-ON, then after you flash the in recovery then, while still in recovery, you must run

adb pull /tmp/boot.img
<reboot into bootloader>
fastboot flash boot boot.img

Version 2.0.41: August 25, 2013: Linux 3.4.58, HTC colour "enhancement"
* Merged Linux versions 3.4.53 - 3.4.58
* Added the ability to enable / disable the HTC colour enhancement (this lets you see if you like it or not)

Version 2.0.38: July 7, 2013: Linux 3.4.52
* Linux version 3.4.51 / 52 merged in
* Reverted a small change to the PWM values used for the display (it wasn't giving any value so why change ti)

Version 2.0.34: June 24, 2013: colour enhancement, fixes, debug messages
* Toned done yet more HTC debugging messages
* Enable UTF-8 codepage support for Windows file-systems
* Fix error in HTC's light-sensor calibration table (overflows the 16-bit number they are using)
* Avoid buffer overflow in acdb driver
* Remove HTC's colour enhancement gamma correction (beaups)

Version 2.0.32: June 15, 2013: linux 3.4.49, scheduler & mutex improvements
* Linux 3.4.49
* Three scheduler performance improvements
* Move to more standard and slightly faster mutex implementation

Version 2.0.30: June 8, 2013: linux 3.4.48, small fixes
* Linux 3.4.48
* Fix CVE-2013-2595
* Decrease latency in cpufreq frequency changes

Version 2.0.27: May 26, 2013: init.d governor, 3.4.47
* Ability to specify the cpufreq governor at boot time (see second post).
* Linux 3.4.47
* Remove an annoying HTC debugging message

Version 2.0.26: May 23, 2013: init.d tweaks, 3.4.46, no default undervolting
* Added PVS information to /proc/cpuinfo in case you wanted to knoiw what it is for your phone.
* Linux upstream version 3.4.46
* Improve how I set the CPU frequences to safe levels for boot without having to reset them every time a core is hot-plugged in.
* New init.d scripts for some common tweaks (see post #2).

Version 2.0.23: May 13, 2013: Lightsensor fix, 3.4.45, faster freq. changes:
* Fix an error transcribing the lightsensor ranges into the source.
* Update to Linux 3.4.45
* cpufreq: use a high priority to target new frequencies to allow faster changes under load

Version 2.0.20: May 12, 2013: Lightsensor, 3.4.44, undervolt for "fast":
* Use a new lightsensor table to get a more granular light reading If you have custom auto-brightness settings, you'll probably need to tweak them after installing this kernel.
* Update to Linux 3.4.44
* Undervolted for devices binned "fast" by -100mV.
* CAF fix for cpufreq driver.

Version 2.0.17: May 7, 2013: Linaro 4.8.0 build, minor CAF fixes:
* Moved to updated Linaro 4.8.0 based toolchain (theoretically faster, less battery likely it's unnoticeable)
* CAF: change boot-up order for cpufreq
* CAF BT: recover from a hardware error by resetting the device

Version 2.0.15: May 2, 2013: boot hang fix, 3.4.43, CPU frequencies, brightness, misc fixes:
* Linux 3.4.43
* Small fixes from CAF (bluetooth, usb)
* Restore the CPU frequences/voltages from 1.x.y kernels (previously I was using HTC's new tables)
* simple_plug: keep cores online during boot
* use the correct brightness ranges for our display (HTC cut off the lowest brightnesses).
* fix a race condition on boot with the binder kernel services

Version 2.0.9: April 23, 2013: 3.4.41 and small fixes:
* Linux 3.4.41
* Small fixes from CAF
* Clean up some more HTC crap in the kernel

Version 2.0.6: April 17, 2013: boot changes, linux 3.4.40:
* Linux 3.4.40 (upstream).
* Limit CPU speeds during boot to stock speeds.
* Enable the thermal driver 5 seconds into the boot (previously was 30 seconds).
* Small changes to the ramdisk from the 2.04 update (I forgot these before).

Version 2.0.3: April 15, 2013: on_demand, battery, HTC spew:
* HTC insists on adding more and more debugging messages to the kernel log. Clean these up.
* OnDemand: revert a CAF change I made and disable io_is_busy.
* Remove HTC's over-volting for CPUs binned anything other than nominal.
* defconfig changes to ease building the kernel for CM10.1 (no you can't use this one for CM10.1!).

Version 2.0.0: April 11, 2013: 2.04 (OTA) source drop:
* Updated to Linux 3.4.39
* Updated to HTC's release of 2.04 source
* cgroup permissions fix
* Otherwise the same as 1.2.6
* Note: After running this for a day, I feel like the battery is draining faster and the phone is hotter than it should be. I'm looking into that.

Changelog from 1.2.x

Version 1.2.6: April 4, 2013: ramdisk fix, lowmemorykiller, hsic wakelocks:

* Fix a problem where the ramdisk was no longer disabling mpdecision and thermald. This issue causes a very minor additional battery drain that has now be fixed (Thanks t1gartist!).
* CAF updates to lowmemorykiller.
* Reapply elkay's HSIC fixes by pulling the real commits from CAF (instead of his hand copied commits) which fixes two problems in his commits.

1.2.2: April 1, 2013: linux 3.4.38, lag fixes, bluetooth drivers, cleanup:

* Undo some dubious commits (or extra code included in unrelated commits, what I meant by "early mistakes"). I reexamined every commit in the kernel to decide whether to keep it or remove it.
* Bluetooth drivers are the current CAF msm-3.4 drivers.
* Additional CPU speed and governor information added in /proc/cpuinfo.
* Cleaner patching to upstream linux (see my github repo for the clean upstream patching).
* Linaro -O3 compilation was redone from scratch because there were some problems found by kern3l in the original patches I pulled, I wanted to ensure that there were no other problems so I redid the work myself.

Changelog from the 1.0.x series:

1.0.27: Mar 25, 2013: thermald, simple_plug

* Make the previous changes to simple_plug less aggressive about turning cores back off when applications force them online. We now detect that this has occurred and give the application 2 minutes to be in charge before we force the state back to what we want.
* Change thermald default throttling to be slightly less strict.

1.0.25: Mar 21, 2013: Linux 3.4.37, simple_plug, performance

* Linux 3.4.37
* simple_plug: add a verify mode (every 5 seconds => almost 0 cost) that fixes the state when apps bring cores on/off-line (e.g. kernel tuner).
* rwsem performance improvements
* CAF improvements (correctness, performance) of the power management layer

1.0.21: Mar 16, 2013: Linux 3.4.36

* Linux 3.4.36
* Small bug fixes from CAF

1.0.18: Mar 7, 2013: Linux 3.4.35

* Linux 3.4.35

1.0.17: Mar 4, 2013: Linux 3.4.34, Linaro 4.7-2013.02, thermald fix

* Linux 3.4.34.
* Linaro 4.7: stopped using 4.8 beta builds due to stability fears and lack of apparent benefit from it. The latest 4.7 drop back-ports some optimizations anyway.
* lowmemorykiller: switch to the CAF version of the low memory killer.
* Fixed several bugs in HTC's thermal driver that could cause the termal driver to miss thermal events.

1.0.15: Feb 26, 2013: Battery optimization, performance, thermal & hotplug improvements

* governor: make ondemand the default governor
* GPU: Very minor GPU overclock to 487MHz (from mdeejay).
* msm_thermal: react better when temperature decreases.
* simple_plug: be slightly less aggressive about bringing cores online.
* New suspend mode PM_SUSPEND_FREEZE
* Oprimization for RWSEM lock handoffs.
* RCU locking in cpufreq!
* Disable more HTC debugging code.

1.0.11: Feb 22, 2013: Battery optimizations, Linaro 4.8 build, format

* Disable HTC's PNP power manager and adaptive policy services (used for thermald / mpdecision which are already disabled).
* Turn off all the kernel code that was polling to compute the state needed for thermald / mpdecision.
* Turn off a bunch of HTC statistic collection and debugging that isn't needed and wastes battery.
* Linux 3.4.33: fixes a kernel memory corruption/hang in all 3.0 and 3.4 kernels
* Sparkco's 4.8 Linaro build is now being used to compile the kernel
* Moved to format with less commonly used modules moved to loadable modules.

1.0.8: Feb 19, 2013: Switch to different OC values

* Now using mdeejay's over/unclocking (hopefully solving the L2 cache corruption panic).
* thermal driver is less aggressive about throttling the phone with an additional early step down to stock speed
(50C => 1.5GHz, 75C => 1.3GHz, 83C => 918MHz, 90C => 384MHz).
* Linux 3.4.32 (although no changes that would affect our phone).

1.0.7: Feb 15, 2013: thermal driver no longer polls for state

* Linux 3.4.31.
* Now using the 2013-01 build of the Linaro toolchain.
* Major rewrite of the thermal driver to remove polling (now uses essentially no power).
* Tweaks to the hot-plug driver to reduce CPU consumed to reduce power consumed.

1.0.5: miscellaneous optimizations

* Optimization: use optimized memcpy for user-space copies
* Update to linux 3.4.30
* Tons more cleansing of excessive debugging output
* Use RCU_FAST_NO_HZ as caf claims to have found that this improves battery life
* More linaro -O3 fixes from kern3l via dsb


* cm3629 driver, removed power button pocket check (sounds like a good idea, doesn't work and is a likely candidate for an infrequent sensor drain coming from the proximity sensor not turning off).
* cm3629 remove some unused functionality.
* Two small fixes from kern3l via dsb9938's kernel.
* clean some log messages.


* Merge linux 3.4.29
* simple_plug: a new CPU hot-plug driver (default)
* msm_thermal: a new thermal throttling driver (default)
* faux123's intelli_plug (disabled by default)
* faux123's intellidemand governor (default)
* disable mpdecision and thermald in initrd
* dsb9938's overclocking tables, GPU fix and more -O3 changes
* optimizations/fixes from faux123's mako kernel
* Based on elkay's LK kernel which is based on dsb9938's kernel.
* Includes all elkay's HSIC fixes, but nothing beyond that.
* Linaro -O3 compilation (zarboz) and other compiler flags (dsb9938).
* Disabled remote assistance because that just creeps me out.
* NTFS and CIFS.
* Various optimizations and improvements (faux123's mako kernel, similar to dsb9938's pulls from there).
* Force fast-charge (dsb9938).
* Voltage control (faux123).
* Latest OnDemand and Interactive governors from faux123's mako kernel.
* Large set of scheduler fixes / improvements (faux123).
* Underclocking (but not overclocking right now) to 192 MHz.
* BFQ I/O scheduler (default).
* Cleaned up debugging to make the kmsg more useful.


sweep2wake: I have no plans to add that to this kernel at this time.
The Following 59 Users Say Thank You to crpalmer For This Useful Post: [ View ]
7th February 2013, 12:40 PM |#2  
OP Recognized Developer
Thanks Meter: 8,278
Donate to Me
init.d tweaks

I really like Zarboz's goal of trying to get rid of the need for 3rd party apps to make the common changes that we want to make to some of the configurable parameters of the kernel. I created some scripts that run on boot (init.d) because I install my kernel so many times that I would go insane if I had to use an installer. By using these scripts and configuration files on the sdcard, I can just configure it once and keep installing away to my heart's content.

After installing this kernel, there will be:


run at boot, even if you switch to another kernel. It is safe to leave this file there and to let it run as it only makes changes if the kernel contains "crpalmer" in the version.

The tweaks are:

CPU Frequencies
* Frequencies loaded from /sdcard/crpalmer-cpufreq-min and /sdcard/crpalmer-cpufreq-max
* Governor loaded from /sdcard/crpalmer-cpufreq-governor
* If you specify either or both of these frequencies, it will lock down all of the CPU frequency controls. I had to do this because HTC overrides them in a script that is run very late in the boot process (thanks HTC!).
* E.g. adb shell su -c "echo 192000 > /sdcard/crpalmer-cpufreq-min"
* E.g. adb shell su -c "echo 1728000 > /sdcard/crpalmer-cpufreq-max"
* E.g. adb shell su -c "echo interactive > /sdcard/crpalmer-cpufreq-governor"

* + or - value loaded from [I]/sdcard/crplamer-uv
* The undervolting in 2.0.23 for FAST binned CPUs would be specified as:
* E.g. adb shell su -c "echo -100 > /sdcard/crpalmer-uv"

* My light sensor changes didn't sound like they worked well for everyone. If you don't like them you can disable them by:
* E.g. adb shell touch /sdcard/crpalmer-stock-lightsensor

HTC Colour "Enhancement"
* If this file is present then the stock colour "enhancement" will be used, otherwise it will be disabled.
* Introduced in kernel 2.0.41.
** E.g. adb shell touch /sdcard/crpalmer-color-enhancement

My WIFI Won't Turn On

If your WIFI won't turn on then the most likely cause is that either you didn't flash the boot.img (e.g. not S-OFF) or your modules don't match the kernel. To figure out what's wrong, first boot the ROM after having installed my kernel. Second, verify that you are running my kernel by running

adb shell cat /proc/version

and seeing that it says crpalmer in (it should match the version that you think you installed, but at least saying crpalmer is a good start). Then do:

adb shell dmesg -c
(turn on wifi)
adb shell dmesg

and look for an error that says crpalmer in it (something like a module version mismatch error). If you see that, it should tell you the version number of the modules that are installed and the version of the kernel.
The Following 22 Users Say Thank You to crpalmer For This Useful Post: [ View ]
7th February 2013, 01:20 PM |#3  
jonah1234's Avatar
Senior Member
Thanks Meter: 1,091
Re: [Kernel] [Linaro] [Linux 3.4.29] Version 1.0.0 - Feb 7
Thanks for this. Looks good. :thumbup:

Sent from my ViperDNA
7th February 2013, 02:07 PM |#4  
nitsuj17's Avatar
Inactive Recognized Developer
Flag PA
Thanks Meter: 17,129
Donate to Me
nice, moar kernel development

welcome aboard
The Following User Says Thank You to nitsuj17 For This Useful Post: [ View ] Gift nitsuj17 Ad-Free
7th February 2013, 07:04 PM |#5  
Senior Member
Thanks Meter: 411
Re: [Kernel] [Linaro] [Linux 3.4.29] Version 1.0.0 - Feb 7
So no modules to flash?

Sent from my HTC6435LVW using Tapatalk HD
7th February 2013, 07:15 PM |#6  
OP Recognized Developer
Thanks Meter: 8,278
Donate to Me
Originally Posted by idkwhothatis123

So no modules to flash?

That's right. No need to flash the return-to-stock modules either.
The Following 2 Users Say Thank You to crpalmer For This Useful Post: [ View ]
7th February 2013, 07:38 PM |#7  
Senior Member
Flag Los Altos
Thanks Meter: 123
Thank you for this! I also find it hilarious that you including instructions for benchmarking. To this day I still wonder why people actually care about benchmarks as they have little to no impact on real world performance.
7th February 2013, 08:09 PM |#8  
OP Recognized Developer
Thanks Meter: 8,278
Donate to Me
Re: [Kernel] [Linaro] [Linux 3.4.29] Version 1.0.0 - Feb 7
Originally Posted by azndan2

Thank you for this! I also find it hilarious that you including instructions for benchmarking. To this day I still wonder why people actually care about benchmarks as they have little to no impact on real world performance.

Self defense... I didn't want to deal with people getting 8K scores and blaming me.

Antutu is actually really useful for testing the thermal driver.
The Following User Says Thank You to crpalmer For This Useful Post: [ View ]
7th February 2013, 08:31 PM |#9  
Thanks Meter: 3
Very nice, does this have the latest changes that were just removed from elkays kernel? Also, could you add the lionheart gov?
7th February 2013, 11:58 PM |#10  
orangechoochoo's Avatar
Senior Member
Beating up dumbbells
Thanks Meter: 739
Nice to see another kernel to choose from, I will give it a shot this weekend. Will you eventually put any you tweaks? Also, can this be flashed with FlashGui?
8th February 2013, 12:32 AM |#11  
Senior Member
Flag Baltimore
Thanks Meter: 58
Re: [Kernel] [Linaro] [Linux 3.4.29] Version 1.0.0 - Feb 7
Originally Posted by orangechoochoo

Nice to see another kernel to choose from, I will give it a shot this weekend. Will you eventually put any you tweaks? Also, can this be flashed with FlashGui?

just tried, flashgui won't even let you flash it. Gotta wait till I get home I guess!

Sent from my HTC6435LVW using Tapatalk 2
The Following User Says Thank You to icesteve For This Useful Post: [ View ] Gift icesteve Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes