[MTK] How to enable kernel dynamic debug log?

文摘 无标签 2022-06-22 阅读:6176

[DESCRIPTION]

 在kernel module debug 对照代码的时候,发现使用pr_debug 打印的log 无法找到,怎样在mobilelog 和uart log中开启pr_debug ?

[SOLUTION]

 1 打开dynamic debug feature

    <project>_defconfig 中设置CONFIG_DYNAMIC_DEBUG=y (default 打开)

 2 打开pr_debug log 输出

     enable:echo "<match-spec> +p" > <debugfs>/dynamic_debug/control

    disable:echo "<match-spec> -p" > <debugfs>/dynamic_debug/control

    <match-spec>: file <path>

                          line line-range

  module <module_name>

  func <func-name>  

    eg:enable the message at line 1603 of file svcsock.c

             echo -n "file svcsock.c line 1603 +p" > /sys/kernel/debug/dynamic_debug/control

    eg:enable all the messages in the NFS server module

            echo -n "module nfsd +p" > /sys/kernel/debug/dynamic_debug/control

 3 mobile log 中 pr_debug log

     pr_debug 默认以debug 等级输出到kernel log 中, mobilelog 抓到的kernellog 会包含

 4 uartlog 中 pr_debug log

     默认pr_debug log 不送uart ,可以通过以下方式打开:

         1.adb起来后,echo 8 > /proc/sys/kernel/printk
         2.改code ,修改console 默认输出log等级

               kernel-3.18/include/linux/printk.h : #define CONSOLE_LOGLEVEL_DEFAULT 7 --> #define CONSOLE_LOGLEVEL_DEFAULT 8

0条评论

© 2024 芯缘异码. Powered by Typecho