55 lines
2.0 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../grub/grub-0.93-graphics-bootterm.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
--- grub-0.93/stage2/builtins.c.bootterm 2002-12-29 02:01:50.000000000 -0500
+++ grub-0.93/stage2/builtins.c 2002-12-29 02:01:07.000000000 -0500
@@ -233,12 +233,22 @@
static int
boot_func (char *arg, int flags)
{
+ struct term_entry *prev_term = current_term;
/* Clear the int15 handler if we can boot the kernel successfully.
This assumes that the boot code never fails only if KERNEL_TYPE is
not KERNEL_TYPE_NONE. Is this assumption is bad? */
if (kernel_type != KERNEL_TYPE_NONE)
unset_int15_handler ();
+ /* if our terminal needed initialization, we should shut it down
+ * before booting the kernel, but we want to save what it was so
+ * we can come back if needed */
+ if (current_term->shutdown)
+ {
+ (*current_term->shutdown)();
+ current_term = term_table; /* assumption: console is first */
+ }
+
#ifdef SUPPORT_NETBOOT
/* Shut down the networking. */
cleanup_net ();
@@ -302,6 +312,13 @@
return 1;
}
+ /* if we get back here, we should go back to what our term was before */
+ current_term = prev_term;
+ if (current_term->startup)
+ /* if our terminal fails to initialize, fall back to console since
+ * it should always work */
+ if ((*current_term->startup)() == 0)
+ current_term = term_table; /* we know that console is first */
return 0;
}