Kprobes for Google Nexus 4, 5, 7, …

Would you like to run your Android kernel with kprobes? I prepared boot images—at least for the Nexus devices I own(ed)—that let you do so:

Device Version Build Boot image (with kprobes kernel)
Nexus S 2.3.6 GRK39F [Download]
Nexus 4 4.4.2 KOT49H [Download]
Nexus 5 5.0.1 LRX22C [Download]
Nexus 7 4.3 JWR66Y [Download]
Goldfish Emulator   [Download]

I will probably add more boot images in the future. However, if your device (and Android version) isn’t listed (yet) in the table above, you can still build your own (which is not too difficult), following my detailed recipe.

How-To: Build a Custom Kernel With Kprobes for Android

Before you continue reading, you might want to check whether the kernel on your device already supports kprobes (even though I haven’t seen any stock or popular custom kernel, such as franco.Kernel, which does):

$ adb shell cat /proc/kallsyms | grep register_kprobe

If you receive some output (e.g., 00000000 T register_kprobe), then the answer is yes, your kernel has kprobes enabled; and there is no need to read any further.

Building kernel with kprobes (and boot image) for Nexus 5, Android 5.1.1

I tested the following recipe on Ubuntu 14.04. It should work in a very similar way also for any other (Nexus) device and Android version–assuming you have access to the right kernel sources.