diff mbox

[U-Boot,3/3] common, menu: show menu on startup if CONFIG_MENU_SHOW is defined

Message ID 1326614022-24014-4-git-send-email-hs@denx.de
State Superseded
Headers show

Commit Message

Heiko Schocher Jan. 15, 2012, 7:53 a.m. UTC
show a menu on startup instead running the shell.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Jason Hobbs <jason.hobbs@calxeda.com>
---
 common/main.c   |    4 ++++
 doc/README.menu |    5 +++++
 include/menu.h  |    3 +++
 3 files changed, 12 insertions(+), 0 deletions(-)

Comments

Mike Frysinger Jan. 15, 2012, 5:38 p.m. UTC | #1
On Sunday 15 January 2012 02:53:42 Heiko Schocher wrote:
> --- a/common/main.c
> +++ b/common/main.c
> 
> +#if defined(CONFIG_MENU_SHOW)
> +	bootdelay = menu_show();
> +#endif

should the current bootdelay get passed in ?
-mike
Heiko Schocher Jan. 16, 2012, 6:55 a.m. UTC | #2
Hello Mike,

Mike Frysinger wrote:
> On Sunday 15 January 2012 02:53:42 Heiko Schocher wrote:
>> --- a/common/main.c
>> +++ b/common/main.c
>>
>> +#if defined(CONFIG_MENU_SHOW)
>> +	bootdelay = menu_show();
>> +#endif
> 
> should the current bootdelay get passed in ?

Yep, fixed.

bye,
Heiko
diff mbox

Patch

diff --git a/common/main.c b/common/main.c
index 08070f3..2199ae7 100644
--- a/common/main.c
+++ b/common/main.c
@@ -41,6 +41,7 @@ 
 
 #include <post.h>
 #include <linux/ctype.h>
+#include <menu.h>
 
 #if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) || defined(CONFIG_CMDLINE_EDITING)
 DECLARE_GLOBAL_DATA_PTR;
@@ -372,6 +373,9 @@  void main_loop (void)
 
 	debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
+#if defined(CONFIG_MENU_SHOW)
+	bootdelay = menu_show();
+#endif
 # ifdef CONFIG_BOOT_RETRY_TIME
 	init_cmd_timeout ();
 # endif	/* CONFIG_BOOT_RETRY_TIME */
diff --git a/doc/README.menu b/doc/README.menu
index 0dad6a2..ba7dcad 100644
--- a/doc/README.menu
+++ b/doc/README.menu
@@ -25,6 +25,11 @@  the interfaces should be available.
 Menus are composed of items. Each item has a key used to identify it in
 the menu, and an opaque pointer to data controlled by the consumer.
 
+If you want to show a menu, instead starting the shell, define
+CONFIG_MENU_SHOW. You have to code the int menu_show(void) function,
+which handle your menu. This function returns the remaining
+bootdelay.
+
 Interfaces
 ----------
 #include "menu.h"
diff --git a/include/menu.h b/include/menu.h
index cf14a9c..4cda33d 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -27,4 +27,7 @@  int menu_get_choice(struct menu *m, void **choice);
 int menu_item_add(struct menu *m, char *item_key, void *item_data);
 int menu_destroy(struct menu *m);
 
+#if defined(CONFIG_MENU_SHOW)
+int menu_show(void);
+#endif
 #endif /* __MENU_H__ */