参考:

https://www.cnblogs.com/sky-heaven/p/6742062.html
韦东山老师的printk讲解:https://blog.csdn.net/W1107101310/article/details/80526039

1.平台内核启动参数:
bootargs = "console=ttySC0,115200n8 rw root=/dev/mmcblk0p3 rootwait ignore_loglevel vt.global_cursor_default=0"

ignore_loglevel:printk.c中即作为启动参数也作为模块参数,指定了它:ignore loglevel setting (prints all kernel messages to the console)"
只有suppress_message_printing()使用了它,拿它做判断

2. 4.14.35内核printk()的调用路径:

printk
vprintk_fun
vprintk_emit 调用local_irq_save(flags)并获取spin_lock!
console_unlock() 关闭本地中断调用call_console_drivers
call_console_drivers()
sc-shi.c中注册的console_write()

suppress_message_printing()  里面检测了printk()的打印等级,决定哪些等级打印,哪些等级不打印,到那时配置了一个命令行参数使其恒为假

TODO:确认一下cmdline中的ignore_loglevel生效了没有!

平台上配置的是128K的log_buf
#define CONFIG_LOG_BUF_SHIFT 17 /*1<<17=128K*/
static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); /*128k,以struct printk_log大小对其*/

05-11 15:25