mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] console: print banner on every fully activated console
Date: Mon, 27 Oct 2025 07:08:50 +0100	[thread overview]
Message-ID: <20251027060850.2376494-1-a.fatoum@barebox.org> (raw)

On systems with multiple consoles, the first console is usually
activated via device trees and the others later via board code.

The later consoles don't get previous log replayed and it can thus be
hard to determine when the log starts when the console remains open
between reboots.

Improve upon this by printing out the barebox prompt whenever a console
is switching from deactivated to ioe. We don't actually require input,
but checking for input allows users to disable this by first switching
to oe, then ioe.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 common/console.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/console.c b/common/console.c
index 95e5fb4df33c..aa2013c51522 100644
--- a/common/console.c
+++ b/common/console.c
@@ -83,6 +83,7 @@ int console_close(struct console_device *cdev)
 
 int console_set_active(struct console_device *cdev, unsigned flag)
 {
+	unsigned flag_new = flag & ~cdev->f_active;
 	int ret;
 
 	if (!cdev->getc)
@@ -117,6 +118,10 @@ int console_set_active(struct console_device *cdev, unsigned flag)
 		barebox_banner();
 		while (kfifo_getc(console_output_fifo, &ch) == 0)
 			console_putc(CONSOLE_STDOUT, ch);
+	} else if (IS_ENABLED(CONFIG_BANNER) && cdev->puts &&
+		   flag_new == CONSOLE_STDIOE) {
+		cdev->puts(cdev, version_string, strlen(version_string));
+		cdev->puts(cdev, "\n\n", 2);
 	}
 
 	return 0;
-- 
2.47.3




             reply	other threads:[~2025-10-27  6:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27  6:08 Ahmad Fatoum [this message]
2025-10-28  8:25 ` Sascha Hauer

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=20251027060850.2376494-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox