如何打開linux內核中dev_dbg的開關


比如要打開某個驅動中的dev_dbg,那么需要在驅動文件.c中這些行"<linux/device.h>"或者"<linux /platfom_device.h>"(device.h包含platform_device.h)之前定義DEBUG

如:drivers/mtd/spi-nor/spi-nor.c

第一步:

#include <linux/module.h>
 #define DEBUG 1   新增的內容,最好是將此宏定義添加在所有頭文件前面,以防漏掉DEBUG的定義
#include <linux/device.h>
 #include <linux/mutex.h>

第二步:

在make menuconfig配置CONFIG_CONSOLE_LOGLEVEL_DEFAULT這個選項的值為8

Location:

  -> Kernel hacking

    -> printk and dmesg options 

注意內核版本為4.14


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM