diff --git a/init.c b/init.c index 73d13d1..cbf5aa4 100644 --- a/init.c +++ b/init.c @@ -481,7 +481,7 @@ int main(int argc, char **argv) kill(klog_pid, 9); - printf("exiting init -- giving hand to stage2\n"); + printf("Spawning init ..."); /* rest was seamlessy stolen from klibc */ /* First, change to the new root directory */ @@ -515,6 +515,7 @@ int main(int argc, char **argv) fatal_error("overmounting image location"); umount("/sys"); + umount("/proc/bus/usb"); umount("/proc"); /* Delete rootfs contents */ @@ -539,6 +540,7 @@ int main(int argc, char **argv) close(fd); /* Spawn init */ + printf(" done.\n"); execve(stage2_argv[0], stage2_argv, env); fatal_error("stage2"); /* Failed to spawn init */ diff --git a/stage1.c b/stage1.c index 21af619..f13d3f3 100644 --- a/stage1.c +++ b/stage1.c @@ -106,6 +106,8 @@ void stg1_info_message(char *msg, ...) /************************************************************ * spawns a shell on console #2 */ +static pid_t shell_pid = 0; + static void spawn_shell(void) { #ifdef SPAWN_SHELL @@ -125,7 +127,7 @@ static void spawn_shell(void) return; } - if (!fork()) { + if (!(shell_pid = fork())) { dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); @@ -415,8 +417,12 @@ int main(int argc, char **argv, char **env) if (ret != RETURN_OK) fatal_error("could not select an installation method"); + /* all went good */ if (interactive_pid != 0) kill(interactive_pid, 9); + if (shell_pid != 0) + kill(shell_pid, 9); + return 0; /* shut up compiler (we can't get here anyway!) */ }