1 #include <linux/kernel.h>
2 #include <linux/init.h>
3 #include <linux/console.h>
7 /* ----------------------------------------------------------------------------- */
8 /* trivial console driver -- simply dump everything to stderr */
11 * Don't register by default -- as this registers very early in the
12 * boot process it becomes the default console.
14 * Initialized at init time.
16 static int use_stderr_console
= 0;
18 static void stderr_console_write(struct console
*console
, const char *string
,
21 generic_write(2 /* stderr */, string
, len
, NULL
);
24 static struct console stderr_console
= {
26 .write
= stderr_console_write
,
27 .flags
= CON_PRINTBUFFER
,
30 static int __init
stderr_console_init(void)
32 if (use_stderr_console
)
33 register_console(&stderr_console
);
36 console_initcall(stderr_console_init
);
38 static int stderr_setup(char *str
)
42 use_stderr_console
= simple_strtoul(str
,&str
,0);
45 __setup("stderr=", stderr_setup
);
47 /* The previous behavior of not unregistering led to /dev/console being
48 * impossible to open. My FC5 filesystem started having init die, and the
49 * system panicing because of this. Unregistering causes the real
50 * console to become the default console, and /dev/console can then be
51 * opened. Making this an initcall makes this happen late enough that
52 * there is no added value in dumping everything to stderr, and the
53 * normal console is good enough to show you all available output.
55 static int __init
unregister_stderr(void)
57 unregister_console(&stderr_console
);
62 __initcall(unregister_stderr
);
This page took 0.032693 seconds and 5 git commands to generate.