public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] common, menu: show menu on startup if CONFIG_MENU_SHOW is defined
Date: Sun, 15 Jan 2012 08:53:42 +0100	[thread overview]
Message-ID: <1326614022-24014-4-git-send-email-hs@denx.de> (raw)
In-Reply-To: <1326614022-24014-1-git-send-email-hs@denx.de>

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(-)

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__ */
-- 
1.7.7.4

  parent reply	other threads:[~2012-01-15  7:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15  7:53 [U-Boot] [PATCH 0/3] common, menu: enhancements Heiko Schocher
2012-01-15  7:53 ` [U-Boot] [PATCH 1/3] common: add possibility for readline_into_buffer timeout Heiko Schocher
2012-01-15 17:35   ` Mike Frysinger
2012-01-16  6:43     ` Heiko Schocher
2012-01-17  7:13   ` [U-Boot] [PATCH 1/3 v2] " Heiko Schocher
2012-01-17 19:14     ` Mike Frysinger
2012-02-17 21:33     ` Stephan Linz
2012-02-17 23:18       ` Mike Frysinger
2012-01-15  7:53 ` [U-Boot] [PATCH 2/3] common, menu: add statusline support Heiko Schocher
2012-01-15 17:36   ` Mike Frysinger
2012-01-16  6:54     ` Heiko Schocher
2012-01-17  7:13   ` [U-Boot] [PATCH 2/3 v2] " Heiko Schocher
2012-01-17 19:14     ` Mike Frysinger
2012-01-15  7:53 ` Heiko Schocher [this message]
2012-01-15 17:38   ` [U-Boot] [PATCH 3/3] common, menu: show menu on startup if CONFIG_MENU_SHOW is defined Mike Frysinger
2012-01-16  6:55     ` Heiko Schocher
2012-01-17  7:13   ` [U-Boot] [PATCH 3/3 v2] " Heiko Schocher
2012-01-17 12:55     ` Jason Hobbs
2012-01-18  6:05     ` [U-Boot] [PATCH 3/3 v3] " Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326614022-24014-4-git-send-email-hs@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox