Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC481C74A5B for ; Sat, 18 Mar 2023 21:46:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ACB0F84EEF; Sat, 18 Mar 2023 22:46:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y2x4+A9p"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 74BFC83CB1; Sat, 18 Mar 2023 22:46:46 +0100 (CET) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A0ED784EEF for ; Sat, 18 Mar 2023 22:46:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-qt1-x82d.google.com with SMTP id hf2so5156307qtb.3 for ; Sat, 18 Mar 2023 14:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679176002; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ivNjJOoVYu0nPbyh39wHeJjN3E4Dd5v9SNanU77KnE0=; b=Y2x4+A9pRh9EVu77UqkciWoDimFS2b6jlN+CmKWZqdnBZuvmm7CcMFArYuUfLl3MaP NKcM+dOkShj85vwx3ILVZTkyIap2+e+b+E5sJJyxZRfGWkMkF7AN/TKt1t6ceN0Lxhqa IN/bHX4t3opSR4SvCYw0kHBIb5ILTUpTGmysUzoWkIA6aPM6tNAJ5/c0ODh2KedqSc0B RZ6arWvIUpvyvUhjDmA1XkZto02I3tvA9YHitFtKTtmx10VjA/dVuUS2UBN/VVQ73UES EmlAzPrzLmfwPU7aTH/pSvMdGDzvMV4sGTy69+eOBOiFfRcexVklrEIMrjyl65qIE47L /Vug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679176002; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ivNjJOoVYu0nPbyh39wHeJjN3E4Dd5v9SNanU77KnE0=; b=kyAhiOiWbaryz/tx6/OYJfbsx0doOXSOut/1aXyp168fQ0HYM1UOowDfznP9cxssdo poDuY8lcX1uQXSLpMwJ3iqgDQEeQgezN74EIcfpC11cAQY+WoTsZNYTI2aB0c2CcPd97 xwJBtCNHiBvtL/xkuQ8PnmHhklR/t3yv9xiGx7+yXaVq+t9xn9ruOsWOlaGLep7u6h4x VDab2FQJgQaogTJ4wyYHLeIu7cEe806zP5Woi2MANIs51MHbsshD/UuQD3Yj7bU/dqJg 2qVe8Xq60XXgTEAAOfrp+cI1x22hMpC8GGs8kOTv+zxL+Gveqxqm1svL6WAf5EcMg0Vl fZPQ== X-Gm-Message-State: AO0yUKUvI0Bp4T7GAn3KaBcDPUGtJI7NGuXFwFXvzXhccbnu1OyJlqRx 4+MI9JySUvNDzIs1klc8VGE= X-Google-Smtp-Source: AK7set9Du78DUgzKgGIKpdZiNnE8AgNdE2iAYd6I5MzS1/gOvMYvj0fnG8xPYXOyZzv2hb/+yaLXAw== X-Received: by 2002:a05:622a:20e:b0:3dd:42d5:2410 with SMTP id b14-20020a05622a020e00b003dd42d52410mr4427321qtx.15.1679176002254; Sat, 18 Mar 2023 14:46:42 -0700 (PDT) Received: from localhost.localdomain (76-229-100-169.lightspeed.irvnca.sbcglobal.net. [76.229.100.169]) by smtp.gmail.com with ESMTPSA id c11-20020ac8660b000000b003bfd8e2ab40sm3804077qtp.16.2023.03.18.14.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 14:46:41 -0700 (PDT) From: Tony Dinh To: Joe Hershberger , Ramon Fried , U-Boot Mailing List Cc: Tom Rini , Stefan Roese , =?UTF-8?q?Pali=20Roh=E1r?= , Simon Glass , Tony Dinh , Daniel Golle , Philippe Reynes , Sean Anderson Subject: [PATCH] netconsole: various improvements Date: Sat, 18 Mar 2023 14:46:25 -0700 Message-Id: <20230318214626.28655-1-mibodhi@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean - 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 --- 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