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 static int use_stderr_console = 0;
15 static void stderr_console_write(struct console *console, const char *string,
18 generic_write(2 /* stderr */, string, len, NULL);
21 static struct console stderr_console = {
23 .write = stderr_console_write,
24 .flags = CON_PRINTBUFFER,
27 static int __init stderr_console_init(void)
29 if (use_stderr_console)
30 register_console(&stderr_console);
33 console_initcall(stderr_console_init);
35 static int stderr_setup(char *str)
39 use_stderr_console = simple_strtoul(str,&str,0);
42 __setup("stderr=", stderr_setup);
44 /* The previous behavior of not unregistering led to /dev/console being
45 * impossible to open. My FC5 filesystem started having init die, and the
46 * system panicing because of this. Unregistering causes the real
47 * console to become the default console, and /dev/console can then be
48 * opened. Making this an initcall makes this happen late enough that
49 * there is no added value in dumping everything to stderr, and the
50 * normal console is good enough to show you all available output.
52 static int __init unregister_stderr(void)
54 unregister_console(&stderr_console);
59 __initcall(unregister_stderr);