Kernel scheduler tweaks (non-BFS) - Hero, G2 Touch Android Development

First, let me say I am deeply sorry to open yet another thread on this subject. But I have made some investigations of my own and would like to make some clarifications which I think should not be buried on page 6 of some long thread....
This thread continues the discussion started by these threads:
http://forum.xda-developers.com/showthread.php?t=689829
http://forum.xda-developers.com/showthread.php?t=785988
From what I gather there about 5 different parameters which are purposed for tweaking:
- NEW_FAIR_SLEEPERS (default ON) - This is about the only parameter which I do feel some difference when disabling it (on Floyo 0.8) and for the worse. Hence currently I intend to leave it on.
- NORMALIZED_SLEEPER (default ON) - I found various recommendations to turn this off. I don't feel much difference but maybe there is a slight improvement. Currently I intend to turn it off.
- sched_latency_ns:
* Targeted preemption latency for CPU-bound tasks:
* (default: 20ms * (1 + ilog(ncpus)), units: nanoseconds)
*
* NOTE: this latency value is not the same as the concept of
* 'timeslice length' - timeslices in CFS are of variable length
* and have no persistent notion like in traditional, time-slice
* based scheduling concepts.
*
* (to see the precise effective timeslice length of your workload,
* run vmstat and monitor the context-switches (cs) field)
- sched_min_granularity_ns -
* Minimal preemption granularity for CPU-bound tasks:
* (default: 4 msec * (1 + ilog(ncpus)), units: nanoseconds)
- sched_wakeup_granularity_ns (not sure if this one was mentioned in previous threads but also related)
* SCHED_OTHER wake-up granularity.
* (default: 5 msec * (1 + ilog(ncpus)), units: nanoseconds)
*
* This option delays the preemption effects of decoupled workloads
* and reduces their over-scheduling. Synchronous workloads will still
* have immediate wakeup/sleep latencies.
Note the descriptions are from the kernel sources and default values are a bit different and also dependent on the init.rc in the ramdisk which is dependent on the ROM.
I tryed to play with the last 3 parameters in a very wide range and did not feel much difference. Based on my experience and searches over these forums and such I currently have these values:
sched_latency_ns 5000000
sched_wakeup_granularity_ns 1000000
sched_min_granularity_ns 1000000
They are somewhat arbitrary and if someone can bring up a scenario where the difference is noticeable I will happy to hear it.
Some technical notes:
- I have seen this "numerical" tweak in multiple places:
kernel.sched_features = 24188
This is not smart using a numerical value, as there are some new backports which I would like to incorporate into my kernel and they actually change the "correct" numerical value here.
The preferred way to tweak these settings was brought by androcheck here. Just a reminder:
Code:
# Step 1: Mount debugfs (which is a virtual filesystem like /proc/ or /sys/)
mount -t debugfs none /sys/kernel/debug
# Step 2 (optional): Display the current scheduler flags
cat /sys/kernel/debug/sched_features
# Step 3: Set the flag NO_NEW_FAIR_SLEEPERS
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features
# Step 4: Unmount debugfs again
umount /sys/kernel/debug
I would actually skip the unmounting step since it doesn't bother to have it there and then you can play with the different parameters at /sys/kernel/debug directly.
I would like to emphasize my point about the kernel features tweaking, using an example with my current settings (only NORMALIZED_SLEEPER disabled):
Code:
# mount -t debugfs none /sys/kernel/debug
# echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
# cat /sys/kernel/debug/sched_features | sed "s/ /\n/g"
NEW_FAIR_SLEEPERS
NO_NORMALIZED_SLEEPER
WAKEUP_PREEMPT
START_DEBIT
AFFINE_WAKEUPS
CACHE_HOT_BUDDY
SYNC_WAKEUPS
NO_HRTICK
NO_DOUBLE_TICK
ASYM_GRAN
LB_BIAS
LB_WAKEUP_UPDATE
ASYM_EFF_LOAD
NO_WAKEUP_OVERLAP
LAST_BUDDY
# cat /proc/sys/kernel/sched_features
24189
So I would highly recommend tweaking the sched_features only through the /sys/kernel/debug/sched_features where you actually know what you are doing.
Then to make it permanent you can grab the numerical value from /proc/sys/kernel/sched_features and write it, for example, to the sysctl.conf.
- One final technical note: f_padia in his post here detailed nicely how to make the changes permanent using sysctl.conf.
I find sysctl also very useful for temporary tweaking of the values, for example:
Code:
sysctl -w kernel.sched_latency_ns=5000000
sysctl -w kernel.sched_min_granularity_ns=1000000
sysctl -w kernel.sched_wakeup_granularity_ns=1000000
Alternatively you could also write them to the appropriate "file" at /proc/sys/kernel. Both these methods do not require the mount of the debug_fs but neither gives you the literal interface to the kernel features (which the debug_fs does - see above).

Removed the part about the OWNER_SPIN, apparently was using an experimental version of my kernel which has an additional OWNER_SPIN sched_feature which makes the numerical value of 24188 incorrect.
Most likely you have no idea what I am talking this was just one epic fail on my side - you can ignore it. Just read the first post it is now updated.

looks nice.. will give it a go

Thanks for your research and additional information to this topic!

this IS excellent work.. on my 2.1 dext these hacks, included in one .sh in init.d then chmod +x, improved a lot speed and I can even think there's a faster boot
you all rule man!

Related

[REF] Startup script speed tweaks

Hi guys,
UPDATE: Over time, I've modified some of these values in my SpeedMod kernel. The values here may not be the best ones.
NOTE: These tweaks are now included in kernels based on sztupy's Universal Lagfix, for example:
http://forum.xda-developers.com/showthread.php?t=822756
But they must be manually activated from the recovery menu.
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Remount all partitions with noatime
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime $k
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
#echo "10" > /proc/sys/vm/dirty_ratio
#echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler, less aggressive settings
echo "18000000" > /proc/sys/kernel/sched_latency_ns
echo "3000000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "1500000" > /proc/sys/kernel/sched_min_granularity_ns
# Misc tweaks for battery life
echo "2000" > /proc/sys/vm/dirty_writeback_centisecs
echo "1000" > /proc/sys/vm/dirty_expire_centisecs
EDIT: Explanations:
# Remount all partitions with noatime
atime is a setting where the filesystem updates the access time of a file. This creates a write-after-every-read which slows things down. By default all partitions are mounted with relatime, which is an optimized version of atime. noatime is the fastest, and afaik we don't need atime.
# Tweak cfq io scheduler
Tweaked settings of the disk io scheduler more for flash memory. Defaults are optimized for spinning harddisks. Lowered the idle wait, re-enable the low latency mode of cfq, removed the penalty for back-seeks and explicitly tell the kernel the storage is not a spinning disk.
# Tweak kernel VM management
Set tendency of kernel to swap to minimum, since we don't use swap anyway.
Lower the amount of unwritten write cache to reduce lags when a huge write is required.
Increase tendency of kernel to keep block-cache to help with slower RFS filesystem.
Increase minimum free memory, in theory this should make the kernel less likely to suddenly run out of memory.
# Tweak kernel scheduler
Make the task scheduler more 'fair' when multiple tasks are running. This has a huge effect on UI and App responsiveness. These values (less aggressive settings) are 20% of the Linux defaults, and about half of the Android defaults.
# Miscellaneous tweaks
Increase the write flush timeouts to save some battery life.
___________________________________
EDIT: How to create/use a startup script:
You need root and busybox for this.
This procedure is adapted from the old OCLF which used this method to create a startup script in /system/userinit.sh
Check if the file /system/userinit.sh exists. If it does, u should just edit that file as the startup script and DO NOT do the procedure below.
Here's how to do it manually. Do this only if some other lagfix/patch has not already done the playlogos hack, otherwise u might overwrite the other script!
Create the startup script on your PC. Use adb to push it to /sdcard/userinit.sh
adb push userinit.sh /sdcard/userinit.sh
On your PC, create a file called playlogos1 with this content:
#!/system/bin/sh
sh /data/userinit.sh
playlogosnow
Use adb to push the playlogos1 file to /sdcard/playlogos1
adb push playlogos1 /sdcard/playlogos1
Now use adb shell, su and do this:
busybox mount -o remount,rw /system;
busybox cp /sdcard/userinit.sh /data/userinit.sh;
busybox mv /system/bin/playlogos1 /system/bin/playlogosnow;
busybox cp /sdcard/playlogos1 /system/bin/playlogos1;
chmod 755 /system/bin/playlogos1;
chmod 755 /data/userinit.sh;
The startup script will be /data/userinit.sh
The reason I put the startup script in /data is so that if you mess up the startup script and get stuck during boot, you can do a "clear data" from recovery, and the startup script will be erased.
Could you explain what this actually does for the non linux savvy, also maybe you could make a script/app for this so everyone else can try it ?
hardcore said:
Hi guys,
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Remount all partitions with noatime
for k in $(mount | cut -d " " -f3)
do
sync
mount -o remount,noatime $k
done
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
echo "10" > /proc/sys/vm/dirty_ratio
echo "1000" > /proc/sys/vm/vfs_cache_pressure
echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler
echo "2000000" > /proc/sys/kernel/sched_latency_ns
echo "500000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns
# Miscellaneous tweaks
setprop dalvik.vm.startheapsize 8m
setprop wifi.supplicant_scan_interval 90
setprop windowsmgr.max_events_per_sec 68
Click to expand...
Click to collapse
VERY interesting
EarlZ said:
you could make a script/app for this so everyone else can try it ?
Click to expand...
Click to collapse
+1, pretty plz, also, is this compatible with voodoo?
INeedYourHelp said:
+1, pretty plz, also, is this compatible with voodoo?
Click to expand...
Click to collapse
Should be compatible, although u need to know how to add it into voodoo's startup script.
Hello
Values description for each one and why is welcome
supercurio said:
Hello
Values description for each one and why is welcome
Click to expand...
Click to collapse
Hey supercurio! Great job on Voodoo, I am particularly keen on the Sharpness, Video and future Sound fixes. I think its very cool that you found out how to modify the sharpness (S-AMOLED's PenTile matrix software algorithms?).
Edited the starting post with explanations. Most of them should be documented somewhere in the Linux sources / documents.
I've been using them for a while, tweaking values here n there. I think I've finally reached a stage where I'm confident enough to recommend them to others to try. There could be more optimum values with further testing, but these work well for me with Froyo.
hardcore said:
Hey supercurio! Great job on Voodoo, I am particularly keen on the Sharpness, Video and future Sound fixes. I think its very cool that you found out how to modify the sharpness (S-AMOLED's PenTile matrix software algorithms?).
Edited the starting post with explanations. Most of them should be documented somewhere in the Linux sources / documents.
I've been using them for a while, tweaking values here n there. I think I've finally reached a stage where I'm confident enough to recommend them to others to try. There could be more optimum values with further testing, but these work good for me so far with Froyo.
Click to expand...
Click to collapse
Yeah thank you so much for taking the time and sharing, i'll integrate them after a bit of testing
About the sharpness filter yes this is the main difference between S-AMOLED and AMOLED panel wise.
It's a hardware sharpness filter which is here to fight the fuzziness introduced by the pentile pattern but.. they overdid it a bit.
The "perfect" values are of course closer than the one with the same radius that the one of the blur introduced itself with the pixel pattern.
I feel it can maybe be improved a hair
I'll soon publish a version that allow write to the mDNIe register so you'll be able to play *live* with it too
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
hey xan, you made me remember to add run-parts support.
i'll do that and you'll be able to set it without special hack very soon with voodoo
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
I don't think the setprop values can be modified post-startup. You can check if the value was modified by doing a getprop. (The default value for that prop is 55.)
The rest of them can be modified post-startup though.
Excuse my noobiness on Android, I would like an explanation on this command:
hardcore said:
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
Click to expand...
Click to collapse
On my GNU/Linux system I've set vm.swappiness to 10, because I've got plenty MiB of RAM and I don't want my system to swap a lot. Is this swappiness the same as Linux? Because that would mean having the system to use more RAM, and since we don't have much of that available by default, I'm just surprised you didn't set a higher value. (I'm not saying you don't know what you're doing, I just want to learn how it works!)
By the way, this script is going to be a must-have, I think you've put an excellent effort on i9000 Android development! Thanks for sharing!
xan said:
Nice, could these be modified post-startup? like I go adb and copy paste some of them for testing?
I've tested setprop windowsmgr.max_events_per_sec 68, no difference. Set it to
setprop windowsmgr.max_events_per_sec 10 and still, no difference.
Click to expand...
Click to collapse
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not affect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Fr4gg0r said:
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not effect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Click to expand...
Click to collapse
Yes, i tried on Eclair to set it to 56fps (real fps is 55.5555555555555) but touch scrolling were not smoother.
I hope it can be improved in some way!
Fr4gg0r said:
The aosp windowmanager (android framework) ignores values <35. (Samsung could have changed something here, but that is very unlikely).
That value does not affect the framerate, but how many touch events are reported to the apps; this saves some cpu if the user keeps touching the screen.
Click to expand...
Click to collapse
Thanks for the info. Looks like default settings are best unless we can actually change the refresh rate.
supercurio said:
Yeah thank you so much for taking the time and sharing, i'll integrate them after a bit of testing
Click to expand...
Click to collapse
We are eagerly waiting for it =) I don't know when you manage to sleep since you have so many things to do in voodoo =)
hardcore said:
Hi guys,
I've been using Linux kernel tweaks in a startup script to make the phone smoother.
With these tweaks, the phone is quite smooth and fast even without using the filesystem lagfixes.
These settings are only useful for you if you know how to create and modify a startup script. I use the old playlogos hack myself, but I'm sure there are many new ways to do it now.
Code:
# Remount all partitions with noatime
for k in $(mount | cut -d " " -f3)
do
sync
mount -o remount,noatime $k
done
# Tweak cfq io scheduler
for i in $(ls -1 /sys/block/stl*) $(ls -1 /sys/block/mmc*) $(ls -1 /sys/block/bml*) $(ls -1 /sys/block/tfsr*)
do echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/low_latency
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1000000000" > $i/queue/iosched/back_seek_max
echo "3" > $i/queue/iosched/slice_idle
done
# Tweak kernel VM management
echo "0" > /proc/sys/vm/swappiness
echo "10" > /proc/sys/vm/dirty_ratio
echo "1000" > /proc/sys/vm/vfs_cache_pressure
echo "4096" > /proc/sys/vm/min_free_kbytes
# Tweak kernel scheduler
echo "2000000" > /proc/sys/kernel/sched_latency_ns
echo "500000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns
# Miscellaneous tweaks
setprop dalvik.vm.startheapsize 8m
setprop wifi.supplicant_scan_interval 90
EDIT: Explanations:
# Remount all partitions with noatime
atime is a setting where the filesystem updates the access time of a file. This creates a write-after-every-read which slows things down. By default all partitions are mounted with relatime, which is an optimized version of atime. noatime is the fastest, and afaik we don't need atime.
# Tweak cfq io scheduler
Tweaked settings of the disk io scheduler more for flash memory. Defaults are optimized for spinning harddisks. Lowered the idle wait, re-enable the low latency mode of cfq, removed the penalty for back-seeks and explicitly tell the kernel the storage is not a spinning disk.
# Tweak kernel VM management
Set tendency of kernel to swap to minimum, since we don't use swap anyway.
Lower the amount of unwritten write cache to reduce lags when a huge write is required.
Increase tendency of kernel to keep block-cache to help with slower RFS filesystem.
Increase minimum free memory, in theory this should make the kernel less likely to suddenly run out of memory.
# Tweak kernel scheduler
Make the task scheduler more 'fair' when multiple tasks are running. This has a huge effect on UI and App responsiveness. These values are 10% of the Linux defaults, and about half of the Android defaults.
# Miscellaneous tweaks
Manually set the starting dalvik heap size.
Increase wifi scanning gap to reduce battery usage.
Click to expand...
Click to collapse
I'm interested in doing this but I'm not sure where should I put the file. I checked playlogos1 from /system/bin but it's a binary file.. Tried to find playlogos hack on the forum but can't really find anything...
i have a jpm with voodoo, and i have copy this code into /voodoo/scripts/init.sh
just simplely add to the end of it, of course, before the last line.
the system reboot is ok, but i havent see the effects yet.
btw, "ls -1 /sys/block/mmc*" in adb give us:
Code:
ls -1 /sys/block/mmc*
-1: No such file or directory
/sys/block/mmcblk0
/sys/block/mmcblk1
so, "-1" key is useless
[kab] said:
btw, "ls -1 /sys/block/mmc*" in adb give us:
Code:
ls -1 /sys/block/mmc*
-1: No such file or directory
/sys/block/mmcblk0
/sys/block/mmcblk1
so, "-1" key is useless
Click to expand...
Click to collapse
it should be -l, not one

How to reconstruct a binary identical I9000XWJP6 kernel image, and more

The idea of this exercise is (at least) to get a stable starting point for kernel development. The thing which is currently missing is a proper working .config. I have reconstructed it using differential analysis and in the process hoped to find which components have actually been activated and to uncover changes (or Easter eggs) in the sources which have not been advertised. Having a working and identical I9000XWJP6 kernel also means that open development can continue from the current official public release. From there the things possible are only limited by your imagination.
The following is a walk-through on how to build the kernel, description of pitfalls that will cause changes in .config to break, and some annotations on discoveries made in the process.
The things you need are:
Mandatory:
- I9000XWJP6 zImage : from your favorite location
- Source tree : opensource•samsung•com the GT-I9000 OpenSource Froyo Update JPM.zip
- Sourcery G++: www•codesourcery•com/sgpp/lite/arm/portal/release1039
- Tweak-Kit : <attached>
Optional:
- Arm enabled GCC and binutils, including a development libbfd.
- Lots of your favorite beverage
The md5sum of the zImage should be: 26e9d5d206baf1515144c6b8de6f10d2
It is critical that the Sourcery G++ version is 2009q3-67.
The Tweak-Kit contains the following components:
Readme.txt - You're reading it
mkvmlinux.cc - convert zImage to vmlinux and extract the init ramdisk image
I9000XWJP6_defconfig - default .config
stamp.patch - set date/time and such to original
style.patch - fix style related warnings
prototype.patch - fix prototype related warnings
error.patch - Recoverable errors
houston.patch - Unrecoverable errors
shadow.patch - Fixate data structures
I9000XWJP6.h - Fixated macros
I9000XWJP6.c - Entry point stubs
SOME THINGS I ENCOUNTERED IN THE PROCESS:
a) What I absolutely did not expect was that I found two different encodings of the build timestamp. I could deduce that the timezone was central Europe. I had the assumption it would be Asia or America.
b) What was to be expected is that the source tree is incomplete. The directories drivers/fsr and fs/rfs are missing. You can still compile the kernel as the missing files are used to build modules. Problems start when you change the config. Doing so will change entry points and data structures and your kernel might die a horrible death when it loads modules who are unaware on these changes. There is a workaround which I will explain later.
c) The weirdest thing I encountered were the functions enable_hlt() and disable_hlt(). The are located deep in the unwind tables, a section not intended for code. I spent many hours trying to figure out how they got there or why but I still have no clue. I found exactly only one way to reproduce this behaviour and it is certainly not due to a typo, accident or ignorance.
d) The kernel is not a production but a debug version. It has nearly all tracking/tracing/debug bells and whistles switched on. If the energy required to maintain the statistics where to emit light, you could use your Galaxy as a Christmas tree. Function profiling is enabled and has a considerable negative effect on performance, code is not optimized for size but speed, and unwind tables have been enabled which are not used. These have a really bad impact on footprint size. I really hope that the same compiler and settings are not used for the Android layer. Changing the config into a production version will not work (and crash) as the non-native modules expect the debugging hooks which will no longer exist. But the same workaround as above can be used.
e) The functionality of the power management domains have been optimized to oblivion due to the excessive placing of code disabling comments in large parts of the clock, power management and mach-aries.c. Maybe because the Galaxy hardware is too different than the evaluation boards, or the hardware is buggy and disabling the code makes it less unstable, or there was just not enough time to get the code working. Anyway, at this moment I have no oversight into what degree the absence of power domains influence battery usage.
f) When I started examining the binary code I was puzzled by snippets of code I could not reproduce. Even worse, I encountered snippets that were just questionable. Unusual instruction sequences, and resister usage. Thinking I bumped into a GCC bug, I started debugging the compiler and even tweaked instruction scheduling weights but with no satisfying outcome. I know that GCC is very stubborn with regard to saving and clobbering registers in/across function calls and the code I saw was just incorrect. I knew a different compiler was used and I suddenly realized that it may be more different than what first meets the eye. The culprit turned out to be Sourcery G++. It is a private maintained branch of GCC for reasons I have not investigated. Even the Sourcery assembler is tainted as it played a nasty trick on me with the enable_hlt/disable_hlt thing. I do not like the code I see and I am aiming into getting the sources stock GCC friendly with a working kernel. However, GCC and Sourcery generate code which seem difficult to mix, but I'm getting closer.
g) Compiler warnings. Many of the Samsung sources generate warnings, something I really dislike. In my opinion a warning is emitted for a piece of code which can be interpreted in several ways, leaving the compiler to choose which. Usually it will choose the wrong one. Most warnings were related to coding style shortcuts, a couple of incorrect function prototype resulting in functions that should return int to return random or falsely ignoring return values. There were also a couple of nasties like deference of uninitialized pointers, accessing out-of-bound data and mixing clock data-structures of different types. Included are a number of patches to fix them.
h) I looked deeper into why GCC and Sourcery won't mix and discovered that they have different implementations with regard to constant definition within enum declarations. Google points to the staring point "GCC bug 30260" where is written that the behaviour of enumeration constants has changed to becoming signed int. I have noticed that even explicit unsigned values will change to signed.
Here is an example of what is going wrong:
Take following declaration
Code:
enum rt_class_t { RT_TABLE_MAX=0xFFFFFFFF }
. GCC will consider RT_TABLE_MAX to be -1, and Sourcery will consider it 4294967295. Now, in net/ipv4/fib_rules.c there is this code snippet
Code:
for (u32 id = 1; id <= RT_TABLE_MAX; id++)
GCC will skip the loop, and Sourcery will have a hard time doing nothing.
There are more examples like calculating the location of physical memory or signed/unsigned comparisons. The compiler switches -fwrapv and -fstrict-overflow might influence things, but it general the behaviour is hardcoded and both compilers have a different flavour. I think it would be wiser to choose the GCC flavour as it is more widespread and thus better tested (and fixed).
i) GCC. I noticed that early versions of kernels compiled with GCC would not start. At first I thought it was because of Sourcery /GCC code generating differences. After a number of buxfixes (in error.patch) I suddenly noticed that the GCC kernel is working. My phone is running a GCC compiled production configured kernel for nearly a week.
j) "Houston, we've had a problem" with the light sensor. One of the compiler warnings brought me to the file drivers/sensor/optical/gp2a.c. There within are located two routines which read the light and proximity sensor. They seem copy-pasted identical, however the sensor value types are different as the proximity value is a char and the light intensity a double. What is more convenient than to simply change the data type of the supplied buffer in the function prototype. Now headache starts as the semantics of the read (and write) call say that the unit size is byte. So returning "1" indicates that only the first byte of the sensor value is copied. Also, there is no bounds/access checking so supplying an invalid pointer to the call will crash the kernel. So, assuming this is all one big mistake, I redesigned the function to do better (see houston.patch) and built a new kernel with it. To my utter surprise my battery charge extended from <24 hours to 2 days and 20 hours.
However... I also noticed that my backlight intensity level was constant at it's lowest although the setting was set to auto. I needed to know how the caller invokes the call, but after an extensive search of internet and android sources it is still something I have not found. Heuristics show that the reading the light sensor is called with a buffer length of 1, and the returned value is only accepted when returning a 1 and that the sensor value type is a double (8 bytes). This is wrong: read() semantics require that you supply a length of 8, and expect a return value of 8. This may be the base of many light sensor issues I found when Googling.
Anyway, I returned the code to it's original faulty behaviour, and being illuminated I disabled the auto backlight intensity and changed it to it's lowest setting to enjoy a longer life between battery charges.
TO CREATE YOUR KERNEL:
1) Prepare a working environment
1a) Unpack Sourcery G++. No installation needed, unpacking is sufficient
1b) Unpack the Samsung sources and cd to the location of the top-level Makefile.
1c) Unpack the zImage and the contents of the Tweak-Kit to the same location
1d) Make sure the zImage is called zImage.I9000XWJP6
2) The ramdisk image is required and can be extracted from zImage.I9000XWJP6
2a) Create an uncompressed image Image.I9000XWJP6
Code:
gcc scripts/binoffset.c -o scripts/binoffset
ofs=`scripts/binoffset zImage.I9000XWJP6 0x1f 0x8b 0x08 0x00 2>/dev/null`
dd ibs=$ofs skip=1 <zImage.I9000XWJP6 | gzip -c -d >Image.I9000XWJP6
2b) The Tweak-Kit includes mkvmlinux which converts the uncompressed binary image into a bfd object. You need an Arm enabled libbfd to get it working. This does not get installed by default so you need to deeplink into binutils. mkvmlinux locates and decodes the kallsym data and econstructs the symbol table. It then uses the values of __initramfs_start/end to extract the initramfs. If you are not bothered with the hassle, just use dd with hardcoded values.
Code:
g++ mkvmlinux.cc -o mkvmlinux -lbfd -liberty -lz [-I and -L that deeplink into binutils]
./mkvmlinux Image.I9000XWJP6 vmlinux.I9000XWJP6 -r initramfs.cpio
or
Code:
dd if=Image.I9000XWJP6 of=initramfs.cpio bs=1 count=2739712 skip=165568
3) Patch date/time and other environmental issues to the moment of original creation
Code:
patch -p1 <stamp.patch
4) Make your computer happy
Code:
# edit Makefile line 184 and update the macro CROSS_COMPILE=
cp I9000XWJP6_defconfig arch/arm/configs/I9000XWJP6_defconfig
make I9000XWJP6_defconfig
make
5) Verify that the kernel is identical
Code:
diff zImage.I9000XWJP6 arch/arm/boot/zImage
AND NOW FOR SOMETHING COMPLETELY DIFFERENT...
Tweaking the configuration will build you a new kernel but when your Galaxy powers on it will either die silently (hang) or experience a horrible death (reboot). The problem is that there are modules built from sources located in the removed directories drivers/fsr and fs/rfs. These modules were compiled with a specific data structure layout and entry points. These will surely change when re-configuring. The way to keep the non-native modules happy is to keep the structures and entry points intact.
The structure layout is influenced by the CONFIG_ macros. The structures can be fixed to reflect the state of the I9000XWJP6 kernel by replacing the CONFIG_ macro's by something that does not change after reconfiguration. For that I use a collection of 'shadow' macro's which have SHADOW_ as prefix. Because the data structures cannot expand, you cannot (easily) enable configure functionality which require extra fields in the data structures. Reducing functionality is highly seldom a problem.
If changing kernel functionality results in removal of entry points, then stubs are required for those entry points needed by the non-native modules
There are automated methods to verify that a new kernel abides to the above constraints. For the data structures the compiler must generate gstabs debug information. This is human readable and includes detailed structure descriptions. This information should be identical across re-configuration. However, the scripts get confused by anonymous structs which are by product of "typedef struct {" constructions. These need to be named, something shadow.patch also does.
The kernel modules have easily-readable symbol tables containing needed kernel entry points. These should all be present in all re-configured kernels. Validation tests that fail emit enough information to further fix data structures and entry points. The Tweak-Kit contains two files: I9000XWJP6.h containing the SHADOW_ macro's and I9000XWJP6.c for the stubs. Both were constructed in an on-demand basis for the reconfiguration I am currently using and both serve as good examples on what to do when validation fails.
Before reconfiguring, rebuild the kernel for usage as a validation checkpoint.
1) Undo the timestamp patches
Code:
patch -R -p1 <stamp.patch
2) Fix the warnings
Code:
patch -p1 <style.patch # style related issues
patch -p1 <prototype.patch # prototype related issues
patch -p1 <error.patch # bug fixing
3) Apply datastructure fixation, entrypoint stubbing and Makefile tweaking
Code:
patch -p1 <shadow.patch
cp I9000XWJP6.c arch/arm/plat-samsung
4) Before recompiling everything, you need to issue "make clean" first. However, the missing directories will now pose a problem as "make clean" will include their Makefiles and will fail if it can't. Just create empties to keep the build happy.
Code:
mkdir -p drivers/fsr fs/rfs
touch drivers/fsr/Makefile fs/rfs/Makefile
5) Optionally change the Makefile to point to your favorite compiler/toolchain. Please note that I am using GCC 4.4.5. GCC 4.5.1 is bumping into problems I haven't looked into yet.
Code:
# edit Makefile line 184 and update the macro CROSS_COMPILE
6) This build will generate gstab debug information. Unexpectingly, this might bite when combined with function profiling, so disable that. But do not CONFIG_FUNCTION_TRACER yet as that does more.
Code:
# edit Makefile line 553, disable the line containing KBUILD_CFLAGS += -pg
7) Unpack the initramfs image. The directory /lib/modules needs to be examined/updated
Code:
mkdir initramfs.dir
cd initramfs.dir
cpio -i --make-directories --preserve-modification-time --no-absolute-filenames <../initramfs.cpio
cd ..
8) Repack initfs as a tarball, as make clean will erase all the modules
Code:
tar cf initramfs.tar initramfs.dir
9) The initramfs image will contain new kernel modules. Make sure a new version will get generated.
Code:
# in .config line 80 point to the unpacked initram location
CONFIG_INITRAMFS_SOURCE="initramfs.dir"
# in .config lines 86-89, select your favourite compression
CONFIG_INITRAMFS_COMPRESSION_NONE=N
CONFIG_INITRAMFS_COMPRESSION_GZIP=Y
10) Build a new kernel
Code:
# not cleaning will confuse the verification
make clean
make CONFIG_DEBUG_INFO=y
# install the modules
tar xf initramfs.tar
cp `find drivers -name '*.ko'` initramfs.dir/lib/modules
# rebuild with a fresh new ramdisk image
rm usr/initramfs_data.cpio*
make CONFIG_DEBUG_INFO=y
11) Checkpoint structure/entrypoint information. This is architecture independent.
Code:
# extract structures. They are the entries with :T
objdump -G vmlinux | awk '{ print $7 }' | grep :T | sed 's/([^)]*)/()/g' | sed 's/=\*()//g' | sort -u > gstabs.ckp
# extract the entrypoints
nm vmlinux | grep 'r __ksymtab_' | awk '{ print $3 }' | sort > ksymtab.ckp
12) Do a test-run. Pack zImage and flash with Odin. If your Galaxy is up and running, I strongly suggest you make a backup of your environment. If you later change something and it breaks, then this is the best place to restart.
Code:
cp arch/arm/boot/zImage .
tar cf I9000XWJP6-2.6.32.9-test.tar zImage
13) Make your re-configuration. I really suggest you do not make too many changes in one go because it gives more work when the structure/entrypoint verification fails.
Code:
# re-configure. For this exercise, change the kernel to a more production version
CONFIG_CC_OPTIMIZE_FOR_SIZE=Y
CONFIG_DM_DEBUG=N
CONFIG_S3C_KEYPAD_DEBUG=N
CONFIG_DEBUG_FS=N
CONFIG_DEBUG_KERNEL=N
CONFIG_LATENCYTOP=N
CONFIG_FTRACE=N
CONFIG_ARM_UNWIND=N
CONFIG_DEBUG_USER=N
14) Build a new kernel
Code:
# not cleaning will confuse the verification
make clean
make CONFIG_DEBUG_INFO=y
# install the modules
tar xf initramfs.tar
cp `find drivers -name '*.ko'` initramfs.dir/lib/modules
# rebuild with a fresh new ramdisk image
rm usr/initramfs_data.cpio*
make CONFIG_DEBUG_INFO=y
You get "struct has no member named" errors if you have enabled subsystems that require data structures to change which are incompatible with the non-native modules.
15) Verify structure/entrypoint checkpoint
Code:
# extract/verify structures
objdump -G vmlinux | awk '{ print $7 }' | grep :T | sed 's/([^)]*)/()/g' | sed 's/=\*()//g' | sort -u > gstabs.t
# new/changed structures are tagged with '+'. Display only the changed ones
diff -U0 gstabs.ckp gstabs.t | grep '+' | grep ':T' | sed 's/+//' | sed 's/:T.*/:T/' | while read s; do
grep -q "$s" gstabs.ckp
if [ $? -eq 0 ]; then
echo $s;
fi
done
# extract/verify entrypoints
nm vmlinux | grep 'r __ksymtab_' | awk '{ print $3 }' | sort >ksymtab.t
# extract all entrypoints needed by the modules
nm `find initramfs.dir/ -name '*.ko'` >allkosym
# some symbols are referenced in other modules. Cross-reference and remove from list
grep ' U ' allkosym | sort -u | awk '{ print $2 }' | while read s; do
if ! egrep -q "^[0-9a-f]* . $s\$" allkosym; then
echo $s;
fi
done > allusym
# check that kernel has entrypoints for all final undefined symbols
cat allusym | while read s; do
if ! egrep -q "^__ksymtab_$s\$" ksymtab.t; then
echo $s;
fi
done
Both scripts will generate output if you have enabled subsystems that require datastructures to change. These do not necessarily have to be data structures needed by non-native modules. However, missing entrypoints are those used by the modules. If it's about datastructures, your best chance is to lookup the data type and see if there any #ifdef CONFIG_ macros that need to be changed into #ifdef SHADOW_. If it's a missing entry point, you need to add a stub in I9000XWJP6.c.
16) Do a test-run. Pack zImage and flash with Odin.
Code:
cp arch/arm/boot/zImage .
tar cf I9000XWJP6-2.6.32.9-test.tar zImage
17) If you want more, jump to step 13
18) When you are really done, rebuild a final and fresh kernel and initramfs image with debugging stuff removed. The -gstabs compiler switch slightly influences code generation.
Code:
# not cleaning will confuse the verification
make clean
make
# install the modules
tar xf initramfs.tar
cp `find drivers -name '*.ko'` initramfs.dir/lib/modules
# rebuild with a fresh new ramdisk image
rm usr/initramfs_data.cpio*
make
My uncompressed image has now shrunk from 14700623 to 11822559 bytes.
Happy Hacking...
[...and now to find a better workaround for those non-native modules.]
WoW, Nice work !! very good info for beginners like me
thx a lot for this tut and i've learnt a lot
btw, seems there r some typos or something is missing. i did it with (XXJPO):
Hexabit said:
make I9000XWJP6_defconfig
Click to expand...
Click to collapse
make defconfig I9000XWJP6_defconfig
- modified include/linux/a.out.h by removing the 2nd def for SEGMENT
- changed the boolean to lowercase for .config
PS i use the cpio extracted by myself coz i couldnt enable libbfd on my ubuntu x64
Good tips. Thanks.
Really insightful i hope the dev take all the tweaks into consideration and make a new optimized kernel
good job here!
I think it's the most amazing first post ever! It should be sticked or kept somewhere safe.
Awesome first post. Will have to work through this.
Great post with very interesting findings!
I'm no expert, so maybe my question is a bit silly:
Is Samsung's published code just a buggy and incomplete pre-release debug version? Then how can e.g. Voodoo get a good working kernel?
Or is the official firmware really built of this, so possibly full of strange bugs and missing optimizations?

