Tuesday, 26 June 2012

Stable Nexus S kernel release 3.0.36-14

So, another stable release. A few updates, a new base for the kernel and of course merged up to the latest mainline stable release. It should be faster and more stable, but there is nothing mind blowing here, except perhaps the addition of Voodoo sound by popular demand.

I spent lots of time benchmarking toolchains and kernel sources, and I’ve settled on the one which appears to be the fastest and most stable.

I also built non-essential drivers as modules so they aren’t in the zImage. This has the advantage of code not being loaded for features which aren’t being used by the majority of users. This has the other advantage that if users request a particular driver/filesystem/etc, I can easily add it as a module without affecting users who aren’t using it. Unfortunately, modprobe is broken as it looks for the modules in the wrong place, so you will need to load the modules with insmod, and they are located in /system/lib/modules

Wifi will also work now if installed on a CM based ROM, as they moved the module and broke compatibility with stock.


  • Third stable release, slightly different base this time. The kernel is based on AOSP common (3.0.31) with the AOSP Samsung kernel (3.0.8) patches applied on top. It has then been merged to 3.0.36 from mainline.
  • Voodoo sound v10 patches applied.
  • Wifi will now work if installed with a CM based ROM.
  • Moved cifs and utf8 from the zImage into /system/lib/modules
  • Various compiler warnings and section mismatches fixed
  • Disabled a stack of debug options resulting in a slightly faster kernel
  • Compiled with a FSF GCC 4.6.3 toolchain built with crosstool-ng – .config here for interested people.


  • Deadline I/O scheduler adjusted for flash for lowest I/O latencies
  • Ondemand governor adjusted to sample less at higher frequencies to reduce overhead
  • Config: As stock AOSP with the following modifications: Deadline I/O scheduler, Ondemand CPU governor, Tiny Preempt RCU, Voodoo sound
  • Additional modules provided: CIFS, utf8
  • PM fast for wifi


Available here.


Dismissed ideas:

If something appears on here, the answer is no, so please don’t ask for it again.

  • Interactive CPU governor – no improvement in responsiveness, but much more expensive in terms of CPU usage
  • Conservative GPU governor – worse responsiveness, higher latency, slower race to idle so in theory could result in higher power usage depending on usage model. Perhaps it is useful on older hardware, but it’s not particularly useful on our phones
  • Any other CPU governor – lets just cut to the chase, ondemand is the best and cheapest one I have tried. It also doesn’t involve maintaining non-mainline code, it is the one I like, it’s tried, tested, stable, works extremely well and is mainlined, unlike governor X, Y & Z
  • Linaro GCC – Surprisingly enough, Linaro GCC actually produces a slightly worse performing kernel than FSF GCC
  • CFLAG (compiler) optimisations – Tested various optimisations with various toolchains, none made any measurable improvement, some made the kernel perform slightly worse
  • Overclock – I did consider implementing some overclock, basically to improve the boot time more than anything else. After trying it, it made no significant difference so I decided it wasn’t worth the possible instability it could bring. Unfortunately, the hummingbird apps processor is still gutless, even with overclock
  • Voodoo colour – I considered this, but I don’t believe it adds value to the kernel. It’s not a necessary feature and there are plenty of kernels with this. As regards colours, I also tested reverting the change which was brought about in 2.3.3, but it left the screen with a blue tinge so backed it out again
  • BLN – it’s very hackish and totally unnecessary and certainly does not add any value to the kernel. Again, there are plenty of other kernels with this awful feature
  • Deep Idle – I’m not convinced that it is stable enough. It wasn’t implemented by Samsung/Google for some reason or other, lets just leave it at that

Sunday, 24 June 2012

Test Nexus S kernel release 3.0.36-13

Changelog (as –12 with the following changes):

  • Wifi will now work if installed with a CM based ROM (funky symlinking magic in the updater-script.
  • Moved cifs and utf8 from the zImage into /system/lib/modules – if you need these modules you will need to load them with insmod /system/lib/modules/cifs.ko etc (unfortunately modprobe doesn’t work correctly as it looks for modules in /lib instead of /system/lib). But CifsManager will do that automatically for you.

Known issues:

  • None

Tested and dismissed for this release:

  • Tested interactive CPU governor again, didn’t notice any difference with responsiveness of the device, but found that it was quite expensive in terms of CPU cycles, *much* more so than ondemand. I will stick with ondemand.
  • Tested change of colour temperature for Super AMOLED devices. Going to pre 2.3.3 colours made the whites very cold and blueish and the colours weren’t right at all so backed out of that change.
  • No, I’m not adding BLN. :p

Available here.

Saturday, 23 June 2012

Test Nexus S kernel release 3.0.36-12

So, I made a few decisions to make a few changes in the way I was developing the kernel:

Firstly, I have changed the versioning. The kernel version will be the additional digits at the end from now on. This will be incremented every time I make a release. I didn’t want to start at 1, so I counted up the number of releases so far, added a couple for good measure and started at that number. I will also be tagging the git repo before every release, test also as I will need to rebase more often due to the next decision I have made. The zip filenames will also change and will be based on the git describe output.

Secondly, I have decided to completely change the kernel base. Instead of using the (basically abandoned) AOSP Samsung S5PC110 kernel as a base and merging mainline stable updates into that, I have rebased it against AOSP common 3.0, which will bring in the improvements the Android team has made recently. It also brings the added benefit that there is much less mainline code to merge, as the common repo is much closer to current mainline. This should also make the kernel more stable and result in less fuckage, of which there has been more than enough lately.

Thirdly, I dumped the compiler optimisations which I applied last time, they really don’t make any measurable difference.

Fourthly, for the next stable release, I plan to build as modules any drivers / filesystems etc that are not essential to Android so they can be loaded as required. I will place them in such a place that modprobe will work correctly to load them without having to mess about with insmod. It seems somewhat counter intuitive to have a load of stuff built in to the image that not many people use, and it could theoretically be harming performance. The leaner the better eh?


  • Rebased against AOSP common and merged up to 3.0.36 from mainline
  • Dumped compiler optimisations
  • Voodoo Sound v10 is still here, don’t worry :p
  • Same Newlib based bare metal toolchain as previous release

Known issues:

  • None currently

Available here.

Sunday, 10 June 2012

Experimental Nexus S Kernel (3.0.34_r1) release


As 3.0.29_r1 stable with the following changes:

  • Voodoo Sound v10
  • Merged to 3.0.34 from kernel.org
  • Compiled using a Newlib based bare metal GCC 4.6.3 toolchain, config here if anyone interested.
  • Some experimental compiler optimisations applied to Makefile: KBUILD_CFLAGS which increase benchmarked performance: -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block.
  • Optimised vfp code compilation: KBUILD_AFLAGS -mfpu=neon
  • Optimised PVR code compilation: -O2 instead of -Os

    Known issues:

    • None

    Available here.