Skip to content

Commit

Permalink
parisc: Autodetect default output device and set console= kernel para…
Browse files Browse the repository at this point in the history
…meter

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>
  • Loading branch information
Helge Deller committed Jan 20, 2022
1 parent bd25c37 commit 5f7ee6e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/parisc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
void __init setup_cmdline(char **cmdline_p)
{
extern unsigned int boot_args[];
char *p;

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

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

/* autodetect console type (if not done by palo yet) */
p = boot_command_line;
if (!str_has_prefix(p, "console=") && !strstr(p, " console=")) {
strlcat(p, " console=", COMMAND_LINE_SIZE);
if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
strlcat(p, "ttyS0", COMMAND_LINE_SIZE);
else
strlcat(p, "tty0", COMMAND_LINE_SIZE);
}

#ifdef CONFIG_BLK_DEV_INITRD
if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
{
Expand Down

0 comments on commit 5f7ee6e

Please sign in to comment.