[PATCH] console: add new CONSOLE_FULL_BUFFERSIZE option

Marco Felsch m.felsch at pengutronix.de
Wed Jul 6 06:26:37 PDT 2022


Make the early printk buffer size adjustable since I noticed truncated
log buffers if I enable DEBUG_INITCALLS and DEBUG_PROBES.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 common/Kconfig   | 15 +++++++++++++++
 common/console.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index f7a6a96e87..365fef872f 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -761,6 +761,21 @@ config CONSOLE_NONE
 
 endchoice
 
+if CONSOLE_FULL
+
+config CONSOLE_FULL_BUFFERSIZE
+	int
+	prompt "Console buffer size in Bytes"
+	default 1024
+	help
+	  Size Bytes of the early console buffer. This buffer is used
+	  before malloc is intialized. In rare cases the buffer is to
+	  small to hold all early messages e.g. if DEBUG_INITCALLS and
+	  DEBUG_PROBES are enabled. In such cases you can adapt the size
+	  by the option, if unsure don't change it.
+
+endif
+
 choice
 	prompt "Console activation strategy"
 	depends on CONSOLE_FULL
diff --git a/common/console.c b/common/console.c
index 8727b187cf..6c3c1f2b3c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(console_list);
 
 static int initialized = 0;
 
-#define CONSOLE_BUFFER_SIZE	1024
+#define CONSOLE_BUFFER_SIZE	CONFIG_CONSOLE_FULL_BUFFERSIZE
 
 static char console_input_buffer[CONSOLE_BUFFER_SIZE];
 static char console_output_buffer[CONSOLE_BUFFER_SIZE];
-- 
2.30.2




More information about the barebox mailing list