Skip to content

Commit 5f7ee6e

Browse files
committed
parisc: Autodetect default output device and set console= kernel parameter
Usually palo (the PA-RISC boot loader) will check at boot time if the machine/firmware was configured to use the serial line (ttyS0, SERIAL_x) or the graphical display (tty0, graph) as default output device and add the correct "console=ttyS0" or "console=tty0" Linux kernel parameter to the kernel command line when starting the Linux kernel. But the kernel could also have been started via the HP-UX boot loader or directly in qemu, in which cases the console parameter is missing. This patch fixes this problem by adding the correct console= parameter if it's missing in the current kernel command line. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent bd25c37 commit 5f7ee6e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/parisc/kernel/setup.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
4848
void __init setup_cmdline(char **cmdline_p)
4949
{
5050
extern unsigned int boot_args[];
51+
char *p;
5152

5253
/* Collect stuff passed in from the boot loader */
5354

@@ -59,6 +60,16 @@ void __init setup_cmdline(char **cmdline_p)
5960
strscpy(boot_command_line, (char *)__va(boot_args[1]),
6061
COMMAND_LINE_SIZE);
6162

63+
/* autodetect console type (if not done by palo yet) */
64+
p = boot_command_line;
65+
if (!str_has_prefix(p, "console=") && !strstr(p, " console=")) {
66+
strlcat(p, " console=", COMMAND_LINE_SIZE);
67+
if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
68+
strlcat(p, "ttyS0", COMMAND_LINE_SIZE);
69+
else
70+
strlcat(p, "tty0", COMMAND_LINE_SIZE);
71+
}
72+
6273
#ifdef CONFIG_BLK_DEV_INITRD
6374
if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
6475
{

0 commit comments

Comments
 (0)