FORUMS
Remove All Ads from XDA

[KERNEL] TonoKrnl for Nexus 7 (2013)

473 posts
Thanks Meter: 129
 
Post Reply Email Thread
EDIT: I want to remind everyone DO NOT FILE AN UBUNTU BUG REPORT WITH THIS KERNEL INSTALLED, ALWAYS REVERT BACK TO THE STOCK KERNEL IF YOU HAVE AN ISSUE BEFORE FILING

This is my first actual Kernel project, so please be gentle.

This kernel is ONLY for the Nexus 7 (2013) flo. I do not know if it boots on the deb, theoretically it should as I don't have any flo specific options and there are config options for Deb in the Kernel configuration. It should work for those on stable, rc or rc-proposed and may possibly work on devel (not sure) as long as devel has not released a new kernel package (3.4.0-5-flo+)

I have cherry-picked some battery optimizations from bricked-flo, elementalx-flo (4.4 branch) and some additional commits elsewhere in an attempt to not only improve battery-life but also to bring some Android features (DoubleTap2Wake) to Ubuntu Touch.

Currently it has the following:
- ROW I/O scheduler
- Beginnings of OCing (pulled from ElementalX, I think I'm missing some commits to make this relevant though)
- ElementalX's kernel thermal control
- binfmt_misc support
- CD/DVD Filesystem Support for external optical drives (ISO9660/UDF)
- Some Slimbus enhancements
- Battery life optimizations (changing default MHz, etc.)
- Default CPU governor changed from Performance to Interactive (yes, they had it set to Performance, not sure why.)
- Direct Rendering Interface/Direct Rendering Manager (XFree86 + msm_kgsl_drm)
- and more!

You can check my github for the items cherrypicked into it and there is even a current release which has seen my battery drop 4% in the last 30 minutes with the screen fully on (no autolock), WiFi on and Bluetooth.

The name of the kernel is still up for change, TonoKrnl is not going to be it's final name unless everyone likes it.

Repository is at: http://github.com/ShadowEO/TonoKrnl

Releases can be found: https://github.com/ShadowEO/TonoKrnl/releases

Status of Github Repo: It builds. It boots and it runs. I am trying my hardest not to push changes that break building.
 
 
14th June 2016, 10:34 PM |#2  
OP Senior Member
Flag Columbus, Ohio
Thanks Meter: 129
 
More
Reserved for future use. Currently the status of the kernel's updates can be found on the issue tracker: https://github.com/ShadowEO/TonoKrnl/issues/5

Be patient, if you don't see new releases right away, it's because I'm still in the process of generating them, check back later.

-- Release 1.0.3-UBports (11/19/2017): A lot was done to bring this kernel back into usable state, see below:
  1. Added OTG Charging
  2. Added initscripts for turning on features (Requires the rootfs to be mounted read/write for manual installation, see my latest post #16 I think...)
  3. Created patches to be applied against a clean UBports kernel tree for certain features (right now, only DT2W and USB Charging)
(USB Host Charging was pulled from flar2's ElementalX source code, it is not turned on by default and can be turned on with
Code:
echo 1 > /sys/module/msm_otg/parameters/usbhost_charge_mode
Feature is tested and does work.

Developers:
1.0.3 brought the kernel tree back into a buildable state and also cleaned up some problems with the previous releases. I am in the process of generating a kernel patchset which will be able to be applied to a clean kernel to bring those features to the stock UBports kernel source. After I complete generating the kernel patchset, I will be rebasing the entire kernel project onto a clean tree (As I am absolutely certain that I have problems like unfinished cherry-picks [missing commits] etc.). Be patient regarding these patches, as I am re-adding the features I pulled in originally by hand rather than cherry-picking them as I appear to have fuxxed up somewhere cherry-picking previously.


If you have any random reboots, try:
Code:
echo 1 >/sys/module/msm_watchdog/parameters/runtime_disable
If you still receive random reboots afterwards or if you received them previously but the above command fixes them, please open an issue on my project tracker with a copy of /proc/last_kmsg attached.

Kernel TODO:
  • Generate kernel patchset and then rebase onto clean kernel tree
  • Finish Kernel Feature Documentation and publish (these docs will give information on tweaking the changes to the kernel, such as readahead buffer, turning on/off DT2W, turning on/off usbhost charging, etc.)
  • Move TonoKrnl initscripts into ramdisk, should make them more robust and reliable.
  • Create ZIP installer for TWRP recoveries (this is needed for automatic installation of kernel modules, since /lib/modules is a read-only, bound mountpoint for the Android LXC container. To fix this, we just have to move /lib/modules out of the Android container.
18th June 2016, 12:35 PM |#3  
Member
Thanks Meter: 10
 
More
Allow me two questions:

Which kernel repository is this branched off? Apologies if that is dumb question, my git and kernel knowledge is cursory at best, but I can't seem to figure this out looking through your github repo.

Quote:
Originally Posted by ShadowEO

- Direct Rendering Interface/Direct Rendering Manager (XFree86 + msm_kgsl_drm)

What's the intention behind this? Does this have anything to do with enabling the freedreno driver for the GPU and would that pave a way to a setup without Mir, but with wayland or X?
18th June 2016, 07:03 PM |#4  
OP Senior Member
Flag Columbus, Ohio
Thanks Meter: 129
 
More
Quote:
Originally Posted by doniks

Allow me two questions:

Which kernel repository is this branched off? Apologies if that is dumb question, my git and kernel knowledge is cursory at best, but I can't seem to figure this out looking through your github repo.



What's the intention behind this? Does this have anything to do with enabling the freedreno driver for the GPU and would that pave a way to a setup without Mir, but with wayland or X?

This started off with the debian source package for linux-image-flo in the Ubuntu archives which is the kernel for our device. The reason you are having trouble with figuring it out is because I started with the base (Ubuntu's 3.4.0-5-flo+), pulled it into an empty git repo and then started cherry-picking features. It was originally going to be for my own personal consumption as I didn't know how well a custom kernel would be received by the touch community (so far, in all the communities I've posted it, you were the only one to ask any questions ), but since I already had a git repo up, figured that I may as well share it. So here I am, an amateur working on the Linux kernel, and learning a lot.

My full intent was to improve the experience (even marginally) on Ubuntu Touch for the Nexus 7 2013, I wanted to bring the mobile kernel features previously found on the desktop that myself or others may find useful (hence binfmt support for qemu-user), there really is no reason for me to turn on DRI/DRM except to allow playing with Wayland and X, yes, that part is correct, and I have tested the freedreno driver with it (Freedreno does get the KGSL DRI device and does start X)

In addition I found some interesting choices in the kernel in terms of battery life, it would seem that the CPU governor used by the default Ubuntu Kernel is Performance, which would explain why the battery dies so fast, I tried to pull in some battery optimizations from a couple other kernels around the Android scene for the device. So far I'm pleased with the results, and recently found that both the original cherry-picking done for DT2W worked along with the code to add fast charging.

I've had to put the project on hold due to work issues, but once I'm able to work on it again, I'm reverting the last 100 changes pulled in that broke my tree and going from there since my original targets in terms of features actually worked. (I'm pretty sure it was some recent changes to the CPU hotplug driver that killed it, I can no longer compile the kernel without mpdecision on, so that's my likely suspect.)
The Following User Says Thank You to ShadowEO For This Useful Post: [ View ] Gift ShadowEO Ad-Free
19th June 2016, 08:50 AM |#5  
Member
Thanks Meter: 10
 
More
Thanks for your explanations!

Quote:
Originally Posted by ShadowEO

This started off with the debian source package for linux-image-flo in the Ubuntu archives which is the kernel for our device.

So something like apt source linux-image-flo? And then to build you use the instructions in the package also?

Quote:

there really is no reason for me to turn on DRI/DRM except to allow playing with Wayland and X, yes, that part is correct, and I have tested the freedreno driver with it (Freedreno does get the KGSL DRI device and does start X)

Exciting!

Quote:

In addition I found some interesting choices in the kernel in terms of battery life, it would seem that the CPU governor used by the default Ubuntu Kernel is Performance, which would explain why the battery dies so fast

I'm really only speculating, but my conjecture to previous mentions of odd govenor choices in android kernels was that the actual android power management magic is happening behind the backs of the governors. But, I'm really just babbling. I don't know much of anything about this. You seem to be getting impressive improvements!

Quote:

I'm reverting the last 100 changes pulled in that broke my tree and going from there since my original targets in terms of features actually worked.

So, that means: "If you want to try it now, don't use v1.0.2, but use v1.0.2-alpha for now." Is that about correct?
20th June 2016, 01:30 AM |#6  
OP Senior Member
Flag Columbus, Ohio
Thanks Meter: 129
 
More
Quote:
Originally Posted by doniks

Thanks for your explanations!



So something like apt source linux-image-flo? And then to build you use the instructions in the package also?


there really is no reason for me to turn on DRI/DRM except to allow playing with Wayland and X, yes, that part is correct, and I have tested the freedreno driver with it (Freedreno does get the KGSL DRI device and does start X) Exciting!


In addition I found some interesting choices in the kernel in terms of battery life, it would seem that the CPU governor used by the default Ubuntu Kernel is Performance, which would explain why the battery dies so fast
I'm really only speculating, but my conjecture to previous mentions of odd govenor choices in android kernels was that the actual android power management magic is happening behind the backs of the governors. But, I'm really just babbling. I don't know much of anything about this. You seem to be getting impressive improvements!


I'm reverting the last 100 changes pulled in that broke my tree and going from there since my original targets in terms of features actually worked. So, that means: "If you want to try it now, don't use v1.0.2, but use v1.0.2-alpha for now." Is that about correct?

I removed the problem download, the only ones available are the source tree downloads and the last known good build I had, I have also tested to ensure that the last build up there works as well as it's the one I'm running on my device until I have time to go through the tree again.

As for building, essentially yes, but you have to build the image separately. Due to how Ubuntu currently has the filesystem set up and with Android's boot images, its not feasible to really package it in a traditional sense. Essentially what I did was create a chroot, apt-get source linux-image-flo and then to get a working defconfig I used the config.* files found in Debian.flo and Debian.master, from there was the tree that I used as my base.

Then run make with the following to customize:
Code:
ARCH=arm make menuconfig
ARCH=arm make -j <number of processors>
To build the image, you'll need to grab the boot image from your device and tear it apart using a abootimg them rebuild it with the Ubuntu ramdisk. If you are using MultiROM, you can just drop it in the folder for your ROM.

Edit: As for the weird choice of governors, I noticed during my investigations (via the cpufreq-info package) that while Android is managing the CPUs that are online (I found it's running it's own version of mpdecision behind the scenes inside the LXC container), it's not doing anything to the CPU governor. That's all managed in the kernel right now through CPUFreq it appears and in the stock kernel it's set to performance, as for the reason for it, I'm not sure myself.. The other governors ARE there though, just unused right now.
The Following User Says Thank You to ShadowEO For This Useful Post: [ View ] Gift ShadowEO Ad-Free
21st June 2016, 09:48 PM |#7  
Member
Thanks Meter: 10
 
More
Quote:
Originally Posted by ShadowEO

This kernel is ONLY for the Nexus 7 (2013) flo. I do not know if it boots on the deb, theoretically it should as I don't have any flo specific options and there are config options for Deb in the Kernel configuration.

Jup, it does boot on my deb! I've downloaded the .img, put the tablet in bootloader mode and did
fastboot boot TonoKrnl-1.0.2-flo.img

It booted without problems, and so far it's running for about half an hour or so without any problems. Wifi, sound, video, usb mouse, all work fine.
Attached Thumbnails
Click image for larger version

Name:	tono.png
Views:	68
Size:	249.5 KB
ID:	3790676  
The Following User Says Thank You to doniks For This Useful Post: [ View ] Gift doniks Ad-Free
22nd June 2016, 12:54 AM |#8  
OP Senior Member
Flag Columbus, Ohio
Thanks Meter: 129
 
More
Quote:
Originally Posted by doniks

Jup, it does boot on my deb! I've downloaded the .img, put the tablet in bootloader mode and did
fastboot boot TonoKrnl-1.0.2-flo.img

It booted without problems, and so far it's running for about half an hour or so without any problems. Wifi, sound, video, usb mouse, all work fine.


Wow, that's great to hear, I wasn't sure but I was definitely curious since I had seen options for both Deb and Flo in the makeconfig page.

If you can script it in (or edit sysfs.conf) to have it write a 1 to /sys/android_touch/doubletap2wake while it's booting, you can have working DT2W and there's quite some others to mess around with under /sys :3 CPU governors are somewhere there too, just don't have it offhand.

Since you are testing it out, have you noticed any changes in the device's normal battery life? The stock kernel seems to drain 1% every 1 1/2 minutes on my Flo, not doubting that the power optimizations ARE working (I know I'm getting much better life), I'm just wanting to ensure that it's not a placebo effect that I'm experiencing.
22nd June 2016, 08:51 PM |#9  
Member
Thanks Meter: 10
 
More
Quote:
Originally Posted by ShadowEO

If you can script it in (or edit sysfs.conf) to have it write a 1 to /sys/android_touch/doubletap2wake while it's booting, you can have working DT2W

After
Code:
echo 1 | sudo tee /sys/android_touch/doubletap2wake
I can indeed (sometimes) wake it with double tapping. I have since quite a while (with the standard kernel) the situation that its really hard to wake up. I have to press the powerbutton many many times. Feels like it is sleeping really deeply.

Quote:

Since you are testing it out, have you noticed any changes in the device's normal battery life? The stock kernel seems to drain 1% every 1 1/2 minutes on my Flo, not doubting that the power optimizations ARE working (I know I'm getting much better life), I'm just wanting to ensure that it's not a placebo effect that I'm experiencing.

Well, I haven't noticed anything. I might just not be in the best position to judge. I rarely have it unplugged for more than a couple of hours at a time and I don't generally monitor the battery status closely. That being said though, I have very definitely never experienced anything remotely close to 1% per 1.5 min!

If you have a particular test/measurement you'd like to see - let me know.
22nd June 2016, 09:05 PM |#10  
OP Senior Member
Flag Columbus, Ohio
Thanks Meter: 129
 
More
Quote:
Originally Posted by doniks

After

Code:
echo 1 | sudo tee /sys/android_touch/doubletap2wake
I can indeed (sometimes) wake it with double tapping. I have since quite a while (with the standard kernel) the situation that its really hard to wake up. I have to press the powerbutton many many times. Feels like it is sleeping really deeply.



Well, I haven't noticed anything. I might just not be in the best position to judge. I rarely have it unplugged for more than a couple of hours at a time and I don't generally monitor the battery status closely. That being said though, I have very definitely never experienced anything remotely close to 1% per 1.5 min!

If you have a particular test/measurement you'd like to see - let me know.

I may be exaggerating slightly, but normally my tablet goes from 100% to 95% in about 5 minutes while I'm using it after taking it off the charger (in Ubuntu only, may be an rc-proposed thing too). I haven't seen that behavior since changing kernels. I'm gonna see if I can go ahead and start reverting commits today or possibly reset back to the last known good commit.

As for the screen problems, I think there is a bug in the current doubletap2wake driver, if you look at dmesg after using DT2W for a while, you'll see it being spammed with error messages from the touchscreen driver.

That could possibly be related. Additionally, I think the minimum processor speed defaulted to 384MHz (I didn't touch any processor clock speeds in here) which the Performance governor would never had let the processor hit. So it's likely that the minimum processor speed will need bumped up at least one step there, I get some stuttery behavior on the command line when the screen is off which I hadn't received on the stock kernel.

Edit (07/01/16): I'm not sure what else I can really bring to the table here, mpdecision running in the android LXC container defeats any meaningful changes to the clock speed. I also noticed mention that you shouldn't have two hotplugging daemons running at the same time, effectively that is what the new developments would've brought in. I think my best option to continue this would be to wait until the Xenial transition and see if they make any changes for me to update on.

I'm also quite a novice, so besides cherry picking commits, I'm not sure what else I can do.
3rd September 2016, 11:29 AM |#11  
Member
Thanks Meter: 10
 
More
ShadowEO, is bluetooth working on your device? With your kernel or with the one from Canonical?

I can't seem to get anything at all to show up on my deb.
Post Reply Subscribe to Thread

Tags
custom ubuntu touch kernel, nexus 7 2013, ubuntu kernel, ubuntu touch

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes