VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
author: Linus Torvalds <torvalds@linux-foundation.org> 2020-12-16 10:45:11 -0800 committer: Linus Torvalds <torvalds@linux-foundation.org> 2020-12-16 10:45:11 -0800 commit: d3eb52113d162cc88975fbd03c9e6f9cf2f8a771 parent: 5e60366d56c630e32befce7ef05c569e04391ca3
Commit Summary:
Merge tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Diffstat:
1 file changed, 7 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index 3024c4db17a9..6feee7f11eaf 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1480,8 +1480,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);