Simple overclocked Android kernel for Optimus S

If you’re looking to give your Sprint Optimus S a speed boost, I’ve got a kernel for you, compiled from official LG source code, that adds overclocking and removes unneeded debugging features for a leaner, meaner kernel.

The basic idea behind this kernel build is “stable performance” — other devs are doing a great job backporting the latest features from the mainline Android kernel and writing experimental patches. My goal is a lot less ambitious, but also less bleeding-edge: Build a kernel from official source, one that “just works” for me the user, but boost performance to get the most from the hardware.

I’ve also included the Linux TUN/TAP driver as a module, so that (among other things) you can use OpenVPN with your Optimus, if you like. Need some other module? Ask!


  • Uses current ( Linux kernel for Optimus S with VD baseband) LG source code for simplicity and maximum compatibility. See “design goals,” below.
  • CPU frequency scaling beyond 600 MHz (i.e. overclocking). By default, I’ve upped the maximum clock speed to 748 MHz, but you can enable higher speeds (and test them) using trusty SetCPU. At 748 MHz, SetCPU benchmarks run 20% faster.
  • Adds the new “interactive” CPU frequency scaling governor for a more responsive UI. (The easiest way to use it by default is to have SetCPU select it on boot … or you can edit in your boot.img ramdisk.)
  • Removed a lot of unneeded debugging/development features, such as Ethernet, kernel debugging, debugfs etc. The end result is a kernel that’s 380K smaller than LG’s (2.2M vs. 2.6M).
  • Minor performance tweaks (removed highmem etc.).
  • tun.ko compiled as a module, since I use it for OpenVPN. Version 07 adds Linux ext2/ext3/ext4 filesystem drivers as modules. Future releases can include additional drivers as modules, if there’s interest.

Get it

I’ve been running variants of this kernel for a couple of weeks, and it works for me (so far), but if you choose to install it, the standard disclaimers apply: No warranties expressed or implied, it’s your responsibility to understand exactly what you’re doing, so if you kill your phone I assume no responsibility.

Requirements: To start with, you’ll need to have rooted your phone and installed a custom recovery. The kernel is compiled from LG’s LS670ZVD kernel source, so be sure your phone is updated to the VD baseband. I’ve used koush’s AnyKernel template to package the .zip, so you should be able to flash this kernel over top of the stock LG OS or any custom ROM.

So, if you understood all of that, the rest should be easy. Download picasticks kernel, copy it to /sdcard/, reboot your phone to your custom recovery, and flash the .zip. Reboot and enjoy!

Design goals

Over the years I’ve built many, many Linux kernels, but I’m new to the Android kernel. I started because I wanted to compile essentially a stock kernel, and add TUN/TAP support. Then, I found that LG’s developers had left behind unnecessary debugging and debug hardware support (i.e. Ethernet and serial consoles via USB) worth taking out. (Housecleaning is the inevitable result of “make menuconfig.”) Next, I decided to enable overclocking past 600 MHz, since it had worked fine for me with various versions of ThundeROM and the Xionia kernel that supported it. Finally, I added the interactive CPU frequency scaling mode.

That leaves us with the following project principles:

  • Build from the most current official LG source. Reliability and stability are the goals — I’ve had this phone for four months, and LG has updated the OS in three of them, so I don’t want to get into the maintenance nightmare that constantly remerging the latest upstream Android source would entail (for now). If you want to flash a new kernel every week, mine’s not for you, because I may not release again until LG does. So, I give up things like the BFQ scheduler (no biggie, Deadline is faster on Android) and interactive scaling (this one I miss, but ondemand is OK) (Update: interactive scaling backported!). Likewise, in my kernel configuration I’m trying to only deviate from the LG config when it’s an obvious win. Another part of reliability and stability is, don’t expect me to push a new release the same day LG publishes updated source — it’ll be more like a week (you know, for testing). Think of me as somewhere in between Gentoo and Debian-stable.
  • Keep it small. Faster is better. That doesn’t mean I’ll be dumping SLAB for SLOB just to get a small binary, but my assumption is that you don’t need debugfs, or you’d be compiling your own kernel. I’m happy to add things as modules, so if you want CIFS or something to stream music off your LAN, let me know, but in general the simpler the better. (Personally, I want to get bluetooth HID, i.e. Apple bluetooth keyboard, working, but the userland part scares me, so I may have to give up my dream of typing 120 wpm in WordPerfect 5.1 on my phone, and go back to Angry Birds.)
  • Overclocking, since it seems to work well and my phone is pretty new, so I’ll be stuck with it for a while, but it isn’t exactly a screamer.

Credits and source

Many thanks to the Android hackers and developers who have come before me, for making my learning curve much easier.

Full credit on overclocking goes to zefie. My patch to arch/arm/mach-msm/acpuclock.c is 99% cribbed from his changes to the LG V9 source.

Credit to Mike Chan (who’s since left Google) for backporting the interactive CPUFreq governor.

Thanks to LG for not just publishing source code (GPL requirement) but also including docs and a build script. Unlike another phone OEM with a patent-encumbered fruit for a logo, LG you give me a happy feeling, and it is not just from your smiley logo. You could have published your readme in Korean (which would not have worked, I live in a Korean neighborhood!), but you chose not to.

For my source code release, I’m not going to publish a giant tarball (yet) since it’s 100% LG source + the aforementioned patches to enable overclocking and the interactive governor. Therefore, to duplicate my build source:

  1. LG source code is here (search for “LS670” to get Optimus S source).
  2. Apply this patch to the kernel tree, i.e.: cd lg_kernel && patch -p1 < kernel.diff

And, in case you’re interested, here are my changes to the LG kernel configuration .config.


07 released 2011-04-18
Adds Linux ext2/ext3/ext4 filesystem drivers as modules.
06 released 2011-04-08
Code/config identical to 05. Recompiled with CodeSourcery toolchain including gcc 4.5.1. Improved DEFLATE compression using 7zip algorithm.
05 released 2011-04-03
Reverts RCU method to tree-based from preempt tree-based to fix lag issues with memory locking, for instance when network interfaces are brought up or down. Other minor regressions in kernel config.
04 released 2011-03-31
Initial public release using LG VD source.

Filed under: Code.  Tagged: , , , .