比如要打開某個驅動中的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