今天终于将dev_dbg信息输出了,为了以后方便查找,特记录下来:
1、修改缺省信息的宏定义级别(kernel_imx/kernel/printk.c文件内):
//#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
将值改为8
#define DEFAULT_CONSOLE_LOGLEVEL 8 /* anything MORE serious than KERN_DEBUG */
该行表示只有打印级别高于DEFAULT_CONSOLE_LOGLEVEL(值小于DEFAULT_CONSOLE_LOGLEVEL的值)的打印才会出现在终端上。
而 KERN_DEBUG也为7,所以我们的调试不会直接打印出来
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
#define KERN_ERR "<3>" /* error conditions
*/
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages
*/
2、在要输出dev_dbg信息的*.c文件的最前面添加:
#define DEBUG
因为dev_dbg的宏定义在kernel_imx/include/linux/device.h,而这文件通常被其它文件引用,在本BSP内被
kernel_imx/include/linux/platform_device.h引用,因此必须在引用这头文件之前定义DEBUG。