linux kernel modify printk buf size

linux kernel modify printk buf size

linux内核配置log缓存大小



configure CONFIG_LOG_BUF_SHIFT



modify code:

wyk@ubuntu:~/soc/linux$ git diff kernel/printk/printk.c
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fd337bf9b..aaa98a8eb 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -456,7 +456,8 @@ static u32 clear_idx;
 
 /* record buffer */
 #define LOG_ALIGN __alignof__(struct printk_log)
-#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
+/*#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)*/
+#define __LOG_BUF_LEN (1 << 23)
 #define LOG_BUF_LEN_MAX (u32)(1 << 31)
 static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
 static char *log_buf = __log_buf;
wyk@ubuntu:~/soc/linux$ 


1 << CONFIG_LOG_BUF_SHIFT

1 << 18,: 256KB

1 << 19,: 512KB

1 << 20,: 1MB

1 << 21,: 2MB

1 << 22,: 4MB

1 << 23,: 8MB



posted @ 2023-12-14 18:09  王阳开  阅读(28)  评论(0编辑  收藏  举报