--- 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; }