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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2,240 Views
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

Labels (3)
0 Kudos
Reply
2 Replies

1,829 Views
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 Kudos
Reply

1,829 Views
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 Kudos
Reply