public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tony Dinh <mibodhi@gmail.com>
To: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Tom Rini" <trini@konsulko.com>, "Stefan Roese" <sr@denx.de>,
	"Pali Roh�r" <pali@kernel.org>, "Simon Glass" <sjg@chromium.org>,
	"Tony Dinh" <mibodhi@gmail.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Sean Anderson" <sean.anderson@seco.com>
Subject: [PATCH] netconsole: various improvements
Date: Sat, 18 Mar 2023 14:46:25 -0700	[thread overview]
Message-ID: <20230318214626.28655-1-mibodhi@gmail.com> (raw)

- When Netconsole is running, stdin/stdout/stderr are set to nc. Reset
stdin/stdout/stderr to serial (a sane deffault) before booting kernel.
- Enable net_timeout when netconsole starts will give a better user
experience if netconsole server is not running.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
---

 boot/bootm.c             | 16 +++++++++++++++-
 drivers/net/netconsole.c |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/boot/bootm.c b/boot/bootm.c
index 2eec60ec7b..c4a3aaf1bd 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -473,7 +473,21 @@ ulong bootm_disable_interrupts(void)
 	 */
 	iflag = disable_interrupts();
 #ifdef CONFIG_NETCONSOLE
-	/* Stop the ethernet stack if NetConsole could have left it up */
+	/*
+	 * Make sure that the starting kernel message printed out.
+	 * Reset stdin/out/err back to serial and stop the ethernet
+	 * stack if NetConsole could have left it up
+	 */
+	char *s;
+	int ret;
+
+	s = env_get("stdout");
+	if (strcmp(s, "nc") == 0) {
+		printf("\n\nStarting kernel ...\n");
+		ret = env_set("stdin", "serial");
+		ret = env_set("stdout", "serial");
+		ret = env_set("stderr", "serial");
+	}
 	eth_halt();
 #endif
 
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 151bc55e07..2091014918 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -20,7 +20,7 @@ static int input_size; /* char count in input buffer */
 static int input_offset; /* offset to valid chars in input buffer */
 static int input_recursion;
 static int output_recursion;
-static int net_timeout;
+static int net_timeout = 1;
 static uchar nc_ether[6]; /* server enet address */
 static struct in_addr nc_ip; /* server ip */
 static short nc_out_port; /* target output port */
-- 
2.30.2


             reply	other threads:[~2023-03-18 21:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 21:46 Tony Dinh [this message]
2023-03-19 19:30 ` [PATCH] netconsole: various improvements Simon Glass
2023-03-19 23:00   ` Tony Dinh
2023-03-19 19:36 ` Pali Rohár
2023-03-19 23:25   ` Tony Dinh
2023-03-20  8:00     ` Pali Rohár
2023-03-20 20:05       ` Tony Dinh

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=20230318214626.28655-1-mibodhi@gmail.com \
    --to=mibodhi@gmail.com \
    --cc=daniel@makrotopia.org \
    --cc=joe.hershberger@ni.com \
    --cc=pali@kernel.org \
    --cc=philippe.reynes@softathome.com \
    --cc=rfried.dev@gmail.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox