diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-16 19:45:11 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-16 19:45:11 +0100 |
commit | d3eb52113d162cc88975fbd03c9e6f9cf2f8a771 (patch) | |
tree | 7ef2b73e6174d355d625c2a05377b14c0939cca7 /init | |
parent | Merge tag 'fallthrough-fixes-clang-5.11-rc1' of git://git.kernel.org/pub/scm/... (diff) | |
parent | Merge branch 'for-5.11' into for-linus (diff) | |
download | linux-d3eb52113d162cc88975fbd03c9e6f9cf2f8a771.tar.xz linux-d3eb52113d162cc88975fbd03c9e6f9cf2f8a771.zip |
Merge tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek:
- Finally allow parallel writes and reads into/from the lockless
ringbuffer. But it is not a complete solution. Readers are still
serialized against each other. And nested writes are still prevented
by printk_safe per-CPU buffers.
- Use ttynull as the ultimate fallback for /dev/console.
- Officially allow disabling console output by using console="" or
console=null
- A few code cleanups
* tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
printk: remove logbuf_lock writer-protection of ringbuffer
printk: inline log_output(),log_store() in vprintk_store()
printk: remove obsolete dead assignment
printk/console: Allow to disable console output by using console="" or console=null
init/console: Use ttynull as a fallback when there is no console
printk: ringbuffer: Reference text_data_ring directly in callees.
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 10 |
1 files changed, 8 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); |