From: Ales Kozumplik <akozumpl@xxxxxxxxxx> Stop the kernel correctly on HALT (so that we dont see 'kernel panic, they killed init' on i386 and on s390 one gets easy access to manual IPL). Introduce a new reboot method that does allow us to see the backtrace and doesn't scroll the screen up with useless unmount info. --- loader/init.c | 8 +++--- loader/init.h | 5 +++- loader/shutdown.c | 57 +++++++++++++++++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/loader/init.c b/loader/init.c index 68a9ea9..ec4ce73 100644 --- a/loader/init.c +++ b/loader/init.c @@ -438,8 +438,8 @@ int main(int argc, char **argv) { pid_t installpid, childpid; int waitStatus; int fd = -1; - int doReboot = 0; int doShutdown =0; + reboot_action shutdown_method = HALT; int isSerial = 0; char * console = NULL; int doKill = 1; @@ -776,6 +776,7 @@ int main(int argc, char **argv) { if (!WIFEXITED(waitStatus) || (WIFEXITED(waitStatus) && WEXITSTATUS(waitStatus))) { + shutdown_method = DELAYED_REBOOT; printf("install exited abnormally [%d/%d] ", WIFEXITED(waitStatus), WEXITSTATUS(waitStatus)); if (WIFSIGNALED(waitStatus)) { @@ -783,11 +784,10 @@ int main(int argc, char **argv) { } printf("\n"); } else { - doReboot = 1; + shutdown_method = REBOOT; } - expected_exit = 1; - shutDown(doKill, doReboot?REBOOT:HALT); + shutDown(doKill, shutdown_method); return 0; } diff --git a/loader/init.h b/loader/init.h index 733bc8e..e1e5b70 100644 --- a/loader/init.h +++ b/loader/init.h @@ -22,7 +22,10 @@ typedef enum { REBOOT, POWEROFF, - HALT + HALT, + /* gives user a chance to read the trace before scrolling the text out + with disk unmounting and termination info */ + DELAYED_REBOOT } reboot_action; #endif /* INIT_H */ diff --git a/loader/shutdown.c b/loader/shutdown.c index 774e11a..c9ba334 100644 --- a/loader/shutdown.c +++ b/loader/shutdown.c @@ -62,35 +62,50 @@ static void performUnmounts(void) { } static void performReboot(reboot_action rebootAction) { - if (rebootAction == POWEROFF) { + switch (rebootAction) { + case POWEROFF: printf("powering off system\n"); - sleep(2); + sleep(2); reboot(RB_POWER_OFF); - } else if (rebootAction == REBOOT) { - printf("rebooting system\n"); - sleep(2); - + break; + case REBOOT: + printf("rebooting system\n"); + sleep(2); #if USE_MINILIBC - reboot(0xfee1dead, 672274793, 0x1234567); + reboot(0xfee1dead, 672274793, 0x1234567); #else - reboot(RB_AUTOBOOT); + reboot(RB_AUTOBOOT); #endif - } + break; + case HALT: + printf("halting system\n"); + reboot(RB_HALT_SYSTEM); + break; + default: + break; + } } -void shutDown(int doKill, reboot_action rebootAction) { - if (doKill) { - performUnmounts(); - performTerminations(); - } - - if ((rebootAction == POWEROFF || rebootAction == REBOOT) && doKill) { - performReboot(rebootAction); - } +static void performDelayedReboot() +{ + printf("the system will be rebooted when you press Ctrl-C or Ctrl-Alt-Delete.\n"); + while (1) { + sleep(1); + } +} - printf("you may safely reboot your system\n"); - exit(0); - return; +void shutDown(int doKill, reboot_action rebootAction) +{ + if (rebootAction == DELAYED_REBOOT) { + performDelayedReboot(); + } else if (doKill) { + performUnmounts(); + performTerminations(); + performReboot(rebootAction); + } + printf("you may safely reboot your system\n"); + exit(0); + return; } #ifdef AS_SHUTDOWN -- 1.6.2.5 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list