[PATCH 3/4] yaboot menu user interface

Dustin Kirkland dustin.kirkland at us.ibm.com
Fri Mar 2 01:38:14 EST 2007


yaboot menu user interface

This patch allows for denoting a kernel label as a "boot-once" label
when printing the menu of labels.

The label flagged as default is marked with an asterisk (*).  If a label
matches the global bootoncelabel, I'm marking it with an ampersand (&).
I'm ambivalent about the symbol used here, or even if it is.  But I
found this bit useful when debugging and testing the functionality, and
it's trivial to add cleanly.  I chose ampersand because it's immediately
left of the asterisk on my keyboard.

Testing:
        Welcome to yaboot version 1.3.13
        Enter "help" to get some basic usage information
        boot:
        & linux                      autobench                * fallback
        

-- 
Signed-off-by: Dustin Kirkland <dustin.kirkland at us.ibm.com>



diff --git a/second/cfg.c b/second/cfg.c
index 3d08243..3c654ec 100644
--- a/second/cfg.c
+++ b/second/cfg.c
@@ -29,6 +29,7 @@
 /* Imported functions */
 extern int strcasecmp(const char *s1, const char *s2);
 extern int strncasecmp(const char *cs, const char *ct, size_t n);
+extern char bootoncelabel[1024];
 
 typedef enum {
      cft_strg, cft_flag, cft_end
@@ -492,10 +493,16 @@ static int printl_count = 0;
 static void printlabel (char *label, int defflag)
 {
      int len = strlen (label);
+     char a = ' ';
 
      if (!printl_count)
 	  prom_printf ("\n");
-     prom_printf ("%s %s",defflag?"*":" ", label);
+     switch (defflag) {
+	  case 1:  a='*'; break;
+	  case 2:  a='&'; break;
+	  default: a=' '; break;
+     }
+     prom_printf ("%c %s", a, label);
      while (len++ < 25)
 	  prom_putchar (' ');
      printl_count++;
@@ -523,7 +530,9 @@ void cfg_print_images (void)
 	       if (alias)
 		    label = alias + 1;
 	  }
-	  if(!strcmp(ret,label))
+	  if(!strcmp(bootoncelabel,label))
+	       defflag=2;
+	  else if(!strcmp(ret,label))
 	       defflag=1;
 	  else
 	       defflag=0;





More information about the Yaboot-devel mailing list