[U-Boot] [PATCH 01/33] log: Add a Kconfig option to set the default log level

Simon Glass sjg at chromium.org
Tue Jan 22 01:12:38 UTC 2019


At present the default log level is set to LOGL_INFO on start-up. Allow
this to be controlled from Kconfig.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/Kconfig | 9 +++++++++
 common/log.c   | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index 0a14bdedaa..2ee48e4a2a 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -527,6 +527,15 @@ config TPL_LOG_MAX_LEVEL
 	    6 - detail
 	    7 - debug
 
+config LOG_DEFAULT_LEVEL
+	int "Default logging level to display"
+	default 5
+	help
+	  This is the default logging level set when U-Boot starts. It can
+	  be adjusted later using the 'log level' command. Note that setting
+	  this to a value abnove LOG_MAX_LEVEL will be ineffective, since the
+	  higher levels are not compiled in to U-Boot.
+
 config LOG_CONSOLE
 	bool "Allow log output to the console"
 	depends on LOG
diff --git a/common/log.c b/common/log.c
index ec14644516..ffb3cd6933 100644
--- a/common/log.c
+++ b/common/log.c
@@ -316,7 +316,7 @@ int log_init(void)
 	}
 	gd->flags |= GD_FLG_LOG_READY;
 	if (!gd->default_log_level)
-		gd->default_log_level = LOGL_INFO;
+		gd->default_log_level = CONFIG_LOG_DEFAULT_LEVEL;
 	gd->log_fmt = LOGF_DEFAULT;
 
 	return 0;
-- 
2.20.1.321.g9e740568ce-goog



More information about the U-Boot mailing list