[Samsung Galaxy Nexus] ajf64:
Ok guys i have got permission to bring over lean kernel and offer support for it on xda. I will keep this post up todate with all the most recent kernel updates and news. All credit goes to imoseyon as the original op and rootzwiki for original posting. I am posting this with full permission and support from imoseyon

Mod Type:: Kernel

Difficulty:: Very Easy

Mod Status:: Stable

Apply In:: CWM Recovery

Requires Root:: Yes

Exp builds are also up and includes a bunch of Android/OMAP updates not in stable.

SOURCE:

ICS

JB

This is a minimalistic Galaxy Nexus kernel. My philosophy is to keep the kernel as lean and stable as possible, at the same time to keep the kernel as modern and close to latest mainstream linux as possible. You will see that my kernels will lack some of the bells and whistles from other kernels.

sorry host4droid is still down. Mirrors:

kk4.4 LK 9.0 beta (use at ur own risk)

JB4.3 [ stable builds | exp builds ] [ change log | exp changes ]

JB4.2:Stable

Stock JRN84D kernel

Terminal Emulator not finding scripts? Read this post.

CHANGE LOG JB 4.2

FEATURES

Patched to latest in Linux 3.0.x branch.

All unnecessary kernel components removed to make kernel lean and fast!

OC to 1.65ghz. Boot speed is maxed at 1.2ghz within kernel (in addition to ramdisk) for stability.

User voltage control

InteractiveX V2 (screen-off hotplug of cpu1) added. Select it using setcpu if you want to use it.

Ramdisk tweaks (sysctl, vm, filesystem speed, etc.)

SWAP & zram (next generation compcache) support. Run "zram enable" in terminal.

init.d support in ramdisk.

lk.conf for basic kernel configuration.

HotplugX governor (Hotplug optimized and modified for screen-off suspend).

wakelock tweaks for wlan and lte modem

lkflash - script to flash latest versions of leanKernel from Terminal (type "su" without quotes, hit enter, then type "lkflash" without quotes and then hit enter)

checkv - voltage checking script (for custom undervolting) - detailed at bottom of this post.

checkt - script that displays 1) your current temp, 2) # of times you were throttled due to temp "recently", 3) CPU trim type, and 4) CPU silicon type, etc.

Fast USB charge (by chad0982) and "ffc" toggle script by me. (Open terminal, and type "ffc" without quotes then enter)

ColorControl from both CM9 and Ezekeel (compatible with all ROMs). Helpful posts: 1and 2.

TempControl - sysfs interface to control the CPU temp threshold. Read these two posts: 1 and 2.

Variable GPU OC - sysfs interface to select GPU max speed between 307MHz (stock), 384MHz and 512Mhz. The changes take effect immediately. Check FAQ for more info and how to use it.

Custom SR Tuning - override kernel default minimum voltage for SR calibration.

SoundControl

Gamma Control

ROW scheduler v4

DIRECTIONS

Uh.... flash the zip in clockworkmod.

Thanks to forum member maddler for providing file hosting

FAQ

How do i change voltage? - Use the latest version of setcpu, leantweaks, cputuner, or your ROM's built-in tools.

Do i need to wipe dalvik/cache? - in general there's no need, but it doesn't hurt so if you have time go ahead. Posted Image I don't wipe.

​Can we OC higher or add more frequency slots? - You can find the extra slots in my experimental versions.

​Will this work on GSM gnexus as well? - It should. I don't have a GSM phone to test so let me know if it stops working.

What is interactiveX V2? Read this post and thttp://rootzwiki.com/topic/13092-kernel-leankernel-minimalistic-kernel-120-123111/page__view__findpost__p__342571

Are you getting Screen-Off/Sleep-Of Death (SOD), general instability, or unusual battery drain?

Before you post here (especially if you're running the experimental version), try the following steps in order:

0) dude, disable screen-off profiles if you're running interactiveX.

1) If you're running the experimental version, do you have 180mhz/230mhz and/or 1.42ghz slots enabled? If so disable them both!

2) If the above doesn't help, do you have custom undervolting enabled? If so disable it! (keep in mind that the kernel is already undervolted by default).

3) If the above doesn't help, are you using interactiveX or hotplug governors? If so change to interactive.

4) If the above doesn't help then you should not be running the experimental version. Install the stable version and try both interactiveX and interactive without custom undervolting.

If you're still getting SOD with stable/interactive, report it here.

What about call-recording? - First the app needs to support Galaxy Nexus. Find out if it does and then find out from the author of the app what kernel changes are required and let me know.

Should i set up screen-off profile? - ICS kernels have built-in screen-off profile for all governors at 700mhz. So you don't need it unless you want to set it lower than 700mhz. In general there isn't a whole lot to gain by setting it lower.

Hotplug vs interactiveX? - Read this post. HotplugX vs interactiveX

What is zram and why do i need it?

zram basically takes a portion of your RAM (10% using my script) and turns it into a compressed swap device. So in layman's terms you're extending the size of your memory (potentially from ~700mb to close to 1000mb depending on the compression ratio).

To answer the 2nd question, no you don't really need it but if used properly (using custom LK zram script) it could help you in two different ways:

1) Android OS is based on Linux OS and the OS will try to use a growing portion of your RAM for file and inode caches and if you keep your phone up without rebooting after a while you may notice things getting a little sluggish. That's because the OS is not doing a good job in dropping the caches and freeing up memory for the apps.

2) more RAM and tweaked minfree (also handled by custom LK script) could potentially allow your apps to stay in memory longer (this may or may not be desirable based on your preference of course).

In conclusion, I'd say if you're curious it doesn't hurt to try. :) To revert, just type "zram disable".

What's the low-down on the GPU OC?

My kernel's GPU is now set to stock 307Mhz by default. You can adjust that by using Variable GPU OC (see a separate FAQ entry below).

When you go from say 307 to 512Mhz, you will not experience near double performance increase. Due to the factors outside the GPU module (ie. memory bandwidth limitation), you can't truly OC the GPU. In fact, most people can't tell the difference between 307, 384 and 512. Nenamark2 will roughly give you the following scores: 307/25fps, 384/28fps, and 512/31fps.

Some of you have seen the note from Colin, the Google kernel engineer, not to OC the GPU because using the OV_UV voltage slot will drain the battery. My kernel uses the same voltage for both OV and OV_UV slots. So there's no danger of battery drain there.

Why are the IO benchmark test scores lower than another kernel?

Some of the kernels out there have fsync disabled to increase benchmark scores. I believe that is unsafe and could cause data corruption. I do have hooks in my kernel to disable it but I don't use it.

In real world there will not be any user perceivable difference whether you have fsync enabled or disabled.

Is there a way to tune hotplug via sysfs?

yes. Advanced users only!

My phone doesn't seem to be deep-sleeping, what gives?

(assuming you checked in the right place like cpuspy) In terms of deep-sleep, there's not a whole lot going on in the kernel. It works or it doesn't - and I can assure you that I test every release (well almost every release) for deep-sleep before I release.

19 out of 20 times it's either 1) some sort of background process that's preventing your phone from going into deepsleep, or 2) something's misconfigured in your ROM, or both. Also connecting to USB will prevent phone from going into deepsleep.

I'm having unusual battery drain - help!

First of all, our gnex has very poor battery life while in active use. It's downright horrible while screen is on - screen is definitely the main culprit and there's not a whole lot I can do about that.

Custom undervolting can help or can hurt. This is mainly due to SmartReflex (class1.5) which auto-calibrates the ideal voltages for you. In fact, with SR you don't really need to use the custom undervolting feature for frequencies other than the 2 lowest. It does a great job calibrating higher frequencies. I personally don't touch it.

The "notrim" versions are an exception because I had to disable SR1.5 for the trim override to work. There's no auto-calibration going on there. Feel free to mess with custom undervolting on the notrim versions.

Now, if you've already accepted the horrible battery life while screen is on, but have questions about battery drain while idle - read the next question.

I'm having unusual battery drain while screen is off, or phone is sleeping - help!

First, let's find out if you're phone is going into deep-sleep. Install CPUSpy, unplug phone, turn off screen, and leave the phone alone for 5-10min. Turn the screen back on, launch CPUSpy, and see if you see an active entry for Deep Sleep. If so congratulations - read on.

If you've determined that your phone is not entering deepsleep by using the above method, read my entry above that says "My phone doesn't seem to be deep-sleeping". I've heard that removing SDM.apk helps as well as rebooting the phone. Also try turning your bluetooth on and off, and launching camera app and closing it.

If you've determined that your phone is entering deepsleep fine but still feel like battery drains, read the next question.

I'm having unusual battery drain while phone is in deep-sleep - help!

First make sure you are absolutely positive that deep sleep is working (read the previous question).

While on my kernel *and* connected to Wifi, you shouldn't drain more than 1% battery per hour *average* while in deep sleep (based on 5-8 hour continuous deep sleep). With wifi turned-off, my guess is probably no more than 1-3% per hour, depending on signal strength.

tip 1: If above is not happening for you, first charge the phone all the way and reboot. Let things settle a bit - give it a day or so. If you're using Battery Monitor Widget (which is not accurate for gnex), things should eventually settle between -2mA and -60mA per sample.

tip 2: Install BetterBatteryStats and look at which wakelocks dominate. Google search for names of the wakelocks to see how you can fix them.

tip 3: http://checkthis.com/d87t

If nothing seems to help, you can try the "notrim" version, but stick to speeds between 350 and 1350 (don't use OC slots). The notrim version has SR1.5 disabled which could help for those of you with drain issues on my other kernels.

What is tempcontrol and how do I use it?

First, read these two posts: 1 and 2.

Although tempcontrol was designed to be used with the experimental notrim builds because the cpu gets hotter in notrim frequencies, you can actually use tempcontrol to throttle lower frequencies. I haven't tried myself, but theoretically you can set your top speed at say 1.2Ghz and use tempcontrol to throttle at say 60C (instead of the stock value of 63C) resulting in slightly cooler phone. Theoretically. :)

What is SmartReflex?

SmartReflex performs continuous dynamic voltage scaling around the nominal operating point voltage according to silicon characteristics and operating conditions.

My stable and experimental builds will have SR Class 1.5 enabled by default.

You can disable SR via sysfs

How do I use Variable GPU OC?

You can use Lean Tweaks by Jake, or use the built-in "oc" script. Both leantweaks and my oc script will create an init.d script so the setting sticks at boot. My "checkt" script will also show the current GPU max speed. Note that 512MHz will probably not work for everyone.

307Mhz (stock) is set default by the kernel.

Open Terminal, and type for stock speed of 307Mhz: oc gpu 0

for 384MHz: oc gpu 1

for 512Mhz: oc gpu 2

What are the available sysfs options?

Check this post (thx byrong)

Which governor should I use on JB?

As usual I'd recommend trying all the governors and see which one works best for you. Stock JB, however, is optimized for interactive. The OS will automatically modify various interactive governor parameters on the fly while you're using the phone as part of "project butter". Namely, the following parameters are constantly adjusted by the OS: boostpulse, timer_rate, min_sample_time, hispeed_freq, go_hispeed_load, and above_hispeed_delay.

I hope this helps people if there is any other information you might want added just ask and i will do my best to come up with a comprehensive guide.

Donate to your favorite charity, or donate to imoseyon.