Using printk debug
There three method
1. KERN_EMERG to KERN_DEBUG
- pr_energe to pr_debug
2. Change the kernel command line
- loglevel = parameter
We can refer Kernel/doc/kernel-parameters.txt
3. Change the printk level after bootup
- /proc/sys/kernel/printk
ex: echo 8 > /proc/sys/kernel/printk
Then read /proc/kmsg
- /proc/sysrq-trigger
You can modify the #DEFAULT_CONSOLE_LOGLEVEL 8
at kernel/prink source code
There are prink tips andd tricks
1. CONFIG_PRINTK_TIME
2. CONFIG_EARLY_PRINTK
- CONFIG_DEBUG_LL and added some patch
3. CONFIG_LOG_BUF_SHIFT
- you can use the dmesg to change the printk buffer
"dmesg -s 128000" this mean we open 128k buffer
You can open the kernel configuration with #make menuconfig
kernel hacking --> <> show timming information as printks
<> debug filesystem
<> kernel low-level debugging function
There are two topic need to study
- debug system
debug system at /sys/kernel/debug
You can mount it by mount -t debugfs none /sys/kernel/debug
Or write it in /etc/fstab
debugfs /sys/kernel/debug debugfs 0 0
- dynamic debug
- CONFIG_DYNAMIC_DEBUG
- Operate on pr_debug or dev_dbg
沒有留言:
張貼留言