Messages in this thread Patch in this message | | | Date | Tue, 12 Oct 2004 02:47:56 +0100 (BST) | From | "Maciej W. Rozycki" <> | Subject | [PATCH] 2.4: "console=" parameter ignored |
| |
Hello,
I've noticed that under specific circumstances the "console=" kernel parameter is ignored. This happens when EARLY_PRINTK is enabled and the serial console is the only available. In this case unregister_console() when called for the early console sets preferred_console back to -1 replacing the value that was recorded by console_setup() -- the order of calls is as follows:
1. register_console() -- for the early console,
2. console_setup() -- recording the console index for the real console,
3. unregister_console() -- for the early console, erasing the console index recorded above,
4. register_console() -- for the real console, picking up the first device available, instead of the selected one.
I've observed this problem with a DECstation system using ttyS3 -- its default console device from the firmware's point of view.
The solution is to restore the setting of "console=" upon unregister_console(). Here is a patch that works for me -- run-time tested with a snapshot of 2.4.26. I've prepared a coresponding patch for 2.6, that I'll send separately.
Please apply.
Maciej
patch-mips-2.4.26-20040809-console-0 diff -up --recursive --new-file linux-mips-2.4.26-20040809.macro/kernel/printk.c linux-mips-2.4.26-20040809/kernel/printk.c --- linux-mips-2.4.26-20040809.macro/kernel/printk.c 2003-12-18 03:57:27.000000000 +0000 +++ linux-mips-2.4.26-20040809/kernel/printk.c 2004-09-25 20:54:21.000000000 +0000 @@ -95,6 +95,7 @@ static unsigned long log_end; /* Index static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; +static int selected_console = -1; static int preferred_console = -1; /* Flag: console code may call schedule() */ @@ -140,12 +141,12 @@ static int __init console_setup(char *st for(i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) if (strcmp(console_cmdline[i].name, name) == 0 && console_cmdline[i].index == idx) { - preferred_console = i; + selected_console = i; return 1; } if (i == MAX_CMDLINECONSOLES) return 1; - preferred_console = i; + selected_console = i; c = &console_cmdline[i]; memcpy(c->name, name, sizeof(c->name)); c->options = options; @@ -586,6 +587,9 @@ void register_console(struct console * c int i; unsigned long flags; + if (preferred_console < 0) + preferred_console = selected_console; + /* * See if we want to use this console driver. If we * didn't select a console we take the first one @@ -675,7 +679,7 @@ int unregister_console(struct console * * would prevent fbcon from taking over. */ if (console_drivers == NULL) - preferred_console = -1; + preferred_console = selected_console; release_console_sem(); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |