[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10956921.NyiUUSuA9g@nerdopolis2>
Date: Thu, 27 Feb 2025 23:39:30 -0500
From: Adam Simonelli <adamsimonelli@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Petr Mladek <pmladek@...e.com>, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiri Slaby <jirislaby@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject:
Re: [PATCH v5 1/2] ttynull: Add an option to allow ttynull to be used as a
console device
On Wednesday, February 26, 2025 2:22:20 PM EST Andy Shevchenko wrote:
> On Wed, Feb 26, 2025 at 3:39 PM Adam Simonelli <adamsimonelli@...il.com> wrote:
> > On Tuesday, February 25, 2025 11:19:04 AM EST Petr Mladek wrote:
>
> ...
>
> > > My proposal is to call:
> > >
> > > #ifdef CONFIG_NULL_TTY_DEFAULT_CONSOLE
> > > add_preferred_console("ttynull", 0, NULL);
> > > #endif
> > >
> > > somewhere in the kernel code. The question is where.
> > > I wonder if the following would work:
> > >
> >
> > > #ifdef CONFIG_NULL_TTY_DEFAULT_CONSOLE
> > > static int __init ttynull_default_console(void)
> > > {
> > > add_preferred_console("ttynull", 0, NULL);
> > > return 0;
> > > }
> > > console_initcall(ttynull_register);
> > > #endif
> > >
> > OK, actually in earlier revisions locally, I did actually have
> >
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index dddb15f48d59..c1554a789de8 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -3712,6 +3712,11 @@ void __init console_init(void)
> > initcall_t call;
> > initcall_entry_t *ce;
> >
> > +#ifdef CONFIG_NULL_TTY_CONSOLE
> > + if (!strstr(boot_command_line, "console="))
>
> Just a side note: strstr() is fragile as theoretically "console=" can
> be part of an argument unrelated to the console, like
> foo="bar,baz,console=10,key=value". Although I haven't checked if this
> is allowed by cmdline parser (lib/cmdline.c).
>
Dang, good call. As a crude test, console=ttynull= results in a panic, so it
does look like it allows ='s in parameter values, as it looks like it is
handling the =...
Gotta find a better way to parse it if I'm to do the `add_preferred_console`
route, Maybe I can try get_option...
What do you think of the placement of it too?
> > + add_preferred_console("ttynull", 0, NULL);
> > +#endif
> > +
> > /* Setup the default TTY line discipline. */
> > n_tty_init();
> >
> >
> >
> > Which worked as far as I could tell, at least on x86. Not sure if that was the
> > right place, and yeah, I was trying to better copy how CONFIG_VT_CONSOLE worked
> > because I thought that was more correct.
>
>
Powered by blists - more mailing lists