[KERNEL][3.4.106][LP][ION] K^Kernel 3.4.106 v2.0 for LP 5.0 [11/03/2015][EOL]

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
In this thread you may find my customized kernel 3.4.x for Lollipop rom (CM 12.0 and derivatives) that use ION+PMEM ADSP memory allocations.
Of course, your feedback, as always, are welcome and certainly valuable.
The main features are the following:
- Kernel 3.4.x
- Kernel based on more updated kk_2.7-stable branch of CAF (Code Aurora Forum)
- Sources synched with cm-12.0 repo branch of DevCon Team
- Built with my custom Linaro 4.9.3-2015.02 toolchain optimized for Cortex-A8
- Built with Cortex-A8 and NEON VFP optimization flags (both kernel and modules)
- Built with -O3 optimization flag (both kernel and modules)
- CPU overclockable up to 1824 MHz
- CPU frequencies undervolted (UV version) or extremely undervolted (EXUV version)
- CPU voltage control VDD sys interface (click for more details)
- Dynamic memory allocation of ION heaps through CMA (Contiguous Memory Allocator)
- Dynamic memory allocation of PMEM ADSP heap through CMA (Contiguous Memory Allocator)
- 426MB of free RAM
- Init.d support
- Fast Charge support (default disabled, click for more details)
- Battery Life eXtender support (default disabled, click for more details)
- Ram Console support (click for more details)
- TRIM support
- USB OTG support (if also implemented on rom side)
- Lowered display panel voltage
- Lowered vibetonz voltage
- Lowered wifi voltage
- Lowered swappiness (60 -> 45)
- Increased CPU frequency during boot
- Optimized AES and SHA1 routines for ARM cpu architecture
- Fixed 100% battery notification after charger unplug
- Increased audio volume on board side
- Con Kolivas' CK3 Tweaks
- Optimized SLUB memory allocator
- Optimized ARM RWSEM (read/write semaphore) algorithm
- Optimized asynchronous I/O latency on solid state disks
- Disabled Gentle Fair Sleepers for better UI performance
- CIFS support on boot
- Memory compaction
- Dynamic compression of clean pagecache pages
- Dynamic FSync v1.2 (click for more details)
- Dynamic dirty page writebacks (click for more details)
- VM tweaks for performance and less battery consumption
- Timer slack controller (click for more details)
- Dynamic management of the minimal timer slack value during suspend/resume (click for more details)
- LowMemoryKiller management of not killable processes (click for more details)
- exFAT support
- Additional TCP Congestion algorithms
- Updated ZRam, ZSMalloc, ZCache built-in modules
Available CPU governors:
- Adaptive
- BrazilianWax
- Conservative
- Hyper
- Intellidemand
- Interactive
- InteractiveX
- LionHeart
- LulzActive
- OnDemand (default)
- OnDemandX
- Performance
- Powersave
- SmartAssV2
Available I/O schedulers:
- BFQ
- CFQ
- Deadline
- Fiops
- Noop
- ROW (default)
- SIO
- V(R)
Kernel Downloads for Lollipop ION+PMEM ADSP:
K^Kernel LP-5.0 Mediafire Folder
[QRCODE]https://www.mediafire.com/folder/b82tiiw5u7hd7[/QRCODE]
- v2.0 -
for CM 12.0
and the other roms based on CM 12.0
Note: You must use the CWM recovery with new partition assignments you may find inside CM 12.0 thread by arco68.​
Howto install the kernel:
1) Download the preferred kernel zip file to sdcard or external sdcard
2) Reboot to recovery mode
3) Flash the kernel zip file
4) Reboot the system
Kernel sources (on GitHub):
Development branch of K^Kernel 3.4 for LP 5.0 ION+PMEM ADSP
​
Useful info:
- Special features and sysfs settings
- Frequently asked questions
​
Tables:
​
Changelog:
Code:
[B]11/03/2015 - K^Kernel 3.4 v2.0 for Lollipop ION+PMEM ADSP[/B]
- Kernel 3.4.106
- Built with my latest custom Linaro 4.9.3-2015.02 toolchain optimized for Cortex-A8
- defconfig: Switch to ROW I/O scheduler as default (credits to Christopher83)
- HID: input: generic hidinput_input_event handler (credits to David Herrmann)
- cpufreq: Avoid using global variable total_cpus (credits to Ruchi Kandoi)
- net/ping: handle protocol mismatching scenario (credits to Jane Zhou)
- net: ipv6: allow choosing optimistic addresses with use_optimistic (credits to Erik Kline)
- netfilter: IDLETIMER: fix invalid deference of timer (credits to JP Abgrall)
- prctl: make PR_SET_TIMERSLACK_PID pid namespace aware (credits to Micha Kalfon)
- crypto: arm-aes - fix encryption of unaligned data (credits to Mikulas Patocka)
- ARM: 8118/1: crypto: sha1/make use of common SHA-1 structures (credits to Jussi Kivilinna)
- ARM: 8119/1: crypto: sha1: add ARM NEON implementation (credits to Jussi Kivilinna)
- ARM: 8120/1: crypto: sha512: add ARM NEON implementation (credits to Jussi Kivilinna)
- defconfig: Enable NEON optimized SHA1 crypto routines (credits to Christopher83)
- defconfig: Build QCOM crypto device as built-in (credits to Christopher83)
- pstore: selinux: add security in-core xattr support for pstore and debugfs (credits to Mark Salyzyn)
- KEYS: close race between key lookup and freeing (credits to Sasha Levin)
- msm_fb: Fix RGB pipe offset issue (credits to Blefish)
- msm: mdp.c fix deadlock which causes blue screen (credits to Vinu Deokaran)
- msm: rq_stats: Use cpufreq API to get the current frequency (credits to Archana Sathyakumar)
- defconfig: Back to enforced SELinux (credits to Christopher83)
- staging: android: ashmem: add missing include (credits to Rom Lemarchand)
- net: wireless: bcmdhd: Remove WLAN_CIPHER_SUITE_AES_CMAC advertisement (credits to Dmitry Shmidt)
- gpu: ion: Refactor locking (credits to Srinivasarao P)
- gpu: ion: use a list instead of a tree for heap debug memory map (credits to Srinivasarao P)
- gpu: ion: fix locking issues in debug code (credits to Mitchel Humpherys)
- gpu: ion: add locking to traversal of volatile rb tree (credits to Srinivasarao P)
- gpu: ion: Delete invalid extra file (credits to Pradosh Das)
- drivers: video: msm: Cleanup some dead codes (credits to sirmordred)
- lz4: Revert previously applied commits (credits to Christopher83)
- decompressor: add LZ4 decompressor module (credits to Kyungsik Lee)
- lib: add support for LZ4-compressed kernel (credits to Kyungsik Lee)
- lib: add lz4 compressor module (credits to Chanho Min)
- lib/lz4: correct the LZ4 license (credits to Richard Laager)
- lz4: fix compression/decompression signedness mismatch (credits to Sergey Senozhatsky)
- lz4: ensure length does not wrap (credits to Greg Kroah-Hartman)
- lz4: fix another possible overrun (credits to Greg Kroah-Hartman)
- lz4: add overrun checks to lz4_uncompress_unknownoutputsize() (credits to Greg Kroah-Hartman)
- Update zram and zsmalloc up-to 3.17 kernel changes (credits to sirmordred)
- msm7x30: Remove high memory configurations (credits to Christopher83)
- msm7x30: Change all heap types to CMA (credits to sirmordred)
- msm7x30: Workaround deep sleep issue (credits to Christopher83)
- msm7x30: Increase ION memory heap for surfaceflinger (credits to Christopher83)
- defconfig: Update default and custom configurations (credits to Christopher83)
- f2fs: Sync F2FS to Jaegeuk's linux-3.4 branch (credits to Christopher83)
- selinux: fix inode security list corruption (credits to Stephen Smalley)
- Squashed update of kernel from 3.4.105 to 3.4.106 (credits to Christopher83)
- ipv4: try to cache dst_entries which would cause a redirect (credits to Hannes Frederic Sowa)
- USB: android: release spinlock before queuing work in android_setup (credits to Tarun Gupta)
- usb: gadget: Ignore the second set_config from the host (credits to ChandanaKishori Chiluveru)
- usb: android: Skip the work when set_config arrives with same value twice (credits to ChandanaKishori Chiluveru)
- usb: android: Fixup multiple lun support (credits to arco68)
- msm: camera: s5k4ecgx: Set mount angle from platform data (credits to sirmordred)
- USB: gadget: qdss: Fix strncmp length usage (credits to Kumar Gala)
- usb: android: Print LUN debug info (credits to Christopher83)
- Ramdisk updates (credits to Christopher83)
[B]31/12/2014 - K^Kernel 3.4 v1.0 for Lollipop ION+PMEM ADSP[/B]
- Kernel 3.4.105
- Built with my latest custom Linaro 4.9.3-2014.12 toolchain optimized for Cortex-A8
- ariesve: Set SELinux to be permissive (credits to Christopher83)
- defconfig: Set selinux permissive (credits to arco68)
- defconfig: Enable CONFIG_NETFILTER_XT_TARGET_IDLETIMER (credits to arco68)
- defconfig: Regenerate (credits to arco68)
- ext4: Add support for FIDTRIM, a best-effort ioctl for deep discard trim (credits to JP Abgrall)
- broadcom_wlan: Modify country code source (credits to arco68)
- net: ipv6: autoconf routes into per-device tables (credits to Lorenzo Colitti)
- netfilter: nf_conntrack: decrement global counter after object release (credits to Pablo Neira Ayuso)
- net: ipv6: Add a sysctl to make optimistic addresses useful candidates (credits to Erik Kline)
- Enable NEED_NETDEV for vendor command support. (credits to Subhani Shaik)
- cfg80211: ignore supported rates for nonexistant bands on scan (credits to Felix Fietkau)
- crypto: msm: check potential integer overflow (credits to William Clark)
- defconfig: Enable generic USB audio driver (credits to tobigun)
- i2c: chips: fsa9480: Add support for charging in USB-OTG mode (credits to tobigun)
- defconfig: Update custom defconfigs (credits to Christopher83)
- defconfig: Disable Frandom module (credits to Christopher83)
- i2c: chips: fsa9480: Add write-permission for USB-OTG charger type (credits to tobigun)
- Staging: android: binder: More offset validation. (credits to Arve Hjonnevag)
- fs: f2fs: Initial import from https://kernel.googlesource.com (credits to arco68)
- defconfig: Enable F2FS filesystem (credits to arco68)
Credits and Thanks to:
arco68, CastagnaIT and Ivendor for their awesome work and their kernel sources
Ezekeel, Doomlord, Faux123, Stratosk, Tegrak, ErasmuX, Imoseyon, Blefish, mikeioannina, Madridii and other devs I'm surely missing
CyanogenMod, Kernel.org, Code Aurora Forum, Google, Linaro GCC developers
XDA:DevDB Information
[GT-I8150][ION] K^Kernel 3.4 for LP 5.0 ION+PMEM ADSP, Kernel for the Samsung Galaxy W I8150
Contributors
Christopher83
Source Code: https://github.com/Christopher83/samsung-kernel-msm7x30/tree/cm-12.0
Kernel Special Features: Customized kernel 3.4.x for LP 5.0 rom (CM 12.0 and derivatives) with ION memory allocations
Version Information
Status: Stable
Current Stable Version: v2.0
Stable Release Date: 2015-03-11
Created 2014-12-31
Last Updated 2015-06-08
Special features and sysfs settings (Part 1):
Here you can find some useful scripts that can be used with the following described features:
Scripts​
CPU voltage control VDD sys interface
This feature allows to customize the voltage assumed by each cpu scaling frequency.
It could be useful if you'd like to decrease one or more voltages for battery saving purposes (undervolting), or to increase/adjust them to prevent phone freezes (overvolting).
How to customize the voltages:
1) By downloading and using Trickster MOD or IncrediControl and changing the voltages table inside the SVS tab
2) By using customized init.d scripts (the custom values will be always restored after a reboot, if you don't format the system partition)
- Download one of the script named 01vdd_levels*
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your customized voltages, where each line has this syntax
Code:
echo "[I][B][COLOR="Blue"]cpu_freq_HZ[/COLOR][/B][/I] [I][COLOR="SeaGreen"][B]mV[/B][/COLOR][/I]" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
cpu_freq_HZ is the cpu frequency in Hz you'd like to change
mV is the voltage you want to set
For example, the following line means that when the cpu frequency is 1516800 Hz = 1516 MHz, the voltage used will be 1175 mV
Code:
echo "1516800 1175" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By using Terminal Emulator (note that the values you set will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands
Code:
su
# Run a command for each cpu frequency voltage you'd like to change
echo "[I][B][COLOR="Blue"]cpu_freq_HZ[/COLOR][/B][/I] [I][COLOR="SeaGreen"][B]mV[/B][/COLOR][/I]" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
cpu_freq_HZ is the cpu frequency in Hz you'd like to change
mV is the voltage you want to set
For example, the following line means that when the cpu frequency is 1516800 Hz = 1516 MHz, the voltage used will be 1175 mV
Code:
echo "1516800 1175" > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
Alternative Extreme Undervolted (ExUV) settings
If after overclocking your I8150 you noticed some freezes when on ExUV kernel builds, you may use an alternative extremely undervolted setting with the init.d script you can find here: 01vdd_levels_alt_exuv
- Download the script
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
Force Fast Charge
This feature allows you to force AC charging for any charger that is detected as USB (eg. PC USB ports, USB Car Chargers) and pull the full current the charger can support, in such a way as to speed up the time required for a complete battery recharge.
By enabling this feature, the USB / ADB data transfers will be disabled (security limitation to protect your data).
How to enable/disable the Force Fast Charge:
1) By using the related setting inside System->Advanced->Force Fast Charge (only on CM 10 Beta 3 and next releases)
2) By downloading and using Trickster MOD or IncrediControl or NsTools
2) By directly editing the file /sys/kernel/fast_charge/force_fast_charge and setting 1 to enable the force charge, 0 to disable it (note that set value will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run this command to enable the force fast charge feature
Code:
su
echo 1 > /sys/kernel/fast_charge/force_fast_charge
- Then, when you want to restore the normal status, run this command to disable the force fast charge feature
Code:
su
echo 0 > /sys/kernel/fast_charge/force_fast_charge
4) By using a customized init.d script, but I don't recommend it because you have to remember to disable the feature every time you want to connect your device to a pc for data transfering after every reboot
Battery life extender (BLX)
This feature has been developed by Ezekeel and allows to set a customized battery charging limit (100% is the default stock value, if you want, you can set a lower value).
As Ezekeel said, it is commonly accepted that both very low and very high charge states accelerate the degradation of the battery capacity (that is why you should store Li-Ion batteries at around 40% charge).
If you set a charging limit equal to 100, this feature will be disabled.
How to activate this feature and set a customized charging limit:
1) By downloading and using Trickster MOD or NsTools by setting the customized battery life extender charging limit
2) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 15blx
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred charging limit (the downloaded script will set the charging limit to 95%)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
3) By directly editing the file /sys/class/misc/batterylifeextender/charging_limit (the value you set will be lost after a reboot/shutdown)
4) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands (changing the charging limit = 95 with the preferred one)
Code:
su
echo 95 > /sys/class/misc/batterylifeextender/charging_limit
LowMemoryKiller
The LowMemoryKiller driver is used to kill a selected process and free the memory when it is under one of the defined thresholds.
The tuning of the driver could be achieved by means of two parameters exposed by the kernel module via sysfs interface:
- /sys/module/lowmemorykiller/parameters/minfree
This file includes a comma separated array of the threshold numbers for minfree memory size (in page units).
- /sys/module/lowmemorykiller/parameters/adj
This file includes the comma separated array of oomadj factors, if the corresponding minfree threshold has been reached, one of the process with an oomadj greater than this number will be killed.
The oomadj factor is a property associated to each process, its value is in a range from -17 to +15, the processes with a higher oomadj factor will be the first to be killed when a specific minfree threshold has been reached.
RAM Console
This feature is useful expecially for development and debugging purposes, when occurs kernel panic / unexpected shutdowns or reboots. Pratically, the kernel messages are also stored inside a little RAM portion and restored during reboot after a kernel panic, inside the file /proc/last_kmsg.
Dynamic FSync
This feature has been developed by Faux123 and allows to dynamically manage the synchronous writes performed on file system (FSync).
It uses asynchronous writes when the screen is on, instead of synchronous writes, to have better performance and a slightly lower battery drain, while when the screen is off the synchronous writes are re-enabled to flush all the outstanding writes and prevent possible data loss.
How to enable/disable the Dynamic FSync (default enabled):
1) By downloading and using Trickster MOD
2) By directly editing the file /sys/kernel/dyn_fsync/Dyn_fsync_active and setting 1 to enable the dynamic fsync, 0 to disable it (note that set value will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run this command to disable the dynamic fsync feature
Code:
su
echo 0 > /sys/kernel/dyn_fsync/Dyn_fsync_active
- Or run this command to re-enable the dynamic fsync feature
Code:
su
echo 1 > /sys/kernel/dyn_fsync/Dyn_fsync_active
Dynamic dirty page writebacks
This feature has been developed by me and allows to dynamically manage the dirty page writebacks with two different intervals, one when the screen is on and another when the screen is off.
It is based on a commit of Francisco Franco, but instead of using hard coded values and of disabling at all the dirty page writebacks while the screen is on (possibility of data loss), I preferred to use a customizable higher dirty page writebacks interval (15 seconds) than the default one (5 seconds) while the screen is on and a customizable default interval (5 seconds) when the screen is off.
By using a higher interval we have better performance and less battery consumption, with a very low risk of data loss.
How to customize the dynamic dirty page writebacks feature (default enabled):
Three new procfs parameters are exposed inside /proc/sys/vm path:
- dynamic_dirty_writeback is the activation status of this feature, set 1 to enable it, set 0 to disable it and use the standard behaviour
- dirty_writeback_active_centisecs is the interval for the dirty page writebacks when the system is active (screen on), the default value is 1500 centisecs (15 seconds)
- dirty_writeback_suspend_centisecs is the interval for the dirty page writebacks when the system is suspended (screen off), the default value is 500 centisecs (5 seconds)
In my kernel builds, during boot, I set other customized values:
- an interval of 30 seconds while the screen is on
- an interval of 10 seconds when the screen is off
1) By directly editing one of the file written above inside /proc/sys/vm and setting the preferred value (note that set value will be lost after a reboot/shutdown)
2) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run this command to disable the dynamic dirty page writebacks feature
Code:
su
echo 0 > /proc/sys/vm/dynamic_dirty_writeback
- Or run this command to re-enable the dynamic dirty page writebacks feature
Code:
su
echo 1 > /proc/sys/vm/dynamic_dirty_writeback
- Run this command to set customize the two intervals (30 seconds while the screen is on, 10 seconds when the screen is off)
Code:
su
echo "3000" > /proc/sys/vm/dirty_writeback_active_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_suspend_centisecs
Special features and sysfs settings (Part 2):
Timer slack controller and dynamic management of the minimal timer slack value
The timer slack controller is a feature developed by Kirill Shutemov and it allows to set the minimal timer slack value for every process contained within a control group (cgroup).
A timer slack allows the kernel to manage processes wakeup requests at some future time.
Thanks to this feature, the kernel can set a specific timer slack for the involved processes, minimizing the number of wakeups and allowing a lower system's power consumption.
For further info: Timer slack for slacker developers
I also implemented a new feature in addition to the above one that allows the dynamic management of the minimal timer slack value.
So, it's possible to use different minimal timer slack value when the system is active and when has been suspended.
How to customize the dynamic timer slack controller feature:
Three new cgroup parameters are exposed inside each processes hierarchy contained in /dev/cpuctl path:
- timer_slack.min_slack_ns is the timer slack used when the system is active for the current processes hierarchy
- timer_slack.min_slack_suspend_ns is the timer slack used when the system is suspended for the current processes hierarchy
- timer_slack.effective_slack_suspend_ns is the timer slack currently used
At the moment, the values chosen and used by K^Kernel are the following:
- core processes (/dev/cpuctl), 0 ns when the system is active, 50000 ns when the system is suspended
- foreground apps/processes (/dev/cpuctl/apps), 0 ns when the system is active, 250000 ns when the system is suspended
- background non interactive apps/processes (/dev/cpuctl/apps/bg_non_interactive), 100000000 ns when the system is active, 250000000 ns when the system is suspended
1) By directly editing one of the file written above inside /dev/cpuctl and inside each hierarchy subfolder, by setting the preferred value (note that set value will be lost after a reboot/shutdown)
2) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands to set the minimal timer slack for generic and core apps/processes
Code:
su
echo 0 > /dev/cpuctl/timer_slack.min_slack_ns
echo 50000 > /dev/cpuctl/timer_slack.min_slack_suspend_ns
- Run these commands to set the minimal timer slack for apps/processes in foreground
Code:
su
echo 0 > /dev/cpuctl/apps/timer_slack.min_slack_ns
echo 100000 > /dev/cpuctl/apps/timer_slack.min_slack_suspend_ns
- Run these commands to set the minimal timer slack for apps/processes in background and non interactive
Code:
su
echo 100000000 > /dev/cpuctl/apps/bg_non_interactive/timer_slack.min_slack_ns
echo 250000000 > /dev/cpuctl/apps/bg_non_interactive/timer_slack.min_slack_suspend_ns
LowMemoryKiller management of not killable processes
This feature allows to define processes and system processes white-lists filled with the preferred process names and to not be killed by lowmemorykiller, unless it is absolutely necessary.
This feature exposes four new lowmemorykiller parameters:
- donotkill_proc, is the flag to enable / disable this feature for the processes chosen by the user
- donotkill_sysproc, is the flag to enable / disable this feature for the system processes chosen by the user
- donotkill_proc_names, is the list of process names (comma separated) chosen by the user to be preserved from killing
- donotkill_sysproc_names, is the list of user system process names (comma separated) chosen by the user to be preserved from killing
When the lowmemorykiller needs to free ram, it will first kill the processes not included inside the two process name lists chosen by the user.
If there are no more standard killable processes, then it will be necessary to kill one of the processes included inside one of the two white-lists, to prevent system hangs, slowdowns, etc.
How to customize the white lists of processes to preserve from killing:
On K^Kernel the feature is enabled by default and the provided processes white lists are the following:
- donotkill_proc_names = "com.cyanogenmod.trebuchet,com.anddoes.launcher,com.teslacoilsw.launcher,org.adwfreak.launcher,gtp.nextlauncher,android.inputmethod.latin,com.touchtype.swiftkey"
this means that Trebuchet Launcher, Apex Launcher, Nova Launcher, ADW Launcher, Next Launcher, stock keyboard and SwiftKey keyboard will be preserved from killing
- donotkill_sysproc_names = "android.process.acore,com.android.phone,com.bel.android.dspmanager"
this means that the system process, the phone process and DSP Manager will be preserved from killing
1) By using a customized init.d script (the custom value will be always restored after a reboot, if you don't format the system partition)
- Download the script named 80dnkp
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred status and processes list
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
2) By directly editing the files inside /sys/module/lowmemorykiller/parameters (note that set values will be lost after a reboot/shutdown)
3) By using Terminal Emulator (note that set values will be lost after a reboot/shutdown)
- Open Terminal Emulator
- Run these commands if you want to enable the feature
Code:
# To enable this feature for the processes chosen by the user
echo 1 > /sys/module/lowmemorykiller/parameters/donotkill_proc
# To enable this feature for the system processes chosen by the user
echo 1 > /sys/module/lowmemorykiller/parameters/donotkill_sysproc
- Run these commands if you want to disable the feature
Code:
# To disable this feature for the processes chosen by the user
echo 0 > /sys/module/lowmemorykiller/parameters/donotkill_proc
# To disable this feature for the system processes chosen by the user
echo 0 > /sys/module/lowmemorykiller/parameters/donotkill_sysproc
- Run this command if you want to add, for example, Trebuchet Launcher (CM default launcher) and the default keyboard to the processes white list
Code:
echo "com.cyanogenmod.trebuchet,android.inputmethod.latin" > /sys/module/lowmemorykiller/parameters/donotkill_proc_names
- Run this command if you want to add, for example, the system process, the phone process and DSP Manager to the system processes white list
Code:
echo "android.process.acore,com.android.phone,com.bel.android.dspmanager" > /sys/module/lowmemorykiller/parameters/donotkill_sysproc_names
ZRAM module
As explained on Wikipedia, this feature, provided in this kernel as a standalone loadable module, increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive.
In few words, the memory pages no more used and so to be swapped are sent to zRam device blocks, compressed and stored in memory instead of disk allowing better performance and also lower memory usage, on the other hand, a little higher amount of cpu is needed to perform compression and decompression of memory pages.
Since we have a device with a low amount of free memory, this feature could be useful to have more free ram.
How to change the size of zRam or to disable it (thanks to @ktulu84 for sharing these scripts):
To change the size of zRam (the custom value will be always restored after a reboot, if you don't format the system partition):
- Download the script named 60zram
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Edit the file by setting your preferred zRam size (change SIZE value, default is 100 MB)
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
If you want to use default zRam size, simply remove the file placed inside /etc/init.d and reboot.
To disable zRam (the custom value will be always restored after a reboot, if you don't format the system partition):
- Download the script named 60disable_zram
- If the file has been saved with .txt extension (stock browser), rename it by removing the .txt extension
- Copy the new file inside /etc/init.d
- Give the rwxr-xr-x permissions to the file (read, write, execution for owner, read and execution for group users, read and execution for others)
- Reboot
If you want to re-enable zRam, simply remove the file placed inside /etc/init.d and reboot.
FAQ - Frequently asked questions:
Q: What are the differences between EXUV and UV kernel versions?
A: The EXUV kernel versions have extremely undervolted settings for the cpu frequencies, they allows to have a very low battery drain, instead the UV kernel versions have undervolted settings a bit higher than EXUV versions, but always lower than stock kernel settings.
The EXUV kernel versions could give some problems (freezes, shutdowns, huge lags) on some devices because the cpu doesn't support too low voltage settings.
For a lower battery consumption, I suggest you to try EXUV versions first and to switch to UV versions only if you encounter one of the above mentioned problems.
Q: For v1.0 kernel builds, what are the differences between 396MB, 406MB and 416MB versions?
A: 396MB, 406MB and 416MB kernel versions have different free ram available for user space, with a higher free ram your device will work better with heavy apps, many concurrently used apps, heavy games, etc.
- 396MB versions are more stable, everything is fully working, but you could have some slowdowns with apps that require a high amount of free memory.
- 406MB versions have additional 10 MB of free ram, they are suitable for the users that use the device primarly for calls, messages, simple apps and simple games. The camera, video recording (both 480p and 720p modes) and video playback are fully working.
- 416MB versions have additional 20 MB of free ram, they are suitable for the users that use the device also with heavy apps, various concurrently used apps and games. The camera, video recording (both 480p and 720p modes) and video playback are fully working.
Q: How can I get the Performance and Developer Options entries inside Settings menu?
A: Go inside Settings -> About Phone -> Scroll down and tap 7 times on Build number (it's an Easter Egg).
Q: How can I get the log after an unexpected shutdown / reboot?
A: After an unexpected shutdown / reboot of the device, if the problem may be kernel related, you should have the /proc/last_kmsg, if so, send me that log and I'll check it to find the possible cause of the problem.
Q: How can I get the logs when I encounter strange system issues while it's running?
A: Check first if the problems could be related to an app you're using and if you changed something in the last days before facing those issues.
If the problem started after installing the kernel, then let me have you logcat and dmesg:
- Open Terminal Emulator and execute these commands:
Code:
su
dmesg > /sdcard/dmesg.txt
locat -v time -d > /sdcard/logcat.txt
- Open you preferred file manager and go inside the internal sd card partition /sdcard
- Send me the dmesg.txt and logcat.txt files, if you want zip them first
Q: How can I mount a shared Windows folder with CIFS module?
1) By using Terminal Emulator
Code:
mount -o unc=\\\\[COLOR="DarkGreen"][I]ip[/I][/COLOR]\\[COLOR="Blue"][I]share[/I][/COLOR],noserverino,username=[I][COLOR="DarkOrange"]user[/COLOR][/I],password=[I][COLOR="Lime"]password[/COLOR][/I] -t cifs //[COLOR="DarkGreen"]ip[/COLOR]/[COLOR="Blue"]share[/COLOR] [I][COLOR="DarkSlateGray"]/mnt/cifs[/COLOR][/I]
2) Downloading and using CifsManager and configuring the new share as follow:
- Share Path = ip/share
- Mount Point = /mnt/cifs/share
- Username = username
- Password = password
- Options = unc=\\\\ip\\share,noserverino
Where:
ip is the ip address of your pc where the folder is shared
share is the shared folder name
user is the user name that can access the shared folder
password is the user password
/mnt/cifs is the mount point (must be created if you'd like to use the command approach with Terminal Emulator)
Reserved, just in case...
Notorious as always. Thanks, Christopher!
Awesome!!! I'll update my W soon *_*
P.s. Happy new year!!!
Wow! I bet this is your first 2015 kernel post
Sent from my GT-S6500 using XDA Free mobile app
Wow, so fast sir. You are the king of kernel :thumbup:
Chris, you're impeccable. Thanks for support.
i download n instal this kernel, but i got some trouble when i try to find Performance Setting.
i do have Developers Setting, but for Performing Setting i can't figure it where.
sorry for my bad english
Sent from indONEsia
ka12el said:
i download n instal this kernel, but i got some trouble when i try to find Performance Setting.
i do have Developers Setting, but for Performing Setting i can't figure it where.
sorry for my bad english
Sent from indONEsia
Click to expand...
Click to collapse
There is no performance settings at the moment in cm12. As an alternative use performance control
ilusi0n_ said:
There is no performance settings at the moment in cm12. As an alternative use performance control
Click to expand...
Click to collapse
thanks for your respon
but why on Q&A first page say i can get dev setiing and perform setting with press 7 times on build number.
ok i try the apps
thank you so much
Sent from my GT-I8150 using XDA Free mobile app
ka12el said:
thanks for your respon
but buy on Q&A first page say i can get dev setiing and perform setting with press 7 times on build number.
ok i try the apps
thank you so much
Sent from my GT-I8150 using XDA Free mobile app
Click to expand...
Click to collapse
Performance settings does not appear because cyanogenmod didn't implement it when Arco compile the rom for us. In a future build, the rom will have the performance settings.
Today I get kernel wakelock from apps wakelock detector
It is "rpc_read" wakelock about 12 h
Im using your kernel, christopher
Thank you
Is it working with the latest cm12?
riyosakura said:
Is it working with the latest cm12?
Click to expand...
Click to collapse
Yes it is.
riyosakura said:
Is it working with the latest cm12?
Click to expand...
Click to collapse
I think it should not be used, because it is not in sync with the latest changes in CM12
* Waiting for the new version update .
huongthanh8690 said:
I think it should not be used, because it is not in sync with the latest changes in CM12
* Waiting for the new version update .
Click to expand...
Click to collapse
you think so? i already flashed it lol.
so far so good though.
huongthanh8690 said:
I think it should not be used, because it is not in sync with the latest changes in CM12
* Waiting for the new version update .
Click to expand...
Click to collapse
using it with no problems.

Skinny Pro Custom Boot Images

What is Skinny Pro?
This is not for NOOBS - it breaks functionality in Xiaomi apps that try to communicate back to head office. This is an intentional feature and is for people who are not interested in being part of the Xiaomi ecosphere. LEAVE NOW if you have, or intend to log on to Xiaomi and use their services!!!!
Skinny does not magically fix poor choice of ROMs, Apps or lack of knowledge.
It is not a custom Kernel - it is a custom boot.img containing modified initialization scripts for the stock kernel.
There are 2 distinct versions:
Based on 7.1.4.0 - Use for 7.1.xx to 7.3.20 (MIUI7) Support discontinued since V7 (O.P no longer applies to this version)
Based on MIUI8 - use for MIUI7.5.x and MIUI8
Design Brief:
No Placebos
To overcome the limitations of Stock MIUI being:
Poor battery life
Poor performance
Chronic invasion of privacy
Boot.img mods:
Disable starting of non-present devices and services
Disable stock recovery overwriting TWRP
Disable OTA services (no use on a modified ROM)
Disable starting of invasive (spying) services
Disable fingerprint sensor infrastructure (not for our device)
Disable find device infrastructure
Disable second space infrastructure
Build in init.d support
Enable zram swap creation (disable conflicting "mcd" service infrastructure)
Mass Storage Device mode added for external SDCard
Improved TCP Buffer values
Reconfigured internal SDCard suppport to remove uneccessary symlinks
Reduce cpu scheduler, foreground and background tasks deadtime (throttling)
Add some Android 6.0 TCP tweaks
Expose LMK and HPS settings for user configuration
What you will see:
Faster boot
Less background activity at idle
Less RAM usage
Less spying/reporting activity
Better battery life
Better Performance
More reliable and faster data speeds
Install your chosen ROM and get it past the first setup screens before flashing a Skinny Boot image.
If you really must install Xposed, install this after the Skinny boot image.
Do not install "kernel" tweaking apps - they will conflict with the inherent settings in Skinny!
No wipes are necessary after installing the boot.img
What else do I need to do?
First, an explanation as to why we need to set everything the way it is:
The cpu is controlled by 4 separate mechanisms:
1. Thermal throttling - will limit frequencies and shut down cores to stay within safe operating temperatures - will override all other mechanisms. Settings available: High Performance (less strict) or Balanced (default)
2. Performance Server - will temporarily boost freqs and cores depending on detected conditions such as screen touch, screen update or rotate, app open. Limited settings available via /etc/perfservscntbl.txt
3. Hotplugging Service - will add or remove cpu cores as load requires. Some settings are accessible through /proc/hps/
4. Interactive Governor - will throttle freqs up and down based on load and add or remove cores also. Some settings are accessible through /sys/devices/system/cpu/cpufreq/interactive/
You will notice there are competing and often contradicting mechanisms. The factory defaults essentially disable the Interactive governor as being the primary source of initial boosting cpu freqs. The "boost" setting normally found in the governor is non-functional - instead, the Perf Server will boost to 2 cores @ 1183MHz when a potential demand for processing power is detected apart from a simple screen touch. The interactive governor will take over scaling the freq and number of cores after the perf server boost period expires or load demands more cpu power than the boost caters for.
Since the Performance Server tends to over-react, setting 2 cores @ 1183MHz for the smallest of events, we disable it completely by manually editing the existing line in /system/build.prop from:
ro.mtk_perfservice_support=1 to ro.mtk_perfservice_support=0
You must do this yourself - this is vital since all further Governor and Hotplug settings rely upon it being disabled.
Editing /etc/perfservscntbl.txt is not required since this file will no longer be processed.
The settings for the Interactive Governor and Hotplug are modified from factory default to correct a couple of serious problems:
1. The cpu will not reliably throttle back to idle at 403MHz. This has a huge impact on battery.
This is caused by the timer_rate setting being too short allowing transient background activities to trigger scaling the freq up. Increasing the time effectively averages out the transient load spikes so the cpu will not break idle unnecessarily.
2. The cpu does not respond to increasing or decreasing load fast enough creating micro-lags and consuming battery. Reducing the min_sample_time will shorten the time taken for the cpu to lower in freq when load drops off. Reducing the above_hispeed_delay will reduce the response time to increase the cpu freq in response to a load. Both of these settings also compensate for the longer than standard timer_rate that introduces some sluggishness by necessity.
All other values are set to encourage the frequency and number of cores to rapidly and reliably return to idle to save battery while still providing sufficient responsiveness to sudden load demands.
Create an init.d script exactly as follows: (premade file 01_init also available to download)
Code:
#!/system/bin/sh
### CPU freqs standard RN2: 403000, 806000, 1183000, 1326000, 1469000, 1625000, 1781000, 1950000
### CPU freqs PRIME RN2: 403000, 806000, 1183000, 1326000, 1482000, 1664000, 1885000, 2158000
### GPU freqs standard RN2: 253500, 299000, 390000, 442000, 546000
### GPU freqs PRIME RN2: 253500, 338000, 390000, 546000, 676000
# Stop running boot-time services (enable the lines for services you want to stop)
#stop sn # USB serial number allocation
#stop wifi2agps # WiFi assisted GPS (for fine location)
#stop agpsd # Mobile Network assisted GPS (for fine locastion)
#stop emsvr_user # Engineering Mode server
#stop PPLAgent # Privacy Protection Lock
#stop mtkbt # MTK Bluetooth
#stop batterywarning # Battery warning service
#stop debuggerd64 # debug logging
#stop debuggerd # debug logging
#stop logd # logging
#stop autokd # autotune for WiFi
#Set to permissive (enable this line if SE permissive mode is required)
# setenforce 0
# Tweak Interactive Governor (now set in boot.img - enable here to override values)
#echo 403000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq # factory default 1183000
#echo 99 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load # factory default 99
#echo 99 > /sys/devices/system/cpu/cpufreq/interactive/target_loads # factory default 90
#echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate # factory default 20000
#echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time # factory default 20000
#echo 5000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay # factory default 20000
#echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack # factory default 80000
# Limit CPU max freqs (To limit the maximum cpu freq, enable both of these lines. Select a valid freq for your device from table at start)
#echo 1781000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#echo 1781000 > /proc/cpufreq/cpufreq_limited_max_freq_by_user
# Limit foreground CPU cores (set in boot.img - enable here to override values) 0-1 min, 0-7 max Example shows 5 cores (also needs to be set in Hotplug)
#echo 0-4 > /dev/cpuset/foreground/cpus
# Hotplug settings (set in boot.img - enable here to override values) Note: num_limit values are 1-8
#echo 5 > /proc/hps/num_limit_low_battery # factory default 8
#echo 5 > /proc/hps/num_limit_power_serv # factory default 8
#echo 5 > /proc/hps/num_limit_thermal # factory default 8
#echo 5 > /proc/hps/num_limit_ultra_power_saving # factory default 8
#echo 99 > /proc/hps/up_threshold # factory default 95
#echo 87 > /proc/hps/down_threshold # factory default 85
#echo 0 > /proc/hps/rush_boost_enabled # factory default 1
#echo 0 > /proc/hps/input_boost_enabled # factory default 1
# Tweak GPU Settings (Look in /proc/gpufreq/gpufreq_power_dump for power usage at different freqs)
# To disable GPU touch boost:
#echo 0 > /proc/gpufreq/gpufreq_input_boost # factory default 1 (enabled)
# To limit max GPU freq: (Select a valid freq for your device from table at start)
#echo 442000 > /proc/gpufreq/gpufreq_opp_max_freq # factory default 0 (disabled)
# Tweak VM (set in boot.img - enable here to override values)
#echo 300 > /proc/sys/vm/dirty_expire_centisecs # factory default 200
#echo 500 > /proc/sys/vm/dirty_writeback_centisecs # factory default 300
# Tweak LMK (set in boot.img - enable here to override values) 18 37 56 75 93 112MB # factory default 72 90 108 126 219 317MB (MB x 256 = value)
#echo 4608,9472,14336,19200,23808,28672 > /sys/module/lowmemorykiller/parameters/minfree
#Enable zram (no zram set by default, enable first 4 lines if 1 zram required, all 7 lines if 2 zram required)
#echo 40 > /proc/sys/vm/swappiness
#echo 268435456 > /sys/block/zram0/disksize # for single zram: 536870912 = 512MB (for non-prime version) 1073741824=1GB (for prime version)
#/system/xbin/busybox mkswap /dev/block/zram0
#/system/xbin/busybox swapon /dev/block/zram0
#echo 268435456 > /sys/block/zram1/disksize # for 2 zrams: 268435456 = 256MB (for non-prime version) 536870912 = 512MB (for prime version)
#/system/xbin/busybox mkswap /dev/block/zram1
#/system/xbin/busybox swapon /dev/block/zram1
# Tweak IO Scheduler (set in boot.img - enable here to override values)
#echo deadline > /sys/block/mmcblk0/queue/scheduler # factory default cfq (choice: noop deadline cfq)
#echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb # factory default 128 Choose between 128, 256, 512, 1024, 2048
#echo 0 > /sys/block/mmcblk0/queue/add_random # factory default 1
#echo 0 > /sys/block/mmcblk0/queue/iostats # factory default 1
#echo deadline > /sys/block/mmcblk1/queue/scheduler # for ext sdcard (sdcard1)
#echo 2048 > /sys/block/mmcblk1/queue/read_ahead_kb # for ext sdcard (sdcard1)
#echo 0 > /sys/block/mmcblk1/queue/add_random # for ext sdcard (sdcard1)
#echo 0 > /sys/block/mmcblk1/queue/iostats # for ext sdcard (sdcard1)
#Tweak Entropy (set in boot.img - enable here to override values)
#echo 384 > /proc/sys/kernel/random/read_wakeup_threshold # factory default 64
#echo 448 > /proc/sys/kernel/random/write_wakeup_threshold # factory default 128
#Tweak for wifi router connection issues
#echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
# Disable debugging on some modules (set in boot.img - enable here to override values)
#echo 0 > /sys/module/alarm_dev/parameters/debug_mask;
#echo 0 > /sys/module/alarmtimer/parameters/debug_mask;
#echo 0 > /sys/module/binder/parameters/debug_mask;
#echo 0 > /sys/module/earlysuspend/parameters/debug_mask;
#echo 0 > /sys/module/sbsuspend/parameters/sbsuspend_debug_mask;
#echo 0 > /sys/module/snd/parameters/debug;
#echo 0 > /sys/module/pvrsrvkm/parameters/gPVRDebugLevel;
#echo 0 > /sys/module/musb_hdrc/parameters/debug_level;
#echo 0 > /sys/module/lowmemorykiller/parameters/debug_level;
#FSTRIM
busybox fstrim /data
busybox fstrim /system
busybox fstrim /cache
Update BusyBox to version 1.25.1-1 (available to download)
Reduce the number of apps and services needlessly starting automatically at boot. Uninstall or freeze bloat apps. Replace "noisy" apps with better written ones.
Use BetterBatteryStats, WakelockDetector Root or similar to understand what invisible activities are consuming battery.
Use SDMaid, DisableServices, MyAndroidTools or similar to disable autostarts (receivers)and app related services. Use with caution.
To see what boot services are running, type getprop in Terminal. You will see a bunch of entries like [init.svc.66xx_launcher]: [running]
These service must remain running do not stop!:
Code:
[init.svc.66xx_launcher]: [running]
[init.svc.MtkCodecService]: [running]
[init.svc.NvRAMAgent]: [running]
[init.svc.aal]: [running]
[init.svc.ccci_fsd]: [running]
[init.svc.ccci_mdinit]: [running]
[init.svc.drm]: [running]
[init.svc.fuelgauged]: [running]
[init.svc.gsm0710muxd]: [running]
[init.svc.guiext-server]: [running]
[init.svc.healthd]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.lmkd]: [running]
[init.svc.media]: [running]
[init.svc.mnld]: [running]
[init.svc.netd]: [running]
[init.svc.ril-daemon-mtk]: [running]
[init.svc.sdcard]: [running]
[init.svc.servicemanager]: [running]
[init.svc.shelld]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.thermal]: [running]
[init.svc.thermald]: [running]
[init.svc.ueventd]: [running]
[init.svc.vold]: [running]
[init.svc.zygote]: [running]
[init.svc.zygote_secondary]: [running]
[init.svc.bmi160d]: [running]
If you only have 1 SIM, it is highly recommended to go into single SIM mode to turn off the second modem service. Edit build.prop existing line from:
persist.radio.multisim.config=dsds to persist.radio.multisim.config=ss
Turn off Developer Options/Memory Optimization and MIUI Optimization. This is a legacy of the mcd service zram configuration that is disabled.
Removal of Apps that are created by symlinks: (Updated information for any ROM version can be found in ROM \META-INF\com\google\android\updater-script)
Uninstall the app where possible and then delete the leftover libs if they exist.
Code:
[B]MAB[/B]
/system/lib/libDToken.so
/system/lib/libNative.so
/system/lib/libShopSigned.so
/system/lib/libentryexpro.so
/system/lib/libsecuritysdk-3.1.27.so
[B]Jeejen[/B]
/system/lib/libJeejenAisound.so
/system/lib/libbspatch.so
/system/lib/libfamily_jni.so
/system/lib/libgetuiext.so
/system/lib/libjeejenmsc.so
[B]MIUI Video[/B]
/system/lib/libDecRes_sdk.so
/system/lib/libminivenus.so
/system/lib/libmresearch.so
/system/lib/libsecurities_sdk.so
[B]Cleanmaster[/B]
/system/lib/libTmsdk-2.0.9-mfr.so
/system/lib64/libTmsdk-2.0.9-mfr.so
/system/lib/libdce-1.1.14-mfr.so
/system/lib64/libdce-1.1.14-mfr.so
/system/lib/libkcmutil.so
/system/lib/libkcmutilex.so
/system/lib/libsic_helper.so
[B]SecondSpace[/B]
/system/lib/libspaces_jni.so
[B]Sogou Input[/B]
/system/lib/libwebp.so
/system/lib/libweibosdkcore_sogou.so
[B]AMAP Network Location[/B]
/system/lib64/libapssdk.so
[B]YellowPage[/B]
/system/lib64/libdidi_secure.so
[B]XMPass[/B]
/system/lib64/libxmpass_sdk_patcher.so
/system/lib64/xmpass_libweibosdkcore.so
[B]PicoTTS[/B]
/system/lib64/libttscompat.so
/system/lib64/libttspico.so
[B]Miui Gallery[/B]
/system/lib64/libwrapnexpcmcalbody.so
/system/lib64/libnexralbody_audio.so
/system/lib64/libnexcralbody_mc_jb.so
/system/lib64/libnexeditorsdk.so
/system/lib64/libPinguoImageSDK.so
/system/lib64/libMiuiGalleryNSGIF.so
/system/lib/libMiuiGalleryNSGIF.so
/system/lib64/libDexHelper.so
[B]MIUI Scanner[/B]
/system/lib64/libQuadrangleRecognizer.so
/system/lib64/libhw_instanttrans.so
/system/lib64/libhwocr_cntools_shared.so
/system/lib64/libsgmain.so
/system/lib64/libsgmainso-5.1.2011.so
/system/lib64/libtbdecode.so
Remove inbuilt virus scanner(s)
Remove GuardProvider.apk and SecurityAdd.apk plus:
Code:
/system/lib64/libams-1.1.7-m-mfr.so
/system/lib64/libams-1.1.7-mfr.so
/system/lib64/libavast-utils.so
/system/lib64/libavast-vps-interface.so
/system/lib64/libavlasys.so
/system/lib64/libavlm.so
/system/lib64/libavlurl.so
Extra libs that can be removed: (if associated apps are removed)
Code:
[B]Lib:[/B]
libfdpp.so Find Device
libfdpp_jni.so Find Device
libffmpeg-miplayer.so Music / MIUIVideo
libhotknot.so
libhotknot_vendor.so
libnfc_ndef.so
libpatcher_game_jni.so
libpatcher_jni.so
libvoicerecognition.so Voice Extensions
libvoicerecognition_jni.so Voice Extensions
libwhetstone_jni.so
libwhetstone_sdk.so
libxiaomimediaplayer.so Music / MIUIVideo
libxiaomiplayerwrapper.so Music / MIUIVideo
[B]Lib64:[/B]
libBaiduMapSDK_base_v4_0_0.so
libBaiduMapSDK_search_v4_0_0.so
libBaiduMapSDK_util_v4_0_0.so
libBankCardRecognizer.so
libduokantext.so
libfdpp.so Find Device
libfdpp_jni.so Find Device
libhotknot.so
libhotknot_vendor.so
libidcardquality_v1.0.3.so
libjni_latinimegoogle.so Google Keyboard
libjni_pacprocessor.so
libjni_unbundled_latinimegoogle.so Stock Keyboard
libnfc_ndef.so
libpatcher_game_jni.so
libpatcher_jni.so
libprintspooler_jni.so Print Spooler
libtbtv3312.so
libTrafficRadar.so
libttscompat.so Pico TTS
libttspico.so Pico TTS
libunipaychsec.so
libweibosdkcore.so
libwhetstone_jni.so
libwhetstone_sdk.so
[B]/vendor/lib64:[/B]
libcom_fingerprints_productiontestmanager.so
libcom_fingerprints_sensor.so
Skinny Pro All versions:
https://drive.google.com/folderview?id=0BwdRTuyj12_yRk9Kcm1pZkxuZzg&usp=sharing
Enjoy
@jajk Awesome work! Do you intend to work on the aosp boot.img much or are you more invested in the miui one (or is it mostly the same project with not many differences between the two types)?
@Sleepy_Augie There is little difference between the 2 flavors so it is easy to keep them in sync
All,
I cannot possibly know what customization other devs are adding to their boot.imgs and whether or not that will make their ROMs incompatible with my boot.imgs. I will try to keep the AOSP version up with current developments while still keeping it "Generic".
Could you include Selinux: Permissive? Zram is better than swap built-in miui ?
@efr07 The beauty of not embedding tweaks - you can choose to be permissive or enforcing in your init.d script rather than me dictating it to all.
setenforce=0 or 1
and to answer the second part....
MIUI uses what could be called a "dynamic swap" system utilizing 4 zram swaps of variable size. The system prioritizes what gets access to that extra memory and what doesn't. No surprises - Xiaomi apps get priority over your own apps. The complexity of this system is so great, it would negate any performance advantage completely but it does make the Xiaomi apps more tenacious than other apps.
@jajk
First things first thank you so much for the effort you have done improving Redmi Note 2,
But I have some question if you please,
I have Miui 7.2.2.0 Lite on my Redmi Note 2 Prime (2.2 ghz) (Rom Link http://en.miui.com/thread-244684-1-1.html)
I have flashed the file as img to boot, and I have done as you said until the int.d thing, I went to #/system/bin/ and I found sh file and opened it in text editor, deleted everything in it and paste what you mentioned, till now we are ok with the device.
I did not find the files that you said I should delete from /vendor/lib, so I went to /vendor/lib64 and deleted the first file, After I deleted it suddenly Root Explorer shut off and whenever I open it again I cant find anything, just blank screen with its symbol and name above and nothing else. Tried to delete Root Explorer and install again and nothing new. Please help, Have I done everything okay? and what should I do to fix this thing and continue deleting the remaining files?
Thank you.
@jajk delete folder /system/etc/radv <- do you mean radvd?
@aghr11 I think that you did not understand the method to create the init.d script and modified an important file instead. You will have to replace that script file you blanked with the original or restore from a good backup and try again. The list of files for deletion is only if they exist in the location as described. If you have enabled any fingerprint settings for some obscure reason, you will probably get locked out of your phone.
Now to creating the script.
Using a text editor, create a file named 01tweaks in /system/etc/init.d folder.
Paste the text (including the first line #!/system/bin/sh) into this file. Leave a blank line at the bottom of the file and make sure your editor is set to Unix end-of-line characters (not Windows)
Save the file and give it 0755 permissions (rwxr-xr-x)
@tonydeli7 Yes, typo I will fix..... done It is a folder to receive advertising pushed to your phone courtesy of Xiaomi!!!!
jajk said:
@tonydeli7 Yes, typo I will fix..... done It is a folder to receive advertising pushed to your phone courtesy of Xiaomi!!!!
Click to expand...
Click to collapse
Yeap, just saw the conf file... WTF are they doing?!
By the way, thanks a lot for this kernel! Nice work!:good::good:
UPDATE:
I edited the latest Multirom Stable (7.2.1.0) and added your kernel&tweaks,deleted the files and everything works great!
I only changed the touchboost value to 806000
jajk, many thanks for this brilliant work!
IIRC, your personal preference for a base ROM with the best behavior and performance with these tweaks was v7.1.4.0 (or was it 7.1.3.0). Is this so or has anything changed? My RN2p is long overdue for an update, still on dev 5.10.29!
If a have a weekly miui based on Miui V 7.3 beta, will it work?
@tonydeli7 Did you give it some time on touchboost 403? I find it does not contribute to lags perceptibly.
@algida79 The most bug free ROM I have come across is MR7.2.30 ID (ported from reno3). I think I had a link to that in the Skinny thread.
Don't load the preloader, uboot or logo from this ROM - edit the updater-script to remove flashing of these. You will need to do an intermediate flash of 7.1.3 or 7.1.4 using SP Flash tool to get all the partitions the way they need to be if coming from an ancient ROM.
@Dnxss Yes it will still work.
@jajk Half an hour I think. I had no lag,just my preference
The phone usage is mostly surfing,facebook,twitter,music playback etc etc with no gaming.
GPS SYNC 3G all on..
Installed app count is around 120..
Includes six reboots while testing ZRAM(disabled it), and if it's good to deactivate Whetstone app.
I also used the app Autostarts to disable useless receivers for many apps like FB etc,and disabled Mail,Voice Unlock,PicoTTS.
I am satisfied..[emoji14]
Sent from my Redmi Note 2 using Tapatalk
@tonydeli7 Whetstone app is a source of a lot of spyware but is not a straight forward removal but you will find that out...
can then also delete:
/etc/WhetstonePermission folder
/system/lib
libwhetstone_jni.so
libwhetstone_sdk.so
/system/lib64
libwhetstone_jni.so
libwhetstone_sdk.so
Yeap, I searched a bit. I am using the Multirom Stable and after flashing the kernel,Whetstone crashes sometimes.
Didn't notice anything weird after freezing it..
This rom doesn't have the line
persist.sys.whetstone.level=2
in the build.prop for some reason.
Sent from my Redmi Note 2 using Tapatalk
@tonydeli7 Whetstone is linked to the mcd service to make things harder to unravel as in all Xiaomi apps. The boot.img disables mcd which is why you will see Whetsone having a fit sometimes. Completely removing Whetstone is a very good thing to do - it may give you an FC on Battery app, delete that too - it chews battery and does not affect normal operation!!!
Anyone wanting to increase their privacy, rename /system/xbin/tunman to tunmanbak. This is the Xunlei data saver/spyware tunneling manager. It is disabled from starting in the boot.img but will still run if called upon like all of the disabled services - they still exist, but not started by default. Make sure it is disabled in the Download Manager Settings
There is another service /sbin/mdbd that appears to be a method of tunneling over usb connections to gain access to a network and on to P.R.C. It is disabled in the boot.img already but I will rename this one in a next revision to be doubly sure it will not start.
Discovered an issue of some apps not recognizing internal sdcard so new versions posted to fix this plus rename /sbin/mdbd to mdbdbak to prevent it from being started after boot. See previous post for the reason.
Back up your internal sdcard contents if you flashed the original images - you will loose everything on sdcard0.
No action needs to be taken if this is a first-time flash.
@jajk How come this version doesn't just dump sd to folder 0? What was merged between miui and pro boot images?
@Sleepy_Augie It is a very complex issue how Android provides a virtual filesystem for SDCards. I thought I could implement it in a simpler fashion as per Android 5.1 which worked well except apps like the stock Contacts are stuck in the dark ages and are hard-coded to still look for the emulated/0 folder for the internal sdcard - not storage/sdcard0.
So going from stock to my original mod leaves an orphaned folder which becomes named 0 because it belonged to user 0. Going back the other way the folder representing access to sdcard0 simply disappears.
The real location of files that appear on the internal emulated sdcard is always /data/media. All other folders that appear to be the same thing are only symlinks to this. Make sense:silly:
Hey @jajk ,
Thanks for the reply, but I have done exactly everything you said and followed all of your steps, but after one day using it, I do not notice any change on battery life, it is still so bad, I have tried everyrom (and every way that was suggested from other users on XDA and MIUI forums including every battery calibration thing) I came across since I bought my RN2p and the maximum battery life I got is nearly 4:30 hours on screen!! After I flashed the boot.img I noticed a slightly more speed booting up the device, the performance is the same (which is good because am all satisfied about the performance except for the battery life).
I have flashed smiui today and it's slightly better consuming energy than the previous ones...
Maybe I have done something wrong doing the 01tweaks thing, if you can upload me yours so I can try paste it in /system/etc/int.d folder, if that will work, then I will be so thankful to you. And if you have any suggestions that I could do to improve and enhance the crazy energy draining then I will be more thankful.

[CLOSED] [KERNEL][Energy Aware Scheduler] NebuliX Kernel V4.0.1 [Nov 30]

XDA:DevDB Information
Nebulix Kernel EAS, Kernel for the HTC 10
Contributors
Eliminater74, thewalkingdude
Source Code: https://github.com/DevHTC10/Nebulix_HTC10_pme_msm8996_kernel
Kernel Special Features: Energy Aware Scheduler
Version Information
Status: Beta
Current Stable Version: n/a
Stable Release Date: 2016-11-28
Current Beta Version: v4.0.0-EAS
Beta Release Date: 2016-11-28
Created 2016-11-28
Last Updated 2016-12-06
Reserved
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Features:
Energy Aware Scheduler (EAS) replacing the old Heterogeneous Multi
Processing (HMP) processing system
SchedFreq governor (named "sched") that is a special governor designed to run with EAS
Extra I/O schedulers: BFQ, FIOPS, SOI, FIFO, SIOPLUS, TRIPNDROID, VR, ZEN
Overclock up to 2265MHz big cluster and 1728MHz little cluster
GPU Overclock 133 up to 652mhz
GPU: Full Pixel's GPU Drivers
Sound Control mod that allows users to adjust digital audio gains
Backlight Dimmer
Button Light Notification
KCAL Color Control
Double Tap Fingerprint To Sleep
Fading/Pulsating Notification LED
Sweep2Sleep
Optional Disable FSYNC
Optional Disable magnetic cover
Home button Mapper
Various patches and fixes
What is Energy Aware Scheduler?
EAS is whole project full of calculation algorithms that track the behaviour of applications and events and decides what the best course of action it should take in order to ensure the best efficiency while maintaining the best performance. Coupled with the "sched" governor, it dynamically scales voltages automatically as well as frequencies so you can go from amazing idle battery endurance to consistent performance all around. EAS attempts to track behaviours of tasks in order to choose what is the best route to take in order to process the task as efficient as possible.
Read More Here: energy-aware-scheduling-eas-progress-update/
After installing this kernel, be sure to use a kernel app of your choice to change the governor on BOTH clusters to "sched". This governor called SchedFreq which you can see more info about it in the top of this post. Without "sched" EAS will NOT be working properly.
Please Read The Known Bugs On Page Page #4
Android 6.0.1 Sense (ROM Base 1.9x or later)
UberTC V5.X or V6.X
GCC 5.x.x
Downloads <--[NEW]
Android 6.0.1 Sense (ROM Base 1.9x or later)
LinaroTC V5.X or V6.X
GCC 5.x.x
GCC 6.x.x
Android 6.0.1 Sense (ROM Base 1.9x or later)
Crosstool-ng V5.X or V6.X
(Removed, Till Chain is Fixed)
Bugs:
- GPU can cause kernel panic sometimes when doing tasks such as typing very fast on the keyboard (GPU fluctuates freqs too fast and panics)
- 33% Battery bug (when rebooting while being plugged in) (workaround - reboot into TWRP then reboot back into system)
- exFAT still NOT working (And don't ask when it'll be fixed)
Proper Way To Report a Bug: ​
There are several apps that can do this process for you, Here is one: PlayStore: SysLog
And here is another: PlayStore: Andy Log (ROOT)
ramopps: is an oops/panic logger that writes its logs to RAM before the system
crashes. It works by logging oopses and panics in a circular buffer. Ramoops
needs a system with persistent RAM so that the content of that area can
survive after a restart.
logcat: the logoutput of the Android system
kernel log: (kmsg / dmesg): the kernel messages
Additionally there's the last_kmsg which is a dump of the kernel log until the last shutdown.
radio log: the log outpur ot your System / BB / RIL communication
4
ramopps: Some Documentation on Ramopps
Normal Logcat:
Code:
adb logcat -v time -d > logcat.log
Radio Logcat:
Code:
adb logcat -b radio -v time -d > logcat_radio.log
Ramoops:
Code:
adb shell su -c cat /sys/fs/pstore/console-ramoops > kmsg.txt
Kernel Log:
Code:
adb shell su -c dmesg > dmesg.log
Last_Kmsg: NOTE:
New location of last_kmsg on Android 6.0 and above: /sys/fs/pstore/console-ramoops
Code:
adb shell su -c "cat /proc/last_kmsg" > last_kmsg.log
NOTES:
-v time will include timestamps in the logcats
-d will export the complete log.
If you want to save a continuous log you can remove the -d parameter - then you need to cancel the logging process via CTRL+C.
To export a continuous kernel log use adb shell su -c "cat /proc/kmsg" > dmesg.log (and cancel it via CTRL+C again).
PS: This Document was taked from another XDA Thread Called: [Reference] How to get useful logs
URL: http://forum.xda-developers.com/showthread.php?t=2185929
Also check this one out: [Tutorial] How To Logcat
I only Revived it a bit for ramopps.
I will update this more at a later time..
[DMESG Help Commands]
Code:
Usage:
dmesg [options]
Display or control the kernel ring buffer.
Options:
-C, --clear clear the kernel ring buffer
-c, --read-clear read and clear all messages
-D, --console-off disable printing messages to console
-E, --console-on enable printing messages to console
-F, --file <file> use the file instead of the kernel log buffer
-f, --facility <list> restrict output to defined facilities
-H, --human human readable output
-k, --kernel display kernel messages
-L, --color[=<when>] colorize messages (auto, always or never)
colors are enabled by default
-l, --level <list> restrict output to defined levels
-n, --console-level <level> set level of messages printed to console
-P, --nopager do not pipe output into a pager
-r, --raw print the raw message buffer
-S, --syslog force to use syslog(2) rather than /dev/kmsg
-s, --buffer-size <size> buffer size to query the kernel ring buffer
-u, --userspace display userspace messages
-w, --follow wait for new messages
-x, --decode decode facility and level to readable string
-d, --show-delta show time delta between printed messages
-e, --reltime show local time and time delta in readable format
-T, --ctime show human readable timestamp (may be inaccurate!)
-t, --notime don't print messages timestamp
--time-format <format> show time stamp using format:
[delta|reltime|ctime|notime|iso]
Suspending/resume will make ctime and iso timestamps inaccurate.
-h, --help display this help and exit
-V, --version output version information and exit
Supported log facilities:
kern - kernel messages
user - random user-level messages
mail - mail system
daemon - system daemons
auth - security/authorization messages
syslog - messages generated internally by syslogd
lpr - line printer subsystem
news - network news subsystem
Supported log levels (priorities):
emerg - system is unusable
alert - action must be taken immediately
crit - critical conditions
err - error conditions
warn - warning conditions
notice - normal but significant condition
info - informational
debug - debug-level messages
[LOGCAT Help Commands]
Code:
Usage: logcat [options] [filterspecs]
options include:
-s Set default filter to silent.
Like specifying filterspec '*:S'
-f <filename> Log to file. Default is stdout
-r <kbytes> Rotate log every kbytes. Requires -f
-n <count> Sets max number of rotated logs to <count>, default 4
-v <format> Sets the log print format, where <format> is:
brief color long printable process raw tag thread
threadtime time usec
-D print dividers between each log buffer
-c clear (flush) the entire log and exit
-d dump the log and then exit (don't block)
-t <count> print only the most recent <count> lines (implies -d)
-t '<time>' print most recent lines since specified time (implies -d)
-T <count> print only the most recent <count> lines (does not imply -d)
-T '<time>' print most recent lines since specified time (not imply -d)
count is pure numerical, time is 'MM-DD hh:mm:ss.mmm'
-g get the size of the log's ring buffer and exit
-L dump logs from prior to last reboot
-b <buffer> Request alternate ring buffer, 'main', 'system', 'radio',
'events', 'crash' or 'all'. Multiple -b parameters are
allowed and results are interleaved. The default is
-b main -b system -b crash.
-B output the log in binary.
-S output statistics.
-G <size> set size of log ring buffer, may suffix with K or M.
-p print prune white and ~black list. Service is specified as
UID, UID/PID or /PID. Weighed for quicker pruning if prefix
with ~, otherwise weighed for longevity if unadorned. All
other pruning activity is oldest first. Special case ~!
represents an automatic quicker pruning for the noisiest
UID as determined by the current statistics.
-P '<list> ...' set prune white and ~black list, using same format as
printed above. Must be quoted.
filterspecs are a series of
<tag>[:priority]
where <tag> is a log component tag (or * for all) and priority is:
V Verbose (default for <tag>)
D Debug (default for '*')
I Info
W Warn
E Error
F Fatal
S Silent (suppress all output)
'*' by itself means '*:D' and <tag> by itself means <tag>:V.
If no '*' filterspec or -s on command line, all filter defaults to '*:V'.
eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.
If not specified on the command line, filterspec is set from ANDROID_LOG_TAGS.
If not specified with -v on command line, format is set from ANDROID_PRINTF_LOG
or defaults to "threadtime"
Under Construction..
m,ore
one more
Reserved
Sent from my HTC 10 using XDA Labs
Can I use kernel with resurrection remix ROM? And what about button mapper?
Let's go..
Running smooth on latest leedroid stable and nightly.
Reserved For Support Information and whatnots.
Moderator: Please move reserved posts with Nebulix Signatures to the front
Nebulix Presents: Nebulix Kernel W/Full EAS Support ....................
Get it in Downloads or Here: NebuliX_4.0.0-EAS_htc10_20161128_135032.zip
Reserved?
So anyone using this on Verizon with ICE Rom? Everything good to go?
---------- Post added at 10:32 PM ---------- Previous post was at 10:25 PM ----------
I guess imma give it a go
I am using on LeeDroid v199 and it is working fine at the moment. I'm at 100% battery so will leave over night and test tomorrow. Kept all settings as stock in the first instance before playing around with different settings.
Sent from my HTC 10 using XDA Labs
kend0g said:
So anyone using this on Verizon with ICE Rom? Everything good to go?
---------- Post added at 10:32 PM ---------- Previous post was at 10:25 PM ----------
I guess imma give it a go
Click to expand...
Click to collapse
Be sure you have a backup, and report your findings to us with Verizon please. Nobody on our team is using Verizon (I don't think) and this is the first time it's gone to public beta.
Says device not supported I'm on international pme
Sent from my HTC 10 using XDA-Developers mobile app
EAS is very powerful, you really have to be careful what settings you use. You will either have great battery or super Performance,
as I said, The boost goes from 0 - 100
0 = default, No boost and Perfect Battery, But some lags.........
100 = You must be crazy.......
4 = We set to Default for reasons listed........
8 = Good Performance (this is what I personally use)
10 = Have your Charger Handy...
reserve that post too yea
to a moderator: like charlie said, please move the reserve post to the front, so yea me and him and p50kombi
myheroduane said:
Says device not supported I'm on international pme
Sent from my HTC 10 using XDA-Developers mobile app
Click to expand...
Click to collapse
it is, I guess I dont have you model # listed, can you give me the full model #

Categories

Resources