[U-Boot] [PATCH 13/16] New config variable CONFIG_PREMONITOR

Pali Rohár
2011-12-17T17:03:15Z

* if defined run env "premonitor" before Main Loop for Monitor Command Processing

Signed-off-by: Pali Roh?r <pali.rohar@gmail.com>
---
common/env_common.c | 3 +++
common/main.c | 10 ++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/common/env_common.c b/common/env_common.c
index 8a71096..1ef8ecc 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -92,6 +92,9 @@ const uchar default_environment[] = {
#ifdef CONFIG_PREBOOT
"preboot=" CONFIG_PREBOOT "\0"
#endif
+#ifdef CONFIG_PREMONITOR
+ "premonitor=" CONFIG_PREMONITOR "\0"
+#endif
#ifdef CONFIG_ROOTPATH
"rootpath=" CONFIG_ROOTPATH "\0"
#endif
diff --git a/common/main.c b/common/main.c
index fc80317..3dd9fc7 100644
--- a/common/main.c
+++ b/common/main.c
@@ -425,6 +425,16 @@ void main_loop (void)
}
#endif

+#ifdef CONFIG_PREMONITOR
+ if ((s = getenv ("premonitor")) != NULL) {
+# ifndef CONFIG_SYS_HUSH_PARSER
+ run_command (s, 0);
+# else
+ parse_string_outer(s, FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
+# endif
+ }
+#endif /* CONFIG_PREMONITOR */
+
/*
* Main Loop for Monitor Command Processing
*/
--
1.7.5.4