diff options
| author | Sherry Moore <Sherry.Moore@Sun.COM> | 2009-09-17 11:03:46 -0700 |
|---|---|---|
| committer | Sherry Moore <Sherry.Moore@Sun.COM> | 2009-09-17 11:03:46 -0700 |
| commit | 9db7147e806ba9dd646607e04abfa51ec79c6ffd (patch) | |
| tree | ce687cf96a33f60ff474709419e38cf0a4578930 | |
| parent | 9c3c5164be46f023da2cc05de6ce04402f8d9755 (diff) | |
| download | illumos-joyent-9db7147e806ba9dd646607e04abfa51ec79c6ffd.tar.gz | |
6855522 Happyface boot and Fast Reboot don't get along
| -rw-r--r-- | usr/src/cmd/halt/halt.c | 68 | ||||
| -rw-r--r-- | usr/src/lib/libgrubmgmt/common/libgrub_cmd.def | 3 | ||||
| -rw-r--r-- | usr/src/uts/i86pc/boot/boot_console.c | 13 | ||||
| -rw-r--r-- | usr/src/uts/i86pc/os/fakebop.c | 16 | ||||
| -rw-r--r-- | usr/src/uts/i86pc/os/mlsetup.c | 26 |
5 files changed, 111 insertions, 15 deletions
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c index 1ebd014a9a..869e399cab 100644 --- a/usr/src/cmd/halt/halt.c +++ b/usr/src/cmd/halt/halt.c @@ -379,6 +379,42 @@ continue_delegates() (void) sigsend(P_CTID, next->ctid, SIGCONT); } +#define FMRI_GDM "svc:/application/graphical-login/gdm:default" + +/* + * If gdm is running, try to stop gdm. + * Returns 0 on success, -1 on failure. + */ +static int +stop_gdm() +{ + char *gdm_state = NULL; + int retry = 0; + + /* + * If gdm is running, try to stop gdm. + */ + while ((gdm_state = smf_get_state(FMRI_GDM)) != NULL && + strcmp(gdm_state, SCF_STATE_STRING_ONLINE) == 0 && retry++ < 5) { + if (smf_disable_instance(FMRI_GDM, SMF_TEMPORARY) != 0) { + (void) fprintf(stderr, + gettext("%s: Failed to stop %s: %s.\n"), + cmdname, FMRI_GDM, scf_strerror(scf_error())); + return (-1); + } + (void) sleep(1); + } + + if (retry >= 5) { + (void) fprintf(stderr, gettext("%s: Failed to stop %s.\n"), + cmdname, FMRI_GDM); + return (-1); + } + + return (0); +} + + static void stop_restarters() { @@ -1480,7 +1516,29 @@ main(int argc, char *argv[]) (void) fprintf(stderr, gettext("%s: could not create %s.\n"), cmdname, resetting); + } + + /* + * Make sure we don't get stopped by a jobcontrol shell + * once we start killing everybody. + */ + (void) signal(SIGTSTP, SIG_IGN); + (void) signal(SIGTTIN, SIG_IGN); + (void) signal(SIGTTOU, SIG_IGN); + (void) signal(SIGPIPE, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); + + /* + * Try to stop gdm so X has a chance to return the screen and + * keyboard to a sane state. + */ + if (fast_reboot && stop_gdm() != 0) { + (void) fprintf(stderr, + gettext("%s: Falling back to regular reboot.\n"), cmdname); + fast_reboot = 0; + } + if (cmd != A_DUMP) { /* * Stop all restarters so they do not try to restart services * that are terminated. @@ -1500,16 +1558,6 @@ main(int argc, char *argv[]) } /* - * Make sure we don't get stopped by a jobcontrol shell - * once we start killing everybody. - */ - (void) signal(SIGTSTP, SIG_IGN); - (void) signal(SIGTTIN, SIG_IGN); - (void) signal(SIGTTOU, SIG_IGN); - (void) signal(SIGPIPE, SIG_IGN); - (void) signal(SIGTERM, SIG_IGN); - - /* * If we're not forcing a crash dump, give everyone 5 seconds to * handle a SIGTERM and clean up properly. */ diff --git a/usr/src/lib/libgrubmgmt/common/libgrub_cmd.def b/usr/src/lib/libgrubmgmt/common/libgrub_cmd.def index eea69c889c..6dda9a41a7 100644 --- a/usr/src/lib/libgrubmgmt/common/libgrub_cmd.def +++ b/usr/src/lib/libgrubmgmt/common/libgrub_cmd.def @@ -58,6 +58,9 @@ menu_cmd("chainloader", GRBM_CHAINLOADER_CMD, GRUB_LINE_ENTRY, error_line) menu_cmd("args", GRBM_ARGS_CMD, GRUB_LINE_ENTRY, error_line) menu_cmd("findroot", GRBM_FINDROOT_CMD, GRUB_LINE_ENTRY, findroot) menu_cmd("bootfs", GRBM_BOOTFS_CMD, GRUB_LINE_ENTRY, bootfs) +menu_cmd("splashimage", GRBM_SPLASHIMAGE_CMD, GRUB_LINE_ENTRY, skip_line) +menu_cmd("background", GRBM_BACKGROUND_CMD, GRUB_LINE_ENTRY, skip_line) +menu_cmd("foreground", GRBM_FOREGROUND_CMD, GRUB_LINE_ENTRY, skip_line) menu_cmd_end(GRBM_CMD_NUM) /* Should be the last one */ diff --git a/usr/src/uts/i86pc/boot/boot_console.c b/usr/src/uts/i86pc/boot/boot_console.c index 2508711f08..f07735bb5e 100644 --- a/usr/src/uts/i86pc/boot/boot_console.c +++ b/usr/src/uts/i86pc/boot/boot_console.c @@ -510,6 +510,10 @@ bcons_init(char *bootstr) console_value_t *consolep; size_t len, cons_len; char *cons_str; +#if !defined(_BOOT) + static char console_text[] = "text"; + extern int post_fastreboot; +#endif boot_line = bootstr; console = CONS_INVALID; @@ -522,6 +526,11 @@ bcons_init(char *bootstr) if (cons_str == NULL) cons_str = find_boot_line_prop("output-device"); +#if !defined(_BOOT) + if (post_fastreboot && strcmp(cons_str, "graphics") == 0) + cons_str = console_text; +#endif + /* * Go through the console_devices array trying to match the string * we were given. The string on the command line must end with @@ -646,6 +655,10 @@ bcons_init2(char *inputdev, char *outputdev, char *consoledev) char *devnames[] = { consoledev, outputdev, inputdev, NULL }; console_value_t *consolep; int i; + extern int post_fastreboot; + + if (post_fastreboot && console == CONS_SCREEN_GRAPHICS) + console = CONS_SCREEN_TEXT; if (console != CONS_USBSER && console != CONS_SCREEN_GRAPHICS) { if (console_set) { diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c index a7e2b32fec..ff511b988b 100644 --- a/usr/src/uts/i86pc/os/fakebop.c +++ b/usr/src/uts/i86pc/os/fakebop.c @@ -696,10 +696,17 @@ done: consoledev = outputdev + v_len + 1; v_len = do_bsys_getproplen(NULL, "console"); - if (v_len > 0) + if (v_len > 0) { (void) do_bsys_getprop(NULL, "console", consoledev); - else + if (post_fastreboot && + strcmp(consoledev, "graphics") == 0) { + bsetprops("console", "text"); + v_len = strlen("text"); + bcopy("text", consoledev, v_len); + } + } else { v_len = 0; + } consoledev[v_len] = 0; bcons_init2(inputdev, outputdev, consoledev); } else { @@ -1696,8 +1703,6 @@ _start(struct xboot_info *xbp) HYPERVISOR_shared_info = (void *)xbootp->bi_shared_info; xen_info = xbootp->bi_xen_start_info; #endif - bcons_init((void *)xbootp->bi_cmdline); - have_console = 1; #ifndef __xpv if (*((uint32_t *)(FASTBOOT_SWTCH_PA + FASTBOOT_STACK_OFFSET)) == @@ -1707,6 +1712,9 @@ _start(struct xboot_info *xbp) } #endif + bcons_init((void *)xbootp->bi_cmdline); + have_console = 1; + /* * enable debugging */ diff --git a/usr/src/uts/i86pc/os/mlsetup.c b/usr/src/uts/i86pc/os/mlsetup.c index 3446c1f4ee..3ab1080095 100644 --- a/usr/src/uts/i86pc/os/mlsetup.c +++ b/usr/src/uts/i86pc/os/mlsetup.c @@ -49,10 +49,10 @@ #include <sys/machsystm.h> #include <sys/ontrap.h> #include <sys/bootconf.h> +#include <sys/boot_console.h> #include <sys/kdi_machimpl.h> #include <sys/archsystm.h> #include <sys/promif.h> -#include <sys/bootconf.h> #include <sys/pci_cfgspace.h> #ifdef __xpv #include <sys/hypervisor.h> @@ -78,6 +78,21 @@ static unsigned char dummy_cpu_pri[MAXIPL + 1] = { 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf }; +/* + * Set console mode + */ +static void +set_console_mode(uint8_t val) +{ + struct bop_regs rp = {0}; + + rp.eax.byte.ah = 0x0; + rp.eax.byte.al = val; + rp.ebx.word.bx = 0x0; + + BOP_DOINT(bootops, 0x10, &rp); +} + /* * Setup routine called right before main(). Interposing this function @@ -90,6 +105,8 @@ mlsetup(struct regs *rp) extern struct classfuncs sys_classfuncs; extern disp_t cpu0_disp; extern char t0stack[]; + extern int post_fastreboot; + extern int console; ASSERT_STACK_ALIGNED(); @@ -304,6 +321,13 @@ mlsetup(struct regs *rp) kdi_idt_sync(); /* + * Explicitly set console to text mode (0x3) if this is a boot + * post Fast Reboot, and the console is set to CONS_SCREEN_TEXT. + */ + if (post_fastreboot && console == CONS_SCREEN_TEXT) + set_console_mode(0x3); + + /* * If requested (boot -d) drop into kmdb. * * This must be done after cpu_list_init() on the 64-bit kernel |
