Nexus 4 Fixes: Custom kernel installer mods & more

Search This thread

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
Alright I think the bug I mentioned might have something to do with these problems. logd is getting overloaded and I think the kernel doesn't want to wait for it.

Please try r14mod3, I'll attach it to the OP.

Quick change log:

- Fix touch boost spam in logd
- disabled msm_hotplug as it's enabled by default in r14
- relaxed thermal throttle by using higher freqs until > 40 degrees danger zone



Sent from my Nexus 4 using Tapatalk
 
  • Like
Reactions: jolas

jolas

Senior Member
Feb 22, 2006
2,222
416
Athens
Alright I think the bug I mentioned might have something to do with these problems. logd is getting overloaded and I think the kernel doesn't want to wait for it.

Please try r14mod3, I'll attach it to the OP.

Quick change log:

- Fix touch boost spam in logd
- disabled msm_hotplug as it's enabled by default in r14
- relaxed thermal throttle by using higher freqs until > 40 degrees danger zone



Sent from my Nexus 4 using Tapatalk
I have disabled logs (by renaming logd to logd.bak).

I'll try new mod later today and report.

Thanks. :)

Sent from my Nexus 4 using Tapatalk
 

jolas

Senior Member
Feb 22, 2006
2,222
416
Athens
r14-mod-r3 feels faster than mod-r2 and phone is snappier.
I flashed it couple of hours before, so can't tell much more.
 

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
Great, just waiting to hear about kernel panics now; I hope they are gone again.

BTW, if you want to disable logd an easier way is to use KA or init.d to issue the command
Code:
stop logd

Although with touch boost spam fixed, logd uses hardly any CPU.

Sent from my Nexus 4 using Tapatalk
 

jolas

Senior Member
Feb 22, 2006
2,222
416
Athens
After a phone call I had a reboot with bootloop.

I powered off and on a couple of times in order to restart, so no valid kmsg.

Two findings I don't know if are related with kernel:
1. Very bad gsm reception
2. In Kernel Adiutor-Mod, no info in CPU tab, about min/max CPU frequencies.


Sent from my Nexus 4 using Tapatalk
 
Last edited:

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
After a phone call I had a reboot with bootloop.

I powered off and on a couple of times in order to restart, so no valid kmsg.

Two findings I don't know if are related with kernel:
1. Very bad gsm reception
2. In Kernel Adiutor-Mod, no info in CPU tab, about min/max CPU frequencies.

Wait, a reboot, without it booting? I've never seen that. Are you sure it wasn't a soft reboot?

And I think the KA-Mod assumes you want to use msm_limiter to set CPU frequency. That feature is disabled by default, so I guess just use KA.

No idea about GSM reception... I don't think the kernel has much to do with that. Bad weather, perhaps? :)

It's pretty disappointing to hear so many problems are happening, as I used this and tested r13mod1 (the one on Reddit) for weeks before posting it, and everything was perfect.

Maybe if spezi77 can give us r13 with July security patches, everything will be good...

Sent from my Nexus 4 using Tapatalk
 
Last edited:
  • Like
Reactions: jolas

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
Yes, reboot without booting. After tried to reboot, bootloop followed.

Hmmmm can you rename the logd.bak back to logd? Or even dirty-flash ROM and kernel installer again? I'm going to bet it has something to do with it.

Sent from my Nexus 4 using Tapatalk
 

jolas

Senior Member
Feb 22, 2006
2,222
416
Athens
Hmmmm can you rename the logd.bak back to logd? Or even dirty-flash ROM and kernel installer again? I'm going to bet it has something to do with it.

Sent from my Nexus 4 using Tapatalk
OK, i renamed back to logd, going to report back...

Edit:
I use this mod for a long time with Quanta kernel without any side effect.
Edit2: Sorry, back to logd.bak, prefer not having logs at all, waiting for new r13... :)

Sent from my Nexus 4 using Tapatalk
 
Last edited:

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
Alright let's try to smooth this thing out.

Please try r13-mod4, attached to OP

Quick change log:

- r13 instead of r14 (duh) while r14 testing gets sorted out
- removed two background services, and combined the others into a 'system' and 'cpu' daemon
- changed how to reset media server and sensors to make it easier to perform:

To reset media server and sensors if video playback, ambient display, accelerometer, compass, GPS, etc. stop working:

Press volume up and power key together

You'll get the Terminator 2 theme vibration and you should be back in business.

Sent from my Nexus 4 using Tapatalk
 
Last edited:
  • Like
Reactions: jolas

jolas

Senior Member
Feb 22, 2006
2,222
416
Athens
Bad news; it was charging while self-rebooted, but started over a black screen, so I forced to reboot in order to launch proper screen.
 
Last edited:

jer_ying_fd

Senior Member
Nov 30, 2013
1,047
591
Do you guys encounter a problem where thermald won't stick on synapse or kernel adiutor-mod? Or should I use kernel adiutor proper?
 

xenyz

Senior Member
Oct 30, 2010
1,368
1,446

lopardo

Member
Apr 27, 2011
25
14
Is there a version for CM? I'm currently using crDroid (based on CM) but I wanted to try plain CM13, unless anyone can suggest an AOSP ROM with CM's theme manager. :p
So, any suggestions on what ROM to use?

About the thermald warning in the first post, I'm not sure I get what it's about. Is it that you shouldn't flash/update a ROM without flashing this kernel afterwards?

Thanks.
 

xenyz

Senior Member
Oct 30, 2010
1,368
1,446
Is there a version for CM?
[...]
About the thermald warning in the first post, I'm not sure I get what it's about. Is it that you shouldn't flash/update a ROM without flashing this kernel afterwards?

I'll post one for CM later today.

The warning is because I've noticed that almost every other custom kernel installer renames / moves / deletes the thermald binary, instead of just disabling the service.

Sent from my Nexus 4 using Tapatalk
 
  • Like
Reactions: lopardo

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Intro

    Over the past while I've finally decided to fix all minor annoyances on my Nexus 4. Here is a guide where I'll share all my modifications to make Mashmallow on the Mako as good as can be.

    Kernel

    Kernel Proper

    The actual kernel included in this guide is HellSpawn kernel by @spezi77 which is based on hells-Core for Marshmallow, with all up-to-date Linux patches (3.4.112) and Google security patches (June 1). (Although I use, advocate, and absolutely recommend HellSpawn, feel free to use another custom kernel in the installer. You'll have to replace zImage and make your own changes to kernel/sema-boot.sh if your kernel doesn't include the same governors, hotplugs, etc.)

    Here are a few highlights of HellSpawn itself:

    - Includes the elementalx governor from @flar2 and lightweight mako_hotplug driver from @franciscofranco, which are much better than the stock ondemand governor and mpdecision hotplugs.

    - Includes franciscofranco's gamma control, which is a much better default gamma for your screen and can be changed with franco's Nexus Display Control app or other Kernel Tweaker Apps.

    - Includes a GPU overclock (400 -> 487 MHz) for when really demanding graphics operations require it.

    - Includes BFQ, an optimized version of the default kernel's CFQ i/o scheduler. It helps when Play Store updates occur or when apps perform a lot of disk activity.

    - Includes double tap to wake feature, which uses minimal extra battery and is much more convenient than the power key.

    - When the screen is off, and not sleeping, only one CPU is active and it's limited to 1 GHz, which helps standby battery life with running background services.

    Custom Kernel Installer
    (original post with r1 was made on reddit)

    I've adjusted many default kernel settings, based on a few years experience of running custom kernels. It uses the optimized elementalx governor from ElementalX kernel and lightweight mako_hotplug from franco kernel, with some of flar2's N5 settings, some of @hellsgod's N6 settings, and some of mine. There are other governors and hotplugs available, but from my experience, these offer the best balance of speed and battery life.

    It includes a small, safe, -50 mV undervolt for a bit less heat from the CPU. - a user on reddit reported a reboot with r1, so I've removed voltage settings. It's probably useless to include such a small undervolt anyway. Change voltage settings in an init.d script or Kernel Tweaker app if you wish.

    It activates double tap to wake by default, and also turns on power key suspend. If you press the power key with the screen on, double tap to wake will be turned off. Those on custom ROMs or Xposed's GravityBox can activate features to turn the screen off (double tap status bar, lock screen, nav bar, etc.) and keep double tap to wake on. Those without custom ROMs can perhaps use something like Greenify which can remap the home button long-press to turn the screen off.

    It includes a patch to sepolicy which allows Viper4Android to work in selinux enforcing mode. You need to have SuperSU installed to have this work.

    I've adjusted the io scheduler and page cache for better performance, tuned towards random reads.

    It includes stock thermald and a tweaked thermald configuration that scales CPU frequencies up and down a little smoother when your temps get high. It should be noted that most custom kernels disable thermald for their own in-kernel thermal driver. I never liked doing this, as thermald does more than just adjust CPU frequencies - it also throttles GPU, screen brightness, and most importantly, battery charging. When your device gets too hot while charging, the worst thing to do is keep up the current and let the battery go over 45 degrees.

    It includes a service to do 'Shared Cpufreq Policy', which lets thermald throttle all cores properly, and also lets the Battery Saver feature work correctly, by limiting all cores. This hasn't worked since KitKat and was one of my biggest annoyances. Many, if not all custom kernels just deleted the Power HAL libraries so battery saver feature doesn't work at all!

    Includes Semaphore's 'mpdfake', a service to eat the touch boost spam that the Power HAL generates when not using mpdecision. If a custom kernel does not delete the Power HAL libraries, then your logcat is being spammed and logd process uses a lot of background CPU!

    Includes a service to attempt to fix once and for all the location/GPS issues. I'm not going to state it works 100% yet, as I've only had max 24 hr uptime while making changes from the r1 release, but so far so good. Fingers crossed...

    Includes a service to give SystemUI and Phone/Dialer higher priority. I haven't had a chance to really test it, as my device is sans-SIM at the moment, but it hopefully will lead to better responsiveness when you receive a call. (Under testing: giving some background processes lower priority, so they don't interrupt app usage.)

    Move dalvik-cache to /cache partition and free 300-500 MB:

    On each boot, it will check to see if you have a /cache/dalvik-cache folder, and will use it as the dalvik-cache if so.

    If you are clean flashing a ROM and want to use /cache for dalvik-cache, create an empty dir in TWRP: /cache/dalvik-cache

    If you just want to switch from /data to /cache, copy the /data/dalvik-cache to /cache/dalvik-cache and reboot.

    Remember to be careful not to wipe /cache when 'dirty' flashing if you do this!

    How to reset the mediaserver process quickly to get videos playing:

    While your screen has been on for a few seconds or longer, double press the power key. You'll have to try it a few times to get the timing right, because a quick double press activates the camera in some ROMs. Also you're waiting for the screen to go off, not just dark. Practice a few times in low light, and you'll get the hang of the timing: each press should be followed by about half a second. You'll feel a short vibration when the service resets mediaserver to give some feedback that it's working. If it doesn't run the first time, keep cycling the screen off and on again until you get that vibration.

    Remember: you have to start with the screen on, this allows you to quickly check on notifications from screen off without resetting mediaserver.


    How to reset the sensors if ambient brightness, auto rotation, GPS, or any other sensors stop working:

    Same as above, but this time you do the action twice. That is, screen on - double press power - vibrate once - double press power. You must do the two double presses within a second or two, so a little more practice may be needed. You'll feel two short vibrations when the service resets the sensors.

    *** As of mod-r4, the new method to reset both mediaserver and sensors is Hold Volume Up and Power.

    How to reset the touch screen if it becomes unresponsive:

    If you happen to double tap to wake, the screen comes up, but no touches are being registered, tap on the screen with five fingers. If this doesn't reset it, turn the screen off and on again with the power key, and tap on the screen with both hands, all ten fingers. This will reset the driver and get it going again without a reboot.

    Download & Installation

    The installer is attached to this post. It's for AOSP ROMs, and uses the UberTC 5.4 toolchain. I'll post up CM versions on request.

    Flash the zip with TWRP 3.0.2. If you have made any changes to your Marshmallow ROM (other custom kernels, etc.) you must remember to always flash custom kernels after (dirty) flashing custom ROMs! This is especially important, as if you are missing thermald you're going to have a bad time. FLASH YOUR ROM BEFORE THIS KERNEL INSTALLER UNLESS YOU HAVEN'T MADE ANY CHANGES. You can kill your device without thermal throttling!

    Wiping dalvik-cache, and /cache is never necessary when flashing a custom kernel only.

    ROM

    Graphics Drivers

    Audio

    SuperSU - System or systemless?


    Changelog: r14-mod-r3 - r13-mod4 - r16-mod-r5 - r04-mod-r6 - r05-mod-r7
    3
    I am using latest Fake Nexus ROM [@ganachoco] w/ Pixel modifications (SystemUI), installed "hellspawn-r04-mod-r6.zip" @xenyz] last week, but my N4 didn't go into deep sleep after that... maybe I did something wrong during kernel installation?

    [...]

    Compared to Mako (the hotplug i am using), Alucard seems to make my N4 much more laggy (maybe I have to switch to another configuration like hellscore & alucard then?)

    [...]

    Do you really measure a performance increase, either using BFQ or NOOP? I don't

    Use BetterBatteryStats found here on XDA to figure out what was keeping your device awake. It's hard to guess but I don't think anything included in the modified installer would cause it.

    As for the alucard hotplug driver, I agree with default settings it's quite laggy. I went through the source and I'm trying to make it behave similar to mpdecision, but I'm not sure it can be a complete replacement. One thing mpdecision does is bring up the second core at 1 GHz on touch, which is probably why it's so smooth.

    I chose BFQ as it's the successor to CFQ and Android uses it with cgroups to manage IO. It really only makes a difference when multitasking with heavy IO, and that generally only happens with Play Store updates, and it's usually CPU bound not IO bound on the N4. I'm not sure iosched is worth the concern.

    Edit: after watching that video, I think arter97 missed one important part on his first test: how much of his background data write actually occured? If you give priority to reads and forget about writing, of course you'll have better app opening times. But how much of his simulated download was each device able to get during the test? The second test without background writes was interesting though. Who wants to try it on their N4?
    3
    Any update about using alucard hotplug? Whenever is a build to test you can send to me that I don't have any problem to flash any times be necessary. :p
    Not really not yet, but soon. :)

    I stopped getting the strange screen on SoD after the first two nights and just have kept it as is. I am on the Sleep as Android beta channel; it's possible that was it, who knows...

    If you try it out let me know how it goes though?

    Edit: Aaaaaand instant karma. Not 5 mins after posting this my N4 locked up without Sleep as Android, just playing some Spotify tunes. I'm on it now, stay tuned...
    2
    If I want to customise the features, do I only comment out the features which I don't need in sema-boot.sh? Thx!

    Sure, or another option is to put your overrides in /system/etc/init.d

    Until now I'm testing it and the only cons I found is that with mako_hotplug when (temp increases) 1026 frequency makes mako very unresponsive.

    Is there a way to change this frequency through a init.t script?

    Carefully edit /system/etc/thermald.conf either in the installer before flashing, or on your device after flashing, and make your changes near the end of the file.


    Can anyone comment on whether their location services are working better? I'm still undecided.

    Sent from my Nexus 4 using Tapatalk
    2
    Thanks. I just saw your statement about MPDecision hotplug running better than any other hotplug in the kernel on HS thread. So I would like to ask if you have reactivated MPDecision on your installation script.
    Yeah I'm testing it out right now! I haven't posted it yet but if you want to try, edit install_kernel and comment out the line like so:

    Code:
    #../busybox sed "$mpdline,$mpdline2 d" -i init.mako.rc

    then edit sema-boot.sh and change:

    Code:
    # hotplug
    echo 0 > /sys/module/dyn_hotplug/parameters/enabled;

    Remember to re-flash stock boot image/ROM/SuperSU and then flash the new kernel installer.