Blame grub-0.93-graphics-bootterm.patch

cvsdist 91c9f39
--- grub-0.93/stage2/builtins.c.bootterm	2002-12-29 02:01:50.000000000 -0500
cvsdist 91c9f39
+++ grub-0.93/stage2/builtins.c	2002-12-29 02:01:07.000000000 -0500
cvsdist 91c9f39
@@ -233,12 +233,22 @@
cvsdist 91c9f39
 static int
cvsdist 91c9f39
 boot_func (char *arg, int flags)
cvsdist 91c9f39
 {
cvsdist 91c9f39
+  struct term_entry *prev_term = current_term;
cvsdist 91c9f39
   /* Clear the int15 handler if we can boot the kernel successfully.
cvsdist 91c9f39
      This assumes that the boot code never fails only if KERNEL_TYPE is
cvsdist 91c9f39
      not KERNEL_TYPE_NONE. Is this assumption is bad?  */
cvsdist 91c9f39
   if (kernel_type != KERNEL_TYPE_NONE)
cvsdist 91c9f39
     unset_int15_handler ();
cvsdist 91c9f39
 
cvsdist 91c9f39
+  /* if our terminal needed initialization, we should shut it down
cvsdist 91c9f39
+   * before booting the kernel, but we want to save what it was so
cvsdist 91c9f39
+   * we can come back if needed */
cvsdist 91c9f39
+  if (current_term->shutdown) 
cvsdist 91c9f39
+    {
cvsdist 91c9f39
+      (*current_term->shutdown)();
cvsdist 91c9f39
+      current_term = term_table; /* assumption: console is first */
cvsdist 91c9f39
+    }
cvsdist 91c9f39
+
cvsdist 91c9f39
 #ifdef SUPPORT_NETBOOT
cvsdist 91c9f39
   /* Shut down the networking.  */
cvsdist 91c9f39
   cleanup_net ();
cvsdist 91c9f39
@@ -302,6 +312,13 @@
cvsdist 91c9f39
       return 1;
cvsdist 91c9f39
     }
cvsdist 91c9f39
 
cvsdist 91c9f39
+  /* if we get back here, we should go back to what our term was before */
cvsdist 91c9f39
+  current_term = prev_term;
cvsdist 91c9f39
+  if (current_term->startup)
cvsdist 91c9f39
+      /* if our terminal fails to initialize, fall back to console since
cvsdist 91c9f39
+       * it should always work */
cvsdist 91c9f39
+      if ((*current_term->startup)() == 0)
cvsdist 91c9f39
+          current_term = term_table; /* we know that console is first */
cvsdist 91c9f39
   return 0;
cvsdist 91c9f39
 }
cvsdist 91c9f39