Recently I have installed Ubuntu 12.04 LTS ISO image in my desktop. Below is the output of the kernel version I have installed:
# uname -r
3.5.0-41-generic
I am trying to develop a VFS and want the kernel source code version '3.5.0-41-generic' for reference purpose - where can I find the same?
What are the excellent kernel debugging options looking at logs and mapping them to kernel code?
How and which debugger I can use to debug a live kernel flow execution?
Are there ways I can add more printk methods and re-modify the modules? Say I want to know how a FS mount method works - I can modify the required FS code (adding more printk functions) re-compile and reload the modules. Now with aid of my new printk functions I can understand the flow
apt
cmd:sudo apt-get install linux-source
This fetches the generic kernel source.
To fetch specific version use:
sudo apt-get source linux-image-6.11.8-generic
dmesg
cmd to view kernel logs.grep -r "log text" /path/to/source
).ftrace
, perf
, or systemtap
cmds for tracing execution paths. tracepoints
cmd.CONFIG_KGDB=y
and CONFIG_GDBSTUB=y
).gdb
using:
target remote /dev/ttyS0
bpftrace
.printk
and reloading modules:fs/super.c
.printk()
to inside functions of your targets (like mount
function).make modules
sudo insmod your_module.ko
dmesg
to watch new logs.Note: Live kernel debugging means inspecting and modifying the Linux kernel while it is actively running.