开发者

How can I change the size of dmesg ? [linux 2.4]

I'm writing some code with printk [i'm printing while in kernel mode] , but because dmesg is too small I'm losing the first few printk's.

How can I increase the size of dmesg ?

thanks in advance for the help!开发者_运维技巧


You need to set CONFIG_LOG_BUF_SHIFT during compile time. The size of the buffer can not be modified in run time.

The size of the buffer is 2^CONFIG_LOG_BUF_SHIFT bytes


You can use the log_buf_len kernel parameter at boot time to set the kernel's printk() ring buffer size.

See: https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt

(You mentioned Linux 2.4; I don't know whether log_buf_len was present in Linux 2.4, which is very old.)


Printk is implemented by using a ring buffer in the kernel with a size of __LOG_BUF_LEN bytes where __LOG_BUF_LEN equals (1 << CONFIG_LOG_BUF_SHIFT) (see kernel/printk.c for details).

You can specify the size of the buffer in your kernel config by setting CONFIG_LOG_BUF_SHIFT to an appropriate value (e.g. 17 for 128Kb) (make menuconfig -> General Setup -> Kernel log buffer size).

Reference:https://elinux.org/Debugging_by_printing

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