All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 08/14] log: Add a console driver
Date: Tue, 21 Nov 2017 10:57:02 +0100	[thread overview]
Message-ID: <20171121105702.4bbc609d@jawa> (raw)
In-Reply-To: <20171120223335.45852-9-sjg@chromium.org>

On Mon, 20 Nov 2017 15:33:29 -0700
Simon Glass <sjg@chromium.org> wrote:

> It is useful to display log messages on the console. Add a simple
> driver to handle this.
> 
> Note that this driver outputs to the console, which may be serial or
> video. It does not specifically select serial output.
> 

Reviewed-by: Lukasz Majewski <lukma@denx.de>

> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
> Changes in v3: None
> Changes in v2:
> - Update commit message to explain that this is not just for serial
> output
> 
>  common/Kconfig       | 20 ++++++++++++++++++++
>  common/Makefile      |  1 +
>  common/log_console.c | 23 +++++++++++++++++++++++
>  3 files changed, 44 insertions(+)
>  create mode 100644 common/log_console.c
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index 9747443feb2..1b157e47c3d 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -474,6 +474,26 @@ config SPL_LOG_MAX_LEVEL
>  	    6 - detail
>  	    7 - debug
>  
> +config LOG_CONSOLE
> +	bool "Allow log output to the console"
> +	depends on LOG
> +	default y
> +	help
> +	  Enables a log driver which writes log records to the
> console.
> +	  Generally the console is the serial port or LCD display.
> Only the
> +	  log message is shown - other details like level, category,
> file and
> +	  line number are omitted.
> +
> +config LOG_SPL_CONSOLE
> +	bool "Allow log output to the console in SPL"
> +	depends on LOG_SPL
> +	default y
> +	help
> +	  Enables a log driver which writes log records to the
> console.
> +	  Generally the console is the serial port or LCD display.
> Only the
> +	  log message is shown - other details like level, category,
> file and
> +	  line number are omitted.
> +
>  endmenu
>  
>  config DEFAULT_FDT_FILE
> diff --git a/common/Makefile b/common/Makefile
> index f4b632761fa..14166209fe4 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -129,5 +129,6 @@ obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o
> cli_readline.o obj-$(CONFIG_CMD_DFU) += dfu.o
>  obj-y += command.o
>  obj-$(CONFIG_$(SPL_)LOG) += log.o
> +obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
>  obj-y += s_record.o
>  obj-y += xyzModem.o
> diff --git a/common/log_console.c b/common/log_console.c
> new file mode 100644
> index 00000000000..5af73bd8be4
> --- /dev/null
> +++ b/common/log_console.c
> @@ -0,0 +1,23 @@
> +/*
> + * Logging support
> + *
> + * Copyright (c) 2017 Google, Inc
> + * Written by Simon Glass <sjg@chromium.org>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <log.h>
> +
> +static int log_console_emit(struct log_device *ldev, struct log_rec
> *rec) +{
> +	puts(rec->msg);
> +
> +	return 0;
> +}
> +
> +LOG_DRIVER(console) = {
> +	.name	= "console",
> +	.emit	= log_console_emit,
> +};



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171121/de2ce3c2/attachment.sig>

  reply	other threads:[~2017-11-21  9:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 22:33 [U-Boot] [PATCH v3 00/14] log: Add a new logging feature Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 01/14] Revert "sandbox: remove os_putc() and os_puts()" Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 02/14] sandbox: Adjust pre-console address to avoid conflict Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 03/14] Revert "sandbox: Drop special case console code for sandbox" Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 04/14] Move debug and logging support to a separate header Simon Glass
2017-11-21  9:41   ` Lukasz Majewski
2017-11-20 22:33 ` [U-Boot] [PATCH v3 05/14] mtdparts: Correct use of debug() Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 06/14] Drop the log buffer Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 07/14] log: Add an implemention of logging Simon Glass
2017-11-21  9:55   ` Lukasz Majewski
2017-11-24  1:49     ` Simon Glass
2017-11-20 22:33 ` [U-Boot] [PATCH v3 08/14] log: Add a console driver Simon Glass
2017-11-21  9:57   ` Lukasz Majewski [this message]
2017-11-20 22:33 ` [U-Boot] [PATCH v3 09/14] log: Add a 'log level' command Simon Glass
2017-11-21  9:58   ` Lukasz Majewski
2017-11-20 22:33 ` [U-Boot] [PATCH v3 10/14] log: Add a test command Simon Glass
2017-11-21 10:00   ` Lukasz Majewski
2017-11-30  3:35   ` [U-Boot] [U-Boot,v3,10/14] " Tom Rini
2017-11-30 16:27     ` Simon Glass
2017-11-30 16:38       ` Tom Rini
2017-11-20 22:33 ` [U-Boot] [PATCH v3 11/14] log: Plumb logging into the init sequence Simon Glass
2017-11-21 10:01   ` Lukasz Majewski
2017-11-20 22:33 ` [U-Boot] [PATCH v3 12/14] log: sandbox: Enable logging Simon Glass
2017-11-21 10:01   ` Lukasz Majewski
2017-11-20 22:33 ` [U-Boot] [PATCH v3 13/14] log: test: Add a pytest for logging Simon Glass
2017-11-21 10:03   ` Lukasz Majewski
2017-11-20 22:33 ` [U-Boot] [PATCH v3 14/14] log: Add documentation Simon Glass
2017-11-21 10:19   ` Lukasz Majewski
2018-04-02  8:43     ` Simon Glass

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=20171121105702.4bbc609d@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.