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

Root [3.4.107] [Linaro] Schwartz v1.0 4/24/15

spock1104

Android Expert
Yogurt: I am the keeper of a greater magic, a power known throughout the universe... as the...
Barf: ...the Force?
Yogurt: No, the Schwartz!


Introducing the Schwartz kernel. I've taken the stock kernel source from the N9810 Vital (a similar phone to the N9100 Force) and compiled it with Linaro 4.9.3, with cortex-a15 optimization and added customizations. The result from benching seems to be better I/O and memory performance, and my personal observations are that the phone is much more responsive as well as having better battery life. My goal is to continue adding updates and customizations. As such, I'm taking feature requests.

Features:
Kernel 3.4.107
Linaro O3 optimized compilation
CPU overclocking up to 2 GHz (Try clocks 1 step at a time or you may break your phone)
CPU voltage controls
Extra CPU governors
Extra GPU governor
Built-in thermal control
Built-in mpdecision
Dynamic readahead
exFAT/SDXC
F2FS
Prevent entropy depletion
Misc. driver updates

**Disclaimer** I take no responsibility for the coming of the apocalypse, cats and dogs getting along, violations of the rules of physics, your significant other leaving you, or a broken phone. Make sure you have backups. Consult a dev if you experience excessive uptime.

Your WiFi MAC will change on first boot of this kernel! Download here:
http://www.mediafire.com/download/07rk2dz36454614/schwartz_v1.0.zip
MD5: A8FBC00B071871B91E775BA61A304A84

To tweak the kernel (such as governors, schedulers, mpdecision) the use of 3C Toolbox is highly recommended. Trickster Mod is a simpler option but is prone to busybox issues. These are the only two verified to have full support. I'm in the process of validating Kernel Adiutor, looks promising.

Please note that I have only tested against Sawbones999's Jellybean ROM and should easily work with Buzbee's. I don't know about ICS yet.

For great I/O, use the SIO scheduler with a cache size of 2048 or the FIOPS scheduler with a cache size of 3072.

*** Overclocking is luck of the draw, not all processors can overclock and some can overclock better than others. DO NOT set an overclock on boot until you have stability tested that clock, otherwise you will end up in a boot loop ***

If you encounter a stability issue please collect a logcat and a dmesg/last_kmsg for me so I can investigate. I stability test on my phone and generally don't have issues when I release. [HOW TO] - [Post Kernel last_kmsg] - [make Nova Launcher fully expand(desktop mode)] - xda-developers for more detail on last_kmsg

Switch back to stock: http://www.mediafire.com/download/il15ymm4bcr7or6/force_sawbones_kernel.zip
MD5: 165E5E5EA7D164DD4D1C0FA9CB9B2380

Source code here: https://github.com/spock1104/android_kernel_zte_msm8960
If you make use of this code please try to fork or at least cherry-pick to facilitate code sharing. If you build this code or any subset into a binary you must make your source code available at the same time, per GPL.

Loading instructions:
To permanently load the kernel, flash the zip in recovery. This WILL overwrite system files, make sure you have a backup! There's no need to perform wipes, but it's recommended that you perform a battery calibration.

See post #2 for tips on reducing battery drain

See post #3 for a guide on compiling your own kernel

HTML:
CHANGELOG:
<B>Schwartz v1.0</B>
Linaro 4.9.3 2015.03
Switch from OS to O3 optimization
patched the kernel up to 3.4.107
add exFAT support (should enable the use of SDXC)
add F2FS support
readahead tweaks
prevent entropy depletion
add overclock up to 2 GHz
Add CPU voltage tuning
Add Intelliactive, Intellidemand, and Lionheart CPU governors (Thanks PhenomX4)
Add dynamic readahead (Thanks rbheromax)
Add mpdecision and modify for two cores
thermald replaced with kernel based thermal throttling and shutdown (thermald can cause the CPU to exceed the user set max)
Update Prima to 3.2.7.47
Add VR, ZEN, SIO, and FIOPS I/O Schedulers
Add Wheatley and Conservative CPU governors
Update WCNSS WiFi
Update Bluetooth

