Linux内核log等级与printk打印消息控制

参考文章:http://blog.csdn.net/zifehng/article/details/60763837

预定义的内核log等级

// include/linux/kern_levels.h

#define KERN_SOH    "\001"      /* ASCII Start Of Header */
#define KERN_SOH_ASCII  '\001'

#define KERN_EMERG  KERN_SOH "0"    /* system is unusable */
#define KERN_ALERT  KERN_SOH "1"    /* action must be taken immediately */
#define KERN_CRIT   KERN_SOH "2"    /* critical conditions */
#define KERN_ERR    KERN_SOH "3"    /* error conditions */
#define KERN_WARNING    KERN_SOH "4"    /* warning conditions */
#define KERN_NOTICE KERN_SOH "5"    /* normal but significant condition */
#define KERN_INFO   KERN_SOH "6"    /* informational */
#define KERN_DEBUG  KERN_SOH "7"    /* debug-level messages */

#define KERN_DEFAULT    KERN_SOH "d"    /* the default kernel loglevel */

上面的内容都可以在code里面找到,我偷懒就直接转载了。感谢源博主。

在我们的Android wear(MSM8909W)项目中默认开机之后变为 6 6 1 7

修改的位置在init rc里面:

common-8x09/common/rootdir/etc/init.qcom.rc

    # Set the console loglevel to < KERN_INFO
    # Set the default message loglevel to KERN_INFO
    write /proc/sys/kernel/printk "6 6 1 7"

如果开启console log,最好是echo 8  > /proc/sys/kernel/printk

MSM平台开启console log的config配置为:

CONFIG_SERIAL_MSM_HSL=y
CONFIG_SERIAL_MSM_HSL_CONSOLE=y

其他的在dts里面配置。

猜你喜欢

转载自blog.csdn.net/wuming_422103632/article/details/79281797