To configure the Linux kernel with kprobes support, you need to:
- Define the CONFIG_KPROBES configuration variable.
- Define CONFIG_MODULES and CONFIG_MODULE_UNLOAD so that modules can be used to register probes.
- Define CONFIG_KALLSYMS and CONFIG_KALLSYMS_ALL so that kernel symbols can be looked up.
- Optionally, define the CONFIG_DEBUG_INFO configuration variable so that probes can be inserted in the middle of functions as offsets from the entry point. To find the insertion point, you can use objdump, as seen in the following excerpt for the do_sys_open function:
$ arm-poky-linux-gnueabi-objdump -d -l vmlinux | grep do_sys_open
8010bfa8 <do_sys_open>:
do_sys_open():
8010c034: 0a000036 beq 8010c114 <do_sys_open+0x16c> 8010c044: ...