• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root KERNELS For Dummies

ocnbrze

DON'T PANIC!!!!!!!!!
  • May 13, 2010
    40,437
    1
    33,546
    Los Angeles
    Now that HTC has released the source code for the gingerbread and devs are now making gingerbread kernels, i figured that this is a good time to put up a guide to help those who do not understand what a kernel is and what it can do.

    one of the reasons that we all rooted our phones is so that we can enjoy better battery life then the non rooted phones. one way we can do this is to use a custom kernel.

    Kernels

    what is a kernel? a kernel basically communicates with and adjusts the voltage between the hardware(battery) and software(either sense or aosp) of your phone according to frequency. how much voltage a kernel decides to provide to and from your phone and at what frequency will depend on the type of kernels.

    there are two main type of kernels:
    cfs (completely fair scheduler): it tends to be more fair on an even distribution of voltage to all running processes (think apps). it is mainly designed for your typical standard tasks. things like using the web or text messaging can all be handled by cfs kernels. it tends to be better at giving the best battery life.

    bfs (brain f*ck scheduler): a kernel that is more focused on certain running processes like apps. the main purpose is to run apps that need more voltage and to run them more smoothly at the expense of other processes which tend to make the phone laggy. however, it can make game play run better.

    sub category
    havs (hybrid adaptive voltage scaling):there are different degrees of havs kernels. they run from more havs to less havs to no havs kernels. these kernels will have a variable range of voltages as the system fluctuates according to need. they tend to err on lowering the voltage on processes that does not need the set (static) voltage for that process. basically these kernels have a max and min and will adjust the voltages accordingly to the process at hand.

    no havs: since havs is not at work on these kernels, the default then is in the form of static voltage scaling which is an even amount of voltage that does not fluctuate regardless of what process is running. so even smaller tasks will get the same amount of voltage and thus potentially wasting battery life.

    static undervolting:when there isn't any havs implemented on the kernel then the kernel will be using static undervolting. for each cpu speed there is a set voltage number (it is always gonna be a constant number) assigned that are lower then the normal voltage.

    sbc (superior battery charging):this is a type of trickle charging that is slower in its charge and is best done overnight. it is supposed to prevent that initial 10% drop off charge. the idea is that as the voltage is pushed into the battery while charging very slowly, the battery will stay cool. by keeping the battery cool you will avoid plating where lithium ions are deposited on the anode of the battery in metallic form vs the ionic form. once lithium is metallic, it can no longer transfer electricity so obviously you want to avoid plating as much as possible.

    it also supposed to charge the battery past its normal 100%. your battery indicator has a certain value for what it deems to be 100%. however the sbc charge allows the battery to charge past that point. there was concern that the sbc kernel will overcharge the battery and thus kill the life of the battery and or it can cause it to explode. now in the past, if you look around the net, you will see that people were concerned for their phones exploding due to the use of sbc kernels. though there were a few cases (supposedly) of exploding phones early on, there has not been any reported that i know of since. and yes sbc kernels may degrade your battery down faster then non sbc kernels. however, i think that the trade off of getting better battery life is better then having a battery last longer. batteries are cheap these days anyways.

    More on Kernels
    now one thing about kernels and batteries is that the results may very for most people. kernels tend to react differently on different phones. there are just too many variables to consider. the best thing to do is to make a nandroid and try the kernels out and find out what works for you on your phone.

    every custom rom comes with its own kernel which in most cases is just stock. in order to switch kernels, all you would have to do is just flash a custom one of your choice. just make sure that you make a nandroid backup first then wipe dalvik cache and cache and flash away.

    kernels are designed to work the two main types of rom. there are one for sense and then there are ones for AOSP(Android Open Source Project). they also make universal kernels that works on both AOSP and sense. however, the AOSP kernels will not work on a sense rom and vice versa. Also the new gingerbread roms will not work with froyo kernels. the main thing is to make sure that you know what kernel you are flashing and what rom you have.

    Flashing Kernels
    this is how it is done:
    1.download the kernel of your choice
    2.transfer the file over to the card
    3.go into recovery
    4.make a nandroid backup
    5.wipe dalvik cache and cache
    6.flash the zip file
    7.reboot.

    Setcpu

    what is setcpu? it is an app found on the market that works on most android devices. its main purpose is to set and maintain cpu frequencies. also you will need a custom kernel if you want to over and underclock your phone using setcpu.

    not all phones have the same threshold for overclocking so you have to be careful on how high you set the frequency. make sure that the set on boot found on the main screen is not checked. if you overclock to high then your phone will not work right. it will seize up and could cause a reboot. if you have set on boot at that level then you will get a bootloop that is hard to get out of. once you know at what point your phone is overclocked but stable, then you can go ahead and set it on boot.

    as far as profiles go, i would bot recommend having too many. it is counterproductive and if you have a lot of profiles, then setcpu will then be working that much harder to monitor and maintain those profiles. usually a screen off profile is good enough to help save battery.

    Governors

    scaling governors control exactly how the cpu scales between your "max" and "min" set frequencies.

    here is a great explanantion of some of the governors out there. thanx NaterTots!!!!!

    NaterTots said:
    I wanted to bring this over here for the Kernels for Dummies Guide.
    A great write-up on the different governors.


    Thanks to HipKat for bringing this into the Evo forums on XDA.
    Thanks to deedii for posting this in another forum:

    Android CPU governors explained

    1: OnDemand
    2: OndemandX
    3: Performance
    4: Powersave
    5: Conservative
    6: Userspace
    7: Min Max
    8: Interactive
    9: InteractiveX
    10: Smartass
    11: SmartassV2
    12: Scary
    13: Lagfree
    14: Smoothass
    15: Brazilianwax
    16: SavagedZen
    17: Lazy
    18: Lionheart
    19: LionheartX
    20: Intellidemand
    21: Hotplug




    1: OnDemand Governor:
    This governor has a hair trigger for boosting clockspeed to the maximum speed set by the user. If the CPU load placed by the user abates, the OnDemand governor will slowly step back down through the kernel's frequency steppings until it settles at the lowest possible frequency, or the user executes another task to demand a ramp.

    OnDemand has excellent interface fluidity because of its high-frequency bias, but it can also have a relatively negative effect on battery life versus other governors. OnDemand is commonly chosen by smartphone manufacturers because it is well-tested, reliable, and virtually guarantees the smoothest possible performance for the phone. This is so because users are vastly more likely to bitch about performance than they are the few hours of extra battery life another governor could have granted them.

    This final fact is important to know before you read about the Interactive governor: OnDemand scales its clockspeed in a work queue context. In other words, once the task that triggered the clockspeed ramp is finished, OnDemand will attempt to move the clockspeed back to minimum. If the user executes another task that triggers OnDemand's ramp, the clockspeed will bounce from minimum to maximum. This can happen especially frequently if the user is multi-tasking. This, too, has negative implications for battery life.


    2: OndemandX:
    Basically an ondemand with suspend/wake profiles. This governor is supposed to be a battery friendly ondemand. When screen is off, max frequency is capped at 500 mhz. Even though ondemand is the default governor in many kernel and is considered safe/stable, the support for ondemand/ondemandX depends on CPU capability to do fast frequency switching which are very low latency frequency transitions. I have read somewhere that the performance of ondemand/ondemandx were significantly varying for different i/o schedulers. This is not true for most of the other governors. I personally feel ondemand/ondemandx goes best with SIO I/O scheduler.


    3: Performance Governor:
    This locks the phone's CPU at maximum frequency. While this may sound like an ugly idea, there is growing evidence to suggest that running a phone at its maximum frequency at all times will allow a faster race-to-idle. Race-to-idle is the process by which a phone completes a given task, such as syncing email, and returns the CPU to the extremely efficient low-power state. This still requires extensive testing, and a kernel that properly implements a given CPU's C-states (low power states).


    4: Powersave Governor:
    The opposite of the Performance governor, the Powersave governor locks the CPU frequency at the lowest frequency set by the user.


    5:Conservative Governor:
    This biases the phone to prefer the lowest possible clockspeed as often as possible. In other words, a larger and more persistent load must be placed on the CPU before the conservative governor will be prompted to raise the CPU clockspeed. Depending on how the developer has implemented this governor, and the minimum clockspeed chosen by the user, the conservative governor can introduce choppy performance. On the other hand, it can be good for battery life.

    The Conservative Governor is also frequently described as a "slow OnDemand," if that helps to give you a more complete picture of its functionality.


    6: Userspace Governor:
    This governor, exceptionally rare for the world of mobile devices, allows any program executed by the user to set the CPU's operating frequency. This governor is more common amongst servers or desktop PCs where an application (like a power profile app) needs privileges to set the CPU clockspeed.


    7: Min Max
    well this governor makes use of only min & maximum frequency based on workload... no intermediate frequencies are used.


    8: Interactive Governor:
    Much like the OnDemand governor, the Interactive governor dynamically scales CPU clockspeed in response to the workload placed on the CPU by the user. This is where the similarities end. Interactive is significantly more responsive than OnDemand, because it's faster at scaling to maximum frequency.

    Unlike OnDemand, which you'll recall scales clockspeed in the context of a work queue, Interactive scales the clockspeed over the course of a timer set arbitrarily by the kernel developer. In other words, if an application demands a ramp to maximum clockspeed (by placing 100% load on the CPU), a user can execute another task before the governor starts reducing CPU frequency. This can eliminate the frequency bouncing discussed in the OnDemand section. Because of this timer, Interactive is also better prepared to utilize intermediate clockspeeds that fall between the minimum and maximum CPU frequencies. This is another pro-battery life benefit of Interactive.

    However, because Interactive is permitted to spend more time at maximum frequency than OnDemand (for device performance reasons), the battery-saving benefits discussed above are effectively negated. Long story short, Interactive offers better performance than OnDemand (some say the best performance of any governor) and negligibly different battery life.

    Interactive also makes the assumption that a user turning the screen on will shortly be followed by the user interacting with some application on their device. Because of this, screen on triggers a ramp to maximum clockspeed, followed by the timer behavior described above.


    9: InteractiveX Governor:
    Created by kernel developer "Imoseyon," the InteractiveX governor is based heavily on the Interactive governor, enhanced with tuned timer parameters to better balance battery vs. performance. The InteractiveX governor's defining feature, however, is that it locks the CPU frequency to the user's lowest defined speed when the screen is off.


    10: Smartass
    Is based on the concept of the interactive governor.
    I have always agreed that in theory the way interactive works – by taking over the idle loop – is very attractive. I have never managed to tweak it so it would behave decently in real life. Smartass is a complete rewrite of the code plus more. I think its a success. Performance is on par with the “old” minmax and I think smartass is a bit more responsive. Battery life is hard to quantify precisely but it does spend much more time at the lower frequencies.
    Smartass will also cap the max frequency when sleeping to 352Mhz (or if your min frequency is higher than 352 – why?! – it will cap it to your min frequency). Lets take for example the 528/176 kernel, it will sleep at 352/176. No need for sleep profiles any more!"


    11: SmartassV2:
    Version 2 of the original smartass governor from Erasmux. Another favorite for many a people. The governor aim for an "ideal frequency", and ramp up more aggressively towards this freq and less aggressive after. It uses different ideal frequencies for screen on and screen off, namely awake_ideal_freq and sleep_ideal_freq. This governor scales down CPU very fast (to hit sleep_ideal_freq soon) while screen is off and scales up rapidly to awake_ideal_freq (500 mhz for GS2 by default) when screen is on. There's no upper limit for frequency while screen is off (unlike Smartass). So the entire frequency range is available for the governor to use during screen-on and screen-off state. The motto of this governor is a balance between performance and battery.


    12: Scary
    A new governor wrote based on conservative with some smartass features, it scales accordingly to conservatives laws. So it will start from the bottom, take a load sample, if it's above the upthreshold, ramp up only one speed at a time, and ramp down one at a time. It will automatically cap the off screen speeds to 245Mhz, and if your min freq is higher than 245mhz, it will reset the min to 120mhz while screen is off and restore it upon screen awakening, and still scale accordingly to conservatives laws. So it spends most of its time at lower frequencies. The goal of this is to get the best battery life with decent performance. It will give the same performance as conservative right now, it will get tweaked over time.


    13: Lagfree:
    Lagfree is similar to ondemand. Main difference is it's optimization to become more battery friendly. Frequency is gracefully decreased and increased, unlike ondemand which jumps to 100% too often. Lagfree does not skip any frequency step while scaling up or down. Remember that if there's a requirement for sudden burst of power, lagfree can not satisfy that since it has to raise cpu through each higher frequency step from current. Some users report that video playback using lagfree stutters a little.


    14: Smoothass:
    The same as the Smartass “governor” But MUCH more aggressive & across the board this one has a better battery life that is about a third better than stock KERNEL


    15: Brazilianwax:
    Similar to smartassV2. More aggressive ramping, so more performance, less battery


    16: SavagedZen:
    Another smartassV2 based governor. Achieves good balance between performance & battery as compared to brazilianwax.


    17: Lazy:
    This governor from Ezekeel is basically an ondemand with an additional parameter min_time_state to specify the minimum time CPU stays on a frequency before scaling up/down. The Idea here is to eliminate any instabilities caused by fast frequency switching by ondemand. Lazy governor polls more often than ondemand, but changes frequency only after completing min_time_state on a step overriding sampling interval. Lazy also has a screenoff_maxfreq parameter which when enabled will cause the governor to always select the maximum frequency while the screen is off.


    18: Lionheart:
    Lionheart is a conservative-based governor which is based on samsung's update3 source.
    The tunables (such as the thresholds and sampling rate) were changed so the governor behaves more like the performance one, at the cost of battery as the scaling is very aggressive.


    19: LionheartX
    LionheartX is based on Lionheart but has a few changes on the tunables and features a suspend profile based on Smartass governor.


    20: Intellidemand:
    Intellidemand aka Intelligent Ondemand from Faux is yet another governor that's based on ondemand. Unlike what some users believe, this governor is not the replacement for OC Daemon (Having different governors for sleep and awake). The original intellidemand behaves differently according to GPU usage. When GPU is really busy (gaming, maps, benchmarking, etc) intellidemand behaves like ondemand. When GPU is 'idling' (or moderately busy), intellidemand limits max frequency to a step depending on frequencies available in your device/kernel for saving battery. This is called browsing mode. We can see some 'traces' of interactive governor here. Frequency scale-up decision is made based on idling time of CPU. Lower idling time (<20%) causes CPU to scale-up from current frequency. Frequency scale-down happens at steps=5% of max frequency. (This parameter is tunable only in conservative, among the popular governors)
    To sum up, this is an intelligent ondemand that enters browsing mode to limit max frequency when GPU is idling, and (exits browsing mode) behaves like ondemand when GPU is busy; to deliver performance for gaming and such. Intellidemand does not jump to highest frequency when screen is off.


    21: Hotplug Governor:
    The Hotplug governor performs very similarly to the OnDemand governor, with the added benefit of being more precise about how it steps down through the kernel's frequency table as the governor measures the user's CPU load. However, the Hotplug governor's defining feature is its ability to turn unused CPU cores off during periods of low CPU utilization. This is known as "hotplugging."

    Obviously, this governor is only available on multi-core devices.

    Credits goes to:
    http://icrontic.com/discussion/95140...m-tuner-tegrak

    http://forum.xda-developers.com/show....php?t=1369817


    Link for Wheatley description
    xda-developers - View Single Post - [INFO][KERNEL] GLaDOS by Ezekeel | GSM/LTE/Sprint | 4.0.3/4.0.4

    Link for Lulzactive description
    TEGRAK: Lulzactive Governor v2

    Links

    you can download setcpu from the market.

    checkout this guide:setcpu guide

    if you want to read more here are some threads you might want to checkout:
    [GUIDE]
     
    Hey have any of you guys seen the app sgs kernel flasher? have you tried it on the evo?


    I have been using it on the infuse...it's pretty slick.

    I was just wondering if it worked on the evo too

    nope it is not on the supported list. there is the kernel manager by teamwin that is compatible with the evo.
     
    Upvote 0
    I'm running golden monkey 1.1 and loving it. But can you stack kernels? I would like an SBC kernel as well. Also what type is GM? Thanks again...

    To my knowledge you can not stack kernels. SBC kernels are in the works I believe but they want to get stable kernels out first to add SBC too. GM is a sense kernel based on the recently release source code for the stock kernel in the 2.3.3 OTA.
     
    Upvote 0
    When you restore a nandroid, does it reinstall the Kernel you were using when you made it as well, or just the rom?

    Does a nandroid save things like the changes that were made when applying supercharger V6?

    nandroids are a complete snapshot of everything on your phone. so yes kernels will be saved with your nandroids and same goes for the supercharger script.
     
    Upvote 0
    I have made a few nandroids now and they are on my sd card. i understand doing a restore reinstalls the one with the newest date. Is there an easy way to get it to choose a different one to restore?

    you do not have to pick the newest one. you can use the vol up and down buttons to navigate and pick the nandroid you want to restore.
     
    • Like
    Reactions: dustwun77
    Upvote 0
    Cool, now all I have to do is remember which is which. :p

    Does the recovery tool go after these based upon the fact they are in the nandroid folder? is it ok to give them descriptive names?

    yes you can rename the nandroid backups. just do not use spaces and weird symbols. for me i just put the name of the rom in front of the date.
     
    • Like
    Reactions: dustwun77
    Upvote 0

    BEST TECH IN 2023

    We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

    Smartphones