Skip to content

Commit d7ffac3

Browse files
thomasmeyrichardweinberger
authored andcommitted
um: stdio_console: Make preferred console
The addition of the "ttynull" console driver did break the ordering of the UML stdio console driver. The UML stdio console driver is added in late_initcall (7), whereby the ttynull driver is added in device_initcall (6), which always does make the ttynull driver the default console. Fix it by explicitly adding the UML stdio console as the preferred console, in case no 'console=' command line option was specified. Signed-off-by: Thomas Meyer <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 1cdcfb4 commit d7ffac3

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

arch/um/kernel/um_arch.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <mem_user.h>
2727
#include <os.h>
2828

29-
#define DEFAULT_COMMAND_LINE "root=98:0"
29+
#define DEFAULT_COMMAND_LINE_ROOT "root=98:0"
30+
#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty"
3031

3132
/* Changed in add_arg and setup_arch, which run before SMP is started */
3233
static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
@@ -109,7 +110,8 @@ unsigned long end_vm;
109110
int ncpus = 1;
110111

111112
/* Set in early boot */
112-
static int have_root __initdata = 0;
113+
static int have_root __initdata;
114+
static int have_console __initdata;
113115

114116
/* Set in uml_mem_setup and modified in linux_main */
115117
long long physmem_size = 32 * 1024 * 1024;
@@ -161,6 +163,17 @@ __uml_setup("debug", no_skas_debug_setup,
161163
" this flag is not needed to run gdb on UML in skas mode\n\n"
162164
);
163165

166+
static int __init uml_console_setup(char *line, int *add)
167+
{
168+
have_console = 1;
169+
return 0;
170+
}
171+
172+
__uml_setup("console=", uml_console_setup,
173+
"console=<preferred console>\n"
174+
" Specify the preferred console output driver\n\n"
175+
);
176+
164177
static int __init Usage(char *line, int *add)
165178
{
166179
const char **p;
@@ -264,7 +277,10 @@ int __init linux_main(int argc, char **argv)
264277
add_arg(argv[i]);
265278
}
266279
if (have_root == 0)
267-
add_arg(DEFAULT_COMMAND_LINE);
280+
add_arg(DEFAULT_COMMAND_LINE_ROOT);
281+
282+
if (have_console == 0)
283+
add_arg(DEFAULT_COMMAND_LINE_CONSOLE);
268284

269285
host_task_size = os_get_top_address();
270286
/*

0 commit comments

Comments
 (0)