From: Adam Simonelli <adamsimonelli@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiri Slaby <jirislaby@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH v5 1/2] ttynull: Add an option to allow ttynull to be used as a console device
Date: Thu, 27 Feb 2025 23:39:30 -0500 [thread overview]
Message-ID: <10956921.NyiUUSuA9g@nerdopolis2> (raw)
In-Reply-To: <CAHp75Vdr1yNamVMP12X2bZs5=PL=R+Lsio5b+ba_NaPOsvzobA@mail.gmail.com>
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@gmail.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.
>
>
next prev parent reply other threads:[~2025-02-28 4:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 12:39 [PATCH v5 0/2] Optionally allow ttynull to be selected as a default console adamsimonelli
2025-02-24 12:39 ` [PATCH v5 1/2] ttynull: Add an option to allow ttynull to be used as a console device adamsimonelli
2025-02-25 16:19 ` Petr Mladek
2025-02-26 13:39 ` Adam Simonelli
2025-02-26 19:22 ` Andy Shevchenko
2025-02-28 4:39 ` Adam Simonelli [this message]
2025-02-28 18:59 ` Andy Shevchenko
2025-03-03 13:20 ` Petr Mladek
2025-03-04 3:52 ` Adam Simonelli
2025-02-24 12:39 ` [PATCH v5 2/2] tty: Change order of ttynull to be linked sooner if enabled as a console adamsimonelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10956921.NyiUUSuA9g@nerdopolis2 \
--to=adamsimonelli@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.