1 #include <linux/init.h>
2 #include <linux/console.h>
6 /* ----------------------------------------------------------------------------- */
7 /* trivial console driver -- simply dump everything to stderr */
10 * Don't register by default -- as this registeres very early in the
11 * boot process it becomes the default console.
13 * Initialized at init time.
15 static int use_stderr_console = 0;
17 static void stderr_console_write(struct console *console, const char *string,
20 generic_write(2 /* stderr */, string, len, NULL);
23 static struct console stderr_console = {
25 .write = stderr_console_write,
26 .flags = CON_PRINTBUFFER,
29 static int __init stderr_console_init(void)
31 if (use_stderr_console)
32 register_console(&stderr_console);
35 console_initcall(stderr_console_init);
37 static int stderr_setup(char *str)
41 use_stderr_console = simple_strtoul(str,&str,0);
44 __setup("stderr=", stderr_setup);
46 /* The previous behavior of not unregistering led to /dev/console being
47 * impossible to open. My FC5 filesystem started having init die, and the
48 * system panicing because of this. Unregistering causes the real
49 * console to become the default console, and /dev/console can then be
50 * opened. Making this an initcall makes this happen late enough that
51 * there is no added value in dumping everything to stderr, and the
52 * normal console is good enough to show you all available output.
54 static int __init unregister_stderr(void)
56 unregister_console(&stderr_console);
61 __initcall(unregister_stderr);