I appreciate any feedback, testing, and development help I can get.

Thanks to Sawbones999 for getting Jellybean working.

Thanks to TrustME90, Hodr, Robert Chase, and thegreatyashu for feedback during my pathfinding/alpha period.

Thanks for the source:
aosp
cyanogenmod
codeaurora
rbheromax
phenomx4
jimsmith80
showp1984
faux123
dorimanx
f4k
DooMLoRD
franciscofranco
Grarak
And a HUGE thanks to Christopher83 for his Linaro binaries


Enjoy! and...

To Do:
OTG support
Add color controls
cleanup unnecessary code
update drivers
init.d support
anykernel updater
 
Last edited:
Helping you and me reduce battery drain

In order to reduce battery drain, we need to know what on the phone is actually draining it. We can accomplish this via Better Battery Stats. Download and install the app, and give it root permissions.

What can you do to reduce your own battery use?
Monitor the partial wakelocks, which will come from apps waking the phone up to do their thing. Some apps just like to be greedy about their CPU usage. If it's an app you can do without, uninstall it. If it's a system app you can do without, I recommend using ES File Explorer to force an uninstall (BUT BE VERY CAREFUL ABOUT WHAT YOU REMOVE). Make a backup first, either nandroid or with Titanium Backup. If you want or need to keep the app, I recommend using Greenify to hibernate the app.

What can you do to help me reduce battery use?
Monitor the kernel wakelocks tab. If it looks like the kernel has gone wild:

  • Open the BetterBatteryStats settings
  • Open Advanced
  • Open Sharing Options
  • Select Text, Logcat, and dmesg
  • Go back to the main screen
  • Select the share button in the top right
  • Select save
  • Grab the dated BetterBatteryStats, dmesg, and logcat files from your sdcard
 
Last edited:
This is a work in progress and open source. I have limited time to work on it and would rather not do so alone. So, here's the basics to get started. The environment will also set you up for ROM building for the eventuality we get full ROM builds from source.

Environment
This can be done on either a dedicated box or a virtual machine. I've seen recommendations of 50-100GB of space, but I recommend 150 for managing several build directories at once. Follow most of the instructions on Initializing a Build Environment | Android Developers . Also don't mind the RAM requirements, I run my virtual machine with 4GB and its fine.

and to install git

sudo apt-get update sudo apt-get install git git-core
use the instructions at Downloading the Source | Android Developers to install Repo

You'll also need a toolchain. The source provided by ZTE will not boot with a 4.8 or later GNU-based toolchain, but I've since fixed this. I'm using a custom Linaro 4.9.3 build from [LINARO GCC] Cross Compiler Toolchains [Linaro GCC 4.9 2014.05, 4.8 and 4.7 2014.04][17/05/2014] - xda-developers
Make a directory in your home folder called toolchains, and unzip the toolchain in this directory.

Lastly, you'll need the tool for building boot images

sudo apt-get install abootimg

Downloading the source
Decide on a directory structure for yourself on where you want to put your builds. I recommend ~/nex/

Sign up for an account on GitHub, and then go to https://github.com/spock1104/android_kernel_zte_8960 and click the Fork button. This will duplicate the source code on GitHub to an area where you can make your own changes, and hopefully lead to collaboration. On the webpage for your fork, on the right side there will be an HTTPS Clone URL. Copy this URL.

Back to the terminal, go to your working directory and type
git clone <clone_url>

This will download the source to your computer so that you can begin working on it.

now open the android_kernel_zte_8960 directory and do a

git checkout

Build the code!
First we'll set up variables that tell the system what we're building and how to do it

export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/toolchain/arm-cortex_a15-linux-gnueabihf-linaro_4.9.3-2015.03/bin/arm-eabi-

Next many more variables that tell the system what kernel options we want

make msm8960-hayes_defconfig

And lastly building the code

make

*Or if you are set up with multiple processors and want to run a faster build, add a -j# where the # is one above the number of processors you're using. Ex. for two processors run

make -j3

You'll see a lot of compiler messages scroll by. With any luck, you'll get no errors and the magical words at the end:

"Kernel: arch/arm/boot/zImage is ready"

Create a bootable image
The zImage is what you need from the compilation but it's not enough to run with. Now you need to piece together a full boot image. Download the stock boot from post #1 and extract the boot.img from the zip into your kernel directory. Copy to a new name, like test.img. Then do:

abootimg -u test.img -k arch/arm/boot/zImage

this will likely result in an error message that the image is too big, like this one:

test.img: updated is too big for the Boot Image (7712768 vs 6828032 bytes)

The solution to this is going to seem far too easy but it works, and will work so long as your boot image doesn't exceed 16MB. Copy the size it is complaining about and feed it back to the tool.

abootimg -u test.img -k arch/arm/boot/zImage -c "bootsize=7712768"

You now have a usable boot image that you can run through the bootloader or directly flash. You will also need to copy ./drivers/staging/prima/wlan.ko to /system/lib/modules/prima/prima_wlan.ko for WiFi to work.

If you want to make a flashable zip, copy the latest Schwartz zip and extract. copy your boot.img over mine with the same name, and do the same for prima_wlan.ko. Zip it back up.


Let me know what information you'd like to see added or improved in this guide. Thanks, and happy compiling!
 
Last edited:
Stock benchmarks:
ZNtToql.png

a7LYKFc.png

0Tf7Npw.png
 
Last edited:
Thanks! I've only messed with it briefly, but so far so good. The only issue I've had so far is that whenever I'd go into the CPU manager on 3C Toolbox Pro, it would immediately bump the max frequency to 2ghz and sometimes result in freeze/reboot. I think I've been able to do 1.89 ghz (or whatever the number is, I don't have the phone on me right now) stable so far.
 
Thanks! I've only messed with it briefly, but so far so good. The only issue I've had so far is that whenever I'd go into the CPU manager on 3C Toolbox Pro, it would immediately bump the max frequency to 2ghz and sometimes result in freeze/reboot. I think I've been able to do 1.89 ghz (or whatever the number is, I don't have the phone on me right now) stable so far.
There is a bug with toolbox where if you don't have it set to change your CPU settings on boot it will show the max clock instead of the default. You can verify in the CPU times or with trickster that the CPU is running at the expected speed.
 
Does it matter if I have the settings on boot vs. init.d?
I would imagine that 3C Toolbox will have the bug using init.d. I have to speculate that on startup Toolbox is checking the wrong file for the current frequency.

How support OTG to nokia x
I don't know if we can do OTG with this phone, the Nexus 4 (similar hardware) can't provide power to its USB port and needs a Y cable. Probably the same case here. I ordered a Y cable for my AWE previously, and can try it here, if only I can find where I put the thing.
 
I would imagine that 3C Toolbox will have the bug using init.d. I have to speculate that on startup Toolbox is checking the wrong file for the current frequency.

Yeah. I see it sometimes still shows up on boot, and sometimes doesn't.

While the phone is much faster now, I'm having battery life issues on this kernel that I haven't been able to pin down. I'm not overclocking, the phone is going to sleep when not being used and not being woken up by hundreds of wakelocks, but it is losing 5-6% per hour, whereas it used to be 1.5%. I check the stats on 3C Toolbox after letting it sit for a few hours and there's literally next to nothing using the phone while it is off. Very odd.
 
Yeah. I see it sometimes still shows up on boot, and sometimes doesn't.

While the phone is much faster now, I'm having battery life issues on this kernel that I haven't been able to pin down. I'm not overclocking, the phone is going to sleep when not being used and not being woken up by hundreds of wakelocks, but it is losing 5-6% per hour, whereas it used to be 1.5%. I check the stats on 3C Toolbox after letting it sit for a few hours and there's literally next to nothing using the phone while it is off. Very odd.
Try a battery calibration with a complete discharge after wiping battery stats. The charge after that should creep around 1%/h when the phone is sitting unused. If it doesn't help, grab the logs I list in post #2 and I'll try to find a cause.
 
Update on potential culprit. I installed BBS and on two occasions, after 20 minutes or so of letting it sit, I checked the stats and saw it was awake the entire time (which does not show on the stock battery chart) due to kernel wakelock msm_otg. It sounds as if on other phones this occurs when you boot the phone while it is plugged in. I tried booting again unplugged, checked after 20 minutes, and no msm_otg wakelock, and it was asleep for 17 of the 20 minutes. I left the phone at home today to sit idle so I could check the results when I get home.

I also tried calibrating it a handful of times since getting the phone in February. Even with three different batteries (the original ZTE, and two eBay knockoffs of questionable mah), it likes to randomly jump up or down when charging or discharging. It seems to be most reliable with discharge when the screen is on, and most reliable with charge when done on USB. With a standard 5V 1.0A charger, it'll go from 0 to 100 in like 45 minutes, usually with a jump from 55% or so to 100% right away. With USB it might take until 90% or so for that jump, if any jump occurs at all.
 
I've seen the battery jumps too and I'm not sure I can address that. I will check into the otg code and see if there have been any patches for that issue. Thanks!
 
Yeah, the battery jumps seem to be a device issue, as they have been present since I first bought the phone, and I've seen a few mentions of it on the FreedomPop forums. Aside from a couple of times where I went from 40ish percent to 0 instantly, there is usually only one jump down, and if it happens early enough, you can adjust usage accordingly. On good days, it has decent battery life. I ran Antutu battery tester (which runs at 100% brightness) continuously for 4 1/2 hours one time.
 
Upon further testing, I figured out the problem from browsing the FreedomPop forums. Apparently there were batches of the phone that were sold with fake OEM batteries that had a real capacity of 1100 mah. I tore the sticker off mine, and sure enough, printed on the inside is 1100 mah, hence the random spikes and drops.

I'm not sure if I'm upset that I was sold a phone with a false battery label, or relieved that all this time I've been using it I've been getting by with only 6/10ths of the power that I thought I was.
 
My "hopefully" OEM battery should be here Friday (it says refurbished, which probably just means they cleaned scratches off, but at least it should be real), so I'll get to see some real battery life results then. In the meantime I've been messing around with different governor and voltage settings. The biggest surprise to me was that msm dcvs was very sluggish (even with OC up to 1.83), and ondemand didn't miss a beat when I raised the up threshold and sampling rate for potential battery savings. It's obviously not as fast as the Nexus 4/LG G2/OnePlus Ones I used to own before I decided to stop using high end phones, but for having the same amount of RAM as the laggy 2012 Nexus 7 I once had, I've been pleasantly surprised by the speed.
 
I bought a used one on eBay. I made sure to look for one with photos so that I could verify that there was wear and tear on the outside. The fonts and such are slightly different than the fake ZTE one that came with the phone, and it tests at 1600+ mah on 3C Toolbox Pro, so I'd assume it is legit. Regardless, it is obviously sufficient.

The battery related tweaks are fairly minor. I use PowerNap to kill most wakelocks when the screen is off (which is nicer than Amplify because I don't have to deal with figuring out intervals or dealing with the constant "Google Play Services has stopped messages", plus I don't care about wakelocks while screen is on), and GravityBox to switch the network to 3G when I'm connected to Wifi. It makes about a 1.2%/hour difference, mostly because of the poor LTE signal at my house.
 
Would you mind posting a few pictures of the battery? I've been looking for one and there are just far too many "well done" fakes to be able to tell which combination of logos and text is the legit one.
 
I would have posted a picture of my actual battery, but it has a big metallic piece stuck to it that says SCOSCHE for my car mount, so it blocks the battery info. The picture in the listing looks like the writing on the battery though. The fake one has a different font. I'll try and get a picture of that one when I can find it.
 
It will be awhile but I'll be coming back to look at those kernel building instructions!

How well does this play with DSF and the sawbones rom?
 
Back
Top Bottom