author: Petr Mladek <pmladek@suse.com> 2020-11-11 14:54:49 +0100
committer: Petr Mladek <pmladek@suse.com> 2020-11-20 12:23:50 +0100
commit: 757055ae8dedf5333af17b3b5b4b70ba9bc9da4e
parent: 8119c4332d253660e0a6b8748fe0749961cfbc97
Commit Summary:
Diffstat:
1 file changed, 7 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index 1af84337cb18..b3fcf446f99e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1468,8 +1468,14 @@ void __init console_on_rootfs(void)
struct file *file = filp_open("/dev/console", O_RDWR, 0);
if (IS_ERR(file)) {
- pr_err("Warning: unable to open an initial console.\n");
- return;
+ pr_err("Warning: unable to open an initial console. Fallback to ttynull.\n");
+ register_ttynull_console();
+
+ file = filp_open("/dev/console", O_RDWR, 0);
+ if (IS_ERR(file)) {
+ pr_err("Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process!\n");
+ return;
+ }
}
init_dup(file);
init_dup(file);