[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220224100833.GA3807@axis.com>
Date: Thu, 24 Feb 2022 11:08:33 +0100
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Arnd Bergmann <arnd@...db.de>, kernel <kernel@...s.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] char: ttyprintk: register console
On Mon, Feb 21, 2022 at 07:27:04PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 15, 2022 at 03:17:49PM +0100, Vincent Whitchurch wrote:
> > Register a console in the ttyprintk driver so that it can be selected
> > for /dev/console with console=ttyprintk on the kernel command line,
> > similar to other console drivers.
> >
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
> > ---
> > drivers/char/Kconfig | 3 ++-
> > drivers/char/ttyprintk.c | 16 ++++++++++++++++
> > 2 files changed, 18 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> > index 740811893c57..c553a8a50d03 100644
> > --- a/drivers/char/Kconfig
> > +++ b/drivers/char/Kconfig
> > @@ -18,7 +18,8 @@ config TTY_PRINTK
> > The feature is useful to inline user messages with kernel
> > messages.
> > In order to use this feature, you should output user messages
> > - to /dev/ttyprintk or redirect console to this TTY.
> > + to /dev/ttyprintk or redirect console to this TTY, or boot
> > + the kernel with console=ttyprintk.
>
> Why do you want to use this tty device as a console? What benifit
> does that provide?
I run Linux on a secondary processor on my SoC. This secondary
processor doesn't have any output peripherals of its own, so it uses
pstore to put its kernel messages at a fixed location in memory from
which the primary processor can read them out.
In order to access logs from the secondary processor's userspace, a
simple way is to use ttyprintk. Userspace logs to the console as normal
and the primary processor can read the unified kernel+userspace logs
from the pstore area.
There are similar uses in other cases not involving multiple processors.
I had mentioned on the lists a couple of years ago that I had this patch
(without posting it), and last week I received a request (off-list) for
it from someone who was looking to use it to debug userspace
initialization in postmarketOS on an Android phone (they only had the
ability to retreive the kernel's logs after a reboot using pstore).
Powered by blists - more mailing lists