rpms/grub/devel grub-chainloader-timeout.patch, NONE, 1.1 grub.spec, 1.76, 1.77

Peter Jones pjones at fedoraproject.org
Wed Oct 22 20:50:37 UTC 2008


Author: pjones

Update of /cvs/extras/rpms/grub/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12148

Modified Files:
	grub.spec 
Added Files:
	grub-chainloader-timeout.patch 
Log Message:
* Wed Oct 22 2008 Peter Jones <pjones at redhat.com> - 0.97-36
- Add force-chainloader patch from rstrode (rhbz #458576)


grub-chainloader-timeout.patch:

--- NEW FILE grub-chainloader-timeout.patch ---
--- grub-0.97/stage2/builtins.c	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/builtins.c	2008-09-30 10:17:17.000000000 -0400
@@ -76,6 +76,7 @@
 int auth = 0;
 /* The timeout.  */
 int grub_timeout = -1;
+int grub_chaintimeout = -1;
 /* Whether to show the menu or not.  */
 int show_menu = 1;
 /* The BIOS drive map.  */
@@ -531,7 +529,7 @@
 {
   "chainloader",
   chainloader_func,
-  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST | BUILTIN_SHOW_CHAIN_MENU,
   "chainloader [--force] FILE",
   "Load the chain-loader FILE. If --force is specified, then load it"
   " forcibly, whether the boot loader signature is present or not."
@@ -4957,6 +4955,37 @@
 };
 
 
+/* timeout when chainloading */
+static int
+chaintimeout_func (char *arg, int flags)
+{
+  /* One-shot default shenanigans -- don't piss around with the menu! */
+  if (grub_chaintimeout != -1)
+    return 0;
+  if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
+    {
+      grub_chaintimeout = 0;
+      return 0;
+    }
+
+  if (! safe_parse_maxint (&arg, &grub_chaintimeout))
+    return 1;
+
+  return 0;
+}
+
+static struct builtin builtin_chaintimeout =
+{
+  "chaintimeout",
+  chaintimeout_func,
+  BUILTIN_MENU,
+#if 0
+  "chaintimeout SEC",
+  "Like timeout builtin, but used when an entry that chainloads is in config"
+#endif
+};
+
+
 /* title */
 static int
 title_func (char *arg, int flags)
@@ -5147,6 +5176,7 @@
 #endif /* SUPPORT_NETBOOT */
   &builtin_cat,
   &builtin_chainloader,
+  &builtin_chaintimeout,
   &builtin_clear,
   &builtin_cmp,
   &builtin_color,
--- grub-0.97/stage2/shared.h	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/shared.h	2008-09-30 10:14:58.000000000 -0400
@@ -837,6 +837,7 @@
 #define BUILTIN_SCRIPT		0x8	/* Run in the script.  */
 #define BUILTIN_NO_ECHO		0x10	/* Don't print command on booting. */
 #define BUILTIN_HELP_LIST	0x20	/* Show help in listing.  */
+#define BUILTIN_SHOW_CHAIN_MENU	0x40	/* Force menu to show up because of chainloading */
 
 /* The table for a builtin.  */
 struct builtin
@@ -872,6 +873,7 @@
 extern kernel_t kernel_type;
 extern int show_menu;
 extern int grub_timeout;
+extern int grub_chaintimeout;
 
 void init_builtins (void);
 void init_config (void);
--- grub-0.97/stage2/stage2.c	2008-09-30 10:24:37.000000000 -0400
+++ grub-0.97/stage2/stage2.c	2008-09-30 10:16:35.000000000 -0400
@@ -1031,7 +1031,13 @@
 		  if (! builtin)
 		    /* Unknown command. Just skip now.  */
 		    continue;
-		  
+
+		  if (builtin->flags & BUILTIN_SHOW_CHAIN_MENU)
+		    {
+		      show_menu = 1;
+		      grub_timeout = grub_chaintimeout;
+		    }
+
 		  if (builtin->flags & BUILTIN_TITLE)
 		    {
 		      char *ptr;
diff -up grub-0.97/stage2/stage2.c.fix-plymouth-patch grub-0.97/stage2/stage2.c
--- grub-0.97/stage2/stage2.c.fix-plymouth-patch	2008-09-30 17:00:18.000000000 -0400
+++ grub-0.97/stage2/stage2.c	2008-09-30 17:00:58.000000000 -0400
@@ -258,14 +258,19 @@ restart:
      interface. */
   if (grub_timeout < 0)
     show_menu = 1;
-  
+
   /* If SHOW_MENU is false, don't display the menu until ESC is pressed.  */
   if (! show_menu)
     {
+      /* Don't show the "Booting in blah seconds message" if the timeout is 0 */
+      int print_message = grub_timeout != 0;
+
       /* Get current time.  */
       while ((time1 = getrtsecs ()) == 0xFF)
 	;
-      grub_verbose_printf("\rPress any key to enter the menu\n\n\n");
+
+      if (print_message)
+	grub_printf("\rPress any key to enter the menu\n\n\n");
 
       while (1)
 	{
@@ -301,9 +306,10 @@ restart:
 	      grub_timeout--;
 	      
 	      /* Print a message.  */
-	      grub_verbose_printf ("\rBooting %s in %d seconds...",
-				   get_entry(menu_entries, first_entry + entryno, 0),
-				   grub_timeout);
+	      if (print_message)
+		grub_printf ("\rBooting %s in %d seconds...",
+		             get_entry(menu_entries, first_entry + entryno, 0),
+		             grub_timeout);
 	    }
 	}
     }


Index: grub.spec
===================================================================
RCS file: /cvs/extras/rpms/grub/devel/grub.spec,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- grub.spec	15 Oct 2008 14:39:05 -0000	1.76
+++ grub.spec	22 Oct 2008 20:50:06 -0000	1.77
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 35%{?dist}
+Release: 36%{?dist}
 Summary: GRUB - the Grand Unified Boot Loader.
 Group: System Environment/Base
 License: GPLv2+
@@ -18,6 +18,7 @@
 Source0: ftp://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
 Patch0: grub-fedora-9.patch
 Patch1: grub-keystatus.patch
+Patch2: grub-chainloader-timeout.patch
 
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
@@ -29,6 +30,7 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 autoreconf
@@ -91,6 +93,9 @@
 %{_datadir}/grub
 
 %changelog
+* Wed Oct 22 2008 Peter Jones <pjones at redhat.com> - 0.97-36
+- Add force-chainloader patch from rstrode (rhbz #458576)
+
 * Tue Oct 07 2008 Peter Jones <pjones at redhat.com> - 0.97-35
 - Add dep on newer gnu-efi.
 




More information about the scm-commits mailing list