Re: [PATCH v5 1/2] ttynull: Add an option to allow ttynull to be used as a console device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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.
> 
> 









[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux