From bf402781314c6bfbcfbb40ead530734c84c99203 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 6 Jun 2013 11:46:07 +0200 Subject: [PATCH] Delay start of TTYs to let system stabilize at boot. Signed-off-by: Joachim Nilsson --- finit.c | 13 ++++++++++--- finit.h | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/finit.c b/finit.c index 682c514c..93485f42 100644 --- a/finit.c +++ b/finit.c @@ -133,10 +133,20 @@ static int client(int argc, char *argv[]) static int run_loop(void) { + int delay = DELAY_TTY ?: 1; + _d("Entering main loop ..."); while (1) { svc_monitor(); plugin_monitor(); + + /* Delayed start of TTYs to let the system stabilize + * after switching runlevels. */ + if (delay) { + if (--delay == 0) + tty_runlevel(runlevel); + continue; + } } return 0; @@ -269,9 +279,6 @@ int main(int argc, char* argv[]) /* Hooks that should run at the very end */ plugin_run_hooks(HOOK_SYSTEM_UP); - /* Start GETTY on console(s) */ - tty_runlevel(runlevel); - /* * Enter main loop to monior /dev/initctl and services */ diff --git a/finit.h b/finit.h index 93736e7e..b8981926 100644 --- a/finit.h +++ b/finit.h @@ -60,6 +60,9 @@ # define DEFHOST "noname" #endif +/* Delay start of GETTY at boot. Must be > 0 */ +#define DELAY_TTY 2 + #define CMD_SIZE 256 #define LINE_SIZE 1024 #define BUF_SIZE 4096