[KERNEL] Bricked-Kernel Mako

Search This thread

show-p1984

Inactive Recognized Developer
Jul 30, 2011
3,700
11,805



Welcome to the most customizable N4 kernel on xda :)
Bricked-Kernel Nexus 4 (mako)

Features:

* Based upon Googles msm 3.4 source
* Various other fixes (look @ github)
* Compiled with gcc4.7.2 toolchain (linaro 09.12)
* -O3 optimized
* Snapdragon S4 & CortexA15 optimizations
* Sweep2wake
(Disabled as default, activate through an app like KControl or over sysfs: echo 1 > /sys/android_touch/sweep2wake)
* DoubleTap2Wake
(Disabled as default, activate through an app like KControl or over sysfs: echo 1 > /sys/android_touch/doubletap2wake)
* replaced qcoms hotplug binary with msm_mpdecision (IN-KERNEL, better battery life + performance)
* Extensive sysfs interface for mpdecision with all the tuneables you want (/sys/kernel/msm_mpdecision/)
* replaced the thermald binary with my IN-KERNEL solution. (/sys/kernel/msm_thermal/)
* export krait version to: /sys/kernel/debug/krait_variant
* modified ondemand governor
* Allow OC up to 1,83Ghz, faux123 (from a thermal point of view that is now SAFE)
* Allow UC down to 94,5Mhz
* Fixed min cpufreq resets
* Undervolting (faux123)

* Default clocks: 384min & 1512max

Zip features:
* ramdisk module insertion
* removes governor overrides from the ramdisk
* adds init.d support to your ramdisk (if not already supported)

Check the compare links for the rest :)

Where is tha Changelog???

There will be no more changelogs.
Instead the download pages were outfitted with compare links to github for each download.

What is sweep2wake?


How to install?

Flash through recovery. #done.

How to uninstall?

Flash this through recovery:
Bricked_uninstaller
Bye.

Where to complain about errors/bugs?

Please use the Issuetracker for bugs/errors/feature wishes!
Issuetracker @ https://github.com/showp1984/bricked-mako/issues

showp1984@googlemail.com
IRC Chat: Freenode IRC #bricked

Download:

No Guarantees! If it kills your grandmother or your device, I am NOT responsible! If you understand this:
(If you download, please hit Thanks below my post! Thank you!)

>>> DOWNLOAD <<<




Donor List:

> Hall of fame <

Thank you very much!


Stock Nexus4 JELLYBEAN JWR boot.img (flash this if you come from another kernel)

Source:


 
Last edited:

show-p1984

Inactive Recognized Developer
Jul 30, 2011
3,700
11,805
What is msm_thermal?

Kernel based 3-phase thermal control!
This replaces your /system/bin/thermald binary which is renamed by the installer to thermald_bck.
It will throttle your cpu speed to keep it cool and unleash it if the cpu has cooled down enough. (3 phases: low, mid and high)

Check /sys/kernel/msm_thermal/conf/ for the thermal configuration :)

allowed_max_high = highest threshold (phase 3)
allowed_max_low = remove the throttling if we cooled down to this (clr_thrshold)
allowed_max_freq = max frequency if throttled (limit)

[...]mid[...] = same as above, just for phase 2
[...]low[...] = Lowest threshold (phase 1)

check_interval_ms = how often shall we check? (sampling rate)
Default: 100ms (=0.1sec)

shutdown_temp = if we reach this shut down the device!
Default: 80°C

If you want to see msm_thermal doing it's job:
Code:
adb shell
cat /proc/kmsg | grep 'thermal'
What is msm_mpdecision?

100% kernel based multi core decision! (should cpu1/2/3 be online or not?)
This replaces your /system/bin/mpdecision binary which is renamed by the installer to mpdecision_bck.

Check /sys/kernel/msm_mpdecision/conf/ for the configuration.

startdelay = time until mpdecision starts doing it's magic (20000)
delay = time between checks (70)
pause = if something else plugs in the cpu, fall asleep for 10000ms (10 secs)
scroff_single_core = if the screen is off, don't plug in cpu1/2/3. Additionally: Unplug all cpus except cpu0 when screen is turned off (1)
enabled = enable(1) or disable(0) mpdecision. This does not affect scroff_single_core!
min_cpus = min cpus to be online, cannot be < 1. Default: 1
max_cpus = max cpus to be online, cannot be > 4. (if you set it to 2 and min_cpus to 1 you will basically have a dualcore) Default: 4
idle_freq = a value against that will be checked if a core +/- is requested. (486000)
If cpu0 is below that value and a core up of another cpu is requested, nothing will happen.
If any other cpu is above that value and a core down of that cpu is requested, nothing will happen. (otherwise it would now put down that cpu even though it is still working, which isn't what we want)


Hot plug thresholds (aka now it gets 'complicated')
This small formula calculates which value will be used: (number_of_cpus_online - 1) * 2
The result of this formula will be the nwns_threshold where a new cpu is hotplugged.
The result of this formula + 1 will be the nwns_threshold where a cpu is unplugged.

nwns_threshold_x = runqueue threshold, if this is reached cpuX will be hot/unplugged
twts_threshold_x = time threshold, this amount of time must have passed for the related action to be taken (hot/unplug)

Example:
One cpu is online.
(1 - 1) * 2 = 0 ergo:
nwns_threshold_0 = cpu1 will be hotplugged at this value
((1 - 1) * 2) + 1 = 1
nwns_threshold_1 = cpu0 will be unplugged at this value
Since we can't unplug cpu0 this is '0'.

Two cpus are online.
(2 - 1) * 2 = 2 ergo:
nwns_threshold_2 = cpu2 will be hotplugged at this value
((2 - 1) * 2) + 1 = 3
nwns_threshold_3 = cpu1 will be unplugged at this value

etc...

The default values are:
NwNs_Threshold: 12, 0, 25, 20, 32, 28, 0, 35
TwTs_Threshold: 140, 0, 140, 190, 140, 190, 0, 190
Where the position and function of the number equals the result of the above explained formula.

(all times are in ms)
If you want to see the mpdecision magic happening:
Code:
adb shell
cat /proc/kmsg | grep 'MPDEC'
mpdecision's input event boost, aka project butter :p

This will boost your min cpu speed if you touch the screen or press a button and gives you full control.
In those events the min cpu freq will be risen to a predefined value (look below) on every online cpu. This boosts overall reaction times and smoothness a lot. (works similar to the qcom mpdecision binary)
Configuration files:
root@android:/sys/kernel/msm_mpdecision/conf # ls
boost_enabled
boost_freqs
boost_time

All of them work like the usual sysfs files, except one special case:
boost_freqs will list all frequencies from cpu 0 to cpu x. Cpu 3 and any following cpu will share one frequency.
To change those frequencies echo the cpu number + the frequency in khz. To change the boost freq of cpu3 (and 4,5,6,7,8, etc) the echo would look as follows:
Code:
echo "3 1026000" > /sys/kernel/msm_mpdecision/conf/boost_freqs
for cpu0:
Code:
echo "0 1026000" > /sys/kernel/msm_mpdecision/conf/boost_freqs

Defaults:
Code:
cat /sys/kernel/msm_mpdecision/conf/boost_freqs
918000
918000
702000
594000
How does sweep2wake work? Does it keep my phone awake?

Short answer: No.
Long answer:
Sweep2wake works with IRQs (Interrupts).
An interrupt can be best imagined as you doing something, like shopping at the local super market, when someone jumps in front of you and punches you into your family jewels. You will most certainly not just continue shopping.
In technical terms: An Interrupt interrupts the normal operation of a program and executes "special" code instead.

So if you touch your screen, an interrupt is send on which the touch driver reacts. That's it.
Since we have a capacitive touchscreen you also do not need to worry about any pressure onto the screen.

If you want to disable sweep2wake execute this command on your phone (adb shell or directly), you can also add it to an init.d script.
Code:
echo "0" > /sys/android_touch/sweep2wake
(echoing "1" activates it, which is the default setting)
Recommended governor?

Ondemand.
Why do I have no WLAN?

Due to this kernels very high optimization settings it is too big for our boot.img with WLAN included into the kernel, so it is built as a module. That means it needs to be inserted into the kernel upon boot up, which needs to be automated for maximum comfort.
The zip adds this to your ramdisk, if that fails for some reason the wlan module cannot be inserted.

if
Code:
adb shell lsmod
doesn't show this:
Code:
tun 14701 0 - Live 0x00000000
cifs 275399 0 - Live 0x00000000
wlan 2964650 0 - Live 0x00000000 (C)
Then something went wrong. (My fault)
You can test it by executing
Code:
adb shell
su
insmod /system/lib/modules/wlan.ko

Wait a few seconds and try to enable wifi and repeat the above lsmod command (should now show wlan).
If WLAN now works, I messed up.
Open a new issue in the issue tracker and it will be fixed asap.
Last release for 4.2.2?

STABLE: 20130622_233007_master-8fa9be1
BETA: 20130727_023549_exp-d64cabc
 
Last edited:

cmikeh2

Senior Member
Feb 21, 2012
158
53
Colorado Springs
Looking forward to trying this out! Looks awesome. Just out of curiosity is there any reason why this zip is so much larger than the zips for other kernels?
 
Last edited:

Locksmith81

Senior Member
Nov 13, 2010
1,753
370

show-p1984

Inactive Recognized Developer
Jul 30, 2011
3,700
11,805
it is finally here!!!
i spy sweep2wake ;)
Soon(tm)
I am currently making final adjustments to sweep2wake :)
Perhaps it will be a christmas present?
So over clock is safe with this???
From a thermal point of view: Yes.
But if you set a too high clock and your chip craps out because of too much voltage, that won't save it.
Overclocking is dangerous. It will never be safe, the thermal guard just makes it as safe as on any other phone. :)
Looking forward to trying this out! Looks awesome. Just out of curiosity is there any reason why this zip is so much larger than the zips for other kernels?
Yes, because of sooooo many optimizations I pumped into the kernel it was getting pretty big, too big for it to fit inside the boot.img with the ramdisk. SO I had to remove stuff from the kernel and put it into modules (wlan,cifs,tun) which are inserted into the kernel upon boot.
You won't feel the difference but it enabled me to include these optimizations.
(the prima wlan module is 22megs or so... freaky big thing.)
Flashed it and will report soon :D
Do it need to wipe cache ??
It wipes cache for you.
 
Last edited:

show-p1984

Inactive Recognized Developer
Jul 30, 2011
3,700
11,805
Last edited:
  • Like
Reactions: alewis2k12

Top Liked Posts

  • There are no posts matching your filters.
  • 225



    Welcome to the most customizable N4 kernel on xda :)
    Bricked-Kernel Nexus 4 (mako)

    Features:

    * Based upon Googles msm 3.4 source
    * Various other fixes (look @ github)
    * Compiled with gcc4.7.2 toolchain (linaro 09.12)
    * -O3 optimized
    * Snapdragon S4 & CortexA15 optimizations
    * Sweep2wake
    (Disabled as default, activate through an app like KControl or over sysfs: echo 1 > /sys/android_touch/sweep2wake)
    * DoubleTap2Wake
    (Disabled as default, activate through an app like KControl or over sysfs: echo 1 > /sys/android_touch/doubletap2wake)
    * replaced qcoms hotplug binary with msm_mpdecision (IN-KERNEL, better battery life + performance)
    * Extensive sysfs interface for mpdecision with all the tuneables you want (/sys/kernel/msm_mpdecision/)
    * replaced the thermald binary with my IN-KERNEL solution. (/sys/kernel/msm_thermal/)
    * export krait version to: /sys/kernel/debug/krait_variant
    * modified ondemand governor
    * Allow OC up to 1,83Ghz, faux123 (from a thermal point of view that is now SAFE)
    * Allow UC down to 94,5Mhz
    * Fixed min cpufreq resets
    * Undervolting (faux123)

    * Default clocks: 384min & 1512max

    Zip features:
    * ramdisk module insertion
    * removes governor overrides from the ramdisk
    * adds init.d support to your ramdisk (if not already supported)

    Check the compare links for the rest :)

    Where is tha Changelog???

    There will be no more changelogs.
    Instead the download pages were outfitted with compare links to github for each download.

    What is sweep2wake?


    How to install?

    Flash through recovery. #done.

    How to uninstall?

    Flash this through recovery:
    Bricked_uninstaller
    Bye.

    Where to complain about errors/bugs?

    Please use the Issuetracker for bugs/errors/feature wishes!
    Issuetracker @ https://github.com/showp1984/bricked-mako/issues

    showp1984@googlemail.com
    IRC Chat: Freenode IRC #bricked

    Download:

    No Guarantees! If it kills your grandmother or your device, I am NOT responsible! If you understand this:
    (If you download, please hit Thanks below my post! Thank you!)

    >>> DOWNLOAD <<<




    Donor List:

    > Hall of fame <

    Thank you very much!


    Stock Nexus4 JELLYBEAN JWR boot.img (flash this if you come from another kernel)

    Source:


    57
    What is msm_thermal?

    Kernel based 3-phase thermal control!
    This replaces your /system/bin/thermald binary which is renamed by the installer to thermald_bck.
    It will throttle your cpu speed to keep it cool and unleash it if the cpu has cooled down enough. (3 phases: low, mid and high)

    Check /sys/kernel/msm_thermal/conf/ for the thermal configuration :)

    allowed_max_high = highest threshold (phase 3)
    allowed_max_low = remove the throttling if we cooled down to this (clr_thrshold)
    allowed_max_freq = max frequency if throttled (limit)

    [...]mid[...] = same as above, just for phase 2
    [...]low[...] = Lowest threshold (phase 1)

    check_interval_ms = how often shall we check? (sampling rate)
    Default: 100ms (=0.1sec)

    shutdown_temp = if we reach this shut down the device!
    Default: 80°C

    If you want to see msm_thermal doing it's job:
    Code:
    adb shell
    cat /proc/kmsg | grep 'thermal'
    What is msm_mpdecision?

    100% kernel based multi core decision! (should cpu1/2/3 be online or not?)
    This replaces your /system/bin/mpdecision binary which is renamed by the installer to mpdecision_bck.

    Check /sys/kernel/msm_mpdecision/conf/ for the configuration.

    startdelay = time until mpdecision starts doing it's magic (20000)
    delay = time between checks (70)
    pause = if something else plugs in the cpu, fall asleep for 10000ms (10 secs)
    scroff_single_core = if the screen is off, don't plug in cpu1/2/3. Additionally: Unplug all cpus except cpu0 when screen is turned off (1)
    enabled = enable(1) or disable(0) mpdecision. This does not affect scroff_single_core!
    min_cpus = min cpus to be online, cannot be < 1. Default: 1
    max_cpus = max cpus to be online, cannot be > 4. (if you set it to 2 and min_cpus to 1 you will basically have a dualcore) Default: 4
    idle_freq = a value against that will be checked if a core +/- is requested. (486000)
    If cpu0 is below that value and a core up of another cpu is requested, nothing will happen.
    If any other cpu is above that value and a core down of that cpu is requested, nothing will happen. (otherwise it would now put down that cpu even though it is still working, which isn't what we want)


    Hot plug thresholds (aka now it gets 'complicated')
    This small formula calculates which value will be used: (number_of_cpus_online - 1) * 2
    The result of this formula will be the nwns_threshold where a new cpu is hotplugged.
    The result of this formula + 1 will be the nwns_threshold where a cpu is unplugged.

    nwns_threshold_x = runqueue threshold, if this is reached cpuX will be hot/unplugged
    twts_threshold_x = time threshold, this amount of time must have passed for the related action to be taken (hot/unplug)

    Example:
    One cpu is online.
    (1 - 1) * 2 = 0 ergo:
    nwns_threshold_0 = cpu1 will be hotplugged at this value
    ((1 - 1) * 2) + 1 = 1
    nwns_threshold_1 = cpu0 will be unplugged at this value
    Since we can't unplug cpu0 this is '0'.

    Two cpus are online.
    (2 - 1) * 2 = 2 ergo:
    nwns_threshold_2 = cpu2 will be hotplugged at this value
    ((2 - 1) * 2) + 1 = 3
    nwns_threshold_3 = cpu1 will be unplugged at this value

    etc...

    The default values are:
    NwNs_Threshold: 12, 0, 25, 20, 32, 28, 0, 35
    TwTs_Threshold: 140, 0, 140, 190, 140, 190, 0, 190
    Where the position and function of the number equals the result of the above explained formula.

    (all times are in ms)
    If you want to see the mpdecision magic happening:
    Code:
    adb shell
    cat /proc/kmsg | grep 'MPDEC'
    mpdecision's input event boost, aka project butter :p

    This will boost your min cpu speed if you touch the screen or press a button and gives you full control.
    In those events the min cpu freq will be risen to a predefined value (look below) on every online cpu. This boosts overall reaction times and smoothness a lot. (works similar to the qcom mpdecision binary)
    Configuration files:
    root@android:/sys/kernel/msm_mpdecision/conf # ls
    boost_enabled
    boost_freqs
    boost_time

    All of them work like the usual sysfs files, except one special case:
    boost_freqs will list all frequencies from cpu 0 to cpu x. Cpu 3 and any following cpu will share one frequency.
    To change those frequencies echo the cpu number + the frequency in khz. To change the boost freq of cpu3 (and 4,5,6,7,8, etc) the echo would look as follows:
    Code:
    echo "3 1026000" > /sys/kernel/msm_mpdecision/conf/boost_freqs
    for cpu0:
    Code:
    echo "0 1026000" > /sys/kernel/msm_mpdecision/conf/boost_freqs

    Defaults:
    Code:
    cat /sys/kernel/msm_mpdecision/conf/boost_freqs
    918000
    918000
    702000
    594000
    How does sweep2wake work? Does it keep my phone awake?

    Short answer: No.
    Long answer:
    Sweep2wake works with IRQs (Interrupts).
    An interrupt can be best imagined as you doing something, like shopping at the local super market, when someone jumps in front of you and punches you into your family jewels. You will most certainly not just continue shopping.
    In technical terms: An Interrupt interrupts the normal operation of a program and executes "special" code instead.

    So if you touch your screen, an interrupt is send on which the touch driver reacts. That's it.
    Since we have a capacitive touchscreen you also do not need to worry about any pressure onto the screen.

    If you want to disable sweep2wake execute this command on your phone (adb shell or directly), you can also add it to an init.d script.
    Code:
    echo "0" > /sys/android_touch/sweep2wake
    (echoing "1" activates it, which is the default setting)
    Recommended governor?

    Ondemand.
    Why do I have no WLAN?

    Due to this kernels very high optimization settings it is too big for our boot.img with WLAN included into the kernel, so it is built as a module. That means it needs to be inserted into the kernel upon boot up, which needs to be automated for maximum comfort.
    The zip adds this to your ramdisk, if that fails for some reason the wlan module cannot be inserted.

    if
    Code:
    adb shell lsmod
    doesn't show this:
    Code:
    tun 14701 0 - Live 0x00000000
    cifs 275399 0 - Live 0x00000000
    wlan 2964650 0 - Live 0x00000000 (C)
    Then something went wrong. (My fault)
    You can test it by executing
    Code:
    adb shell
    su
    insmod /system/lib/modules/wlan.ko

    Wait a few seconds and try to enable wifi and repeat the above lsmod command (should now show wlan).
    If WLAN now works, I messed up.
    Open a new issue in the issue tracker and it will be fixed asap.
    Last release for 4.2.2?

    STABLE: 20130622_233007_master-8fa9be1
    BETA: 20130727_023549_exp-d64cabc
    44
    Show-p, I have a lot of respect for you as a dev. I think you're very good at what you do but sometimes the way you answer people is a bit demeaning.

    I realize this is xda and most feel the need to ridicule people who don't read or follow threads properly but in the end we are all here to support and appreciate the devs work and help each other.

    I know you were responding to someone else but that's my 2 cents anyway. Just something to consider.

    If you are a dev you have no time to pry the information out of somebody. You filter out messages that are incomplete or just plain stupid, ruthlessly. You are blunt, because you just have no frakking time to say please and maybe and could you every time you explain something, which happens 50 times a day though the frakking information is already in the first post or on google!

    eg: Person X asks: "How do I get a kmsg?"
    What you think about that person: "Ok, a newbie, np I will tell him."
    What mods think about that person: "Why the frak do we have a search function?"
    What hackers (aka devs) think about that person: *throws the post into the imaginary trash can*

    eg: Person X says: "Crashed x times because y didn't function properly and it overall sucked! I reverted back to stock!"
    What you think about that person: "Valid feedback."
    What mods think about that person: "Somewhat lacking information but valid."
    What hackers (aka devs) think about that person:
    a) That person just assumes that feature y is broken while he has no clue what he is doing or about anything he just assumes would be broken. Strange dude #ignore or be blunt. (depending on time available)
    b) That person has done some digging and found out that feature y is broken but didn't include the frakking log. #ignore or assume a) because if he had done some digging he surely would have included the log.
    c) What the... #imaginary-trash-can

    If I would be polite and pry out the necessary information out of everybody this wouldn't be a full time job, this would be impossible to accomplish on a 24 hour day.
    I highly suggest that you read the link in my signature, which explains this situation and the misconception that someone is angry just because he is blunt quite good.

    For example this would be a hole-in-one issue report which never, ever occurred (this issue is just a dummy):
    ##############################################
    Let's start with the place: The ISSUE TRACKER, not the thread!
    Device: mako
    Android version: 4.2.1
    Kernel version: Bricked 0.75
    Settings: STOCK
    Title: Kernel panic and hard reboot. Null pointer oops in do_sweep2wake()
    Content:
    Hi,
    I recently experienced hard reboots due to kernel panics when using s2w on my mako with Bricked 0.75. It usually happens after resume from deep sleep and seems to be late_resume related. I have attached a log in which you can see a null pointer oops in do_sweep2wake().
    [OPTIONAL, IF YOU HAVE PROGRAMMING KNOWLEDGE:]
    My research showed that the power device pointer is not checked if it is valid and therefore is NULL sometimes.
    I do not know why that pointer is not set on rare occasions, but I have added this patch:

    #simplified
    Code:
    + if (bad_device_ptr->bla)
      bad_device_ptr->bla();
    This seems to fix the issue and keeps the function intact.

    [IF YOU HAVE NO PROGRAMMING KNOWLEDGE:]
    I googled this issues and it seems that there are source code changes required which I have no knowledge of.
    I would be happy to provide any more information needed.
    ##############################################

    I can deal with someone who has no experience, but I can't/won't deal with someone who made ignorance his/her life philosophy.
    23
    Since I just fixed the last sweep2wake issue (resume from deep sleep) after 3 hours of reading pm stuff you will all get a very early Christmas present. :)
    Well maybe I will add sysfs support to allow you to shut it down first, shouldn't take long though :)

    Oh wait! I forgot the traditional sweep2wake video! :)
    /me gets his 1X.

    Edit: