How to flush serial buffer (pr_notice/printk) in the early kernel initialization stage

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to flush serial buffer (pr_notice/printk) in the early kernel initialization stage

3,372 次查看
davidzhou
Contributor V

Hi,

In the early stage of kernel initialization, I am using pr_notice (also printk( KERN_ALERT, etc.). When there is a udelay, for example udelay(5000), the printk messages are buffered. Can not find any way of flushing. I also tried console_unlock. It seems not working at all.

Is there any function all to flush printk immediately after the function call?

Thank you,

David Zhot

标签 (3)
0 项奖励
回复
2 回复数

2,961 次查看
b36401
NXP Employee
NXP Employee

Please try to perform fflush(NULL);

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

2,959 次查看
davidzhou
Contributor V

Hi Victor,

Thank you for your response.

I have tried fflush(NULL), and fflush(stdout). There is no include .h file that defines fflush(). Cannot include <linux/stdio.h>

: file not found

David

0 项奖励
回复