From patchwork Sat May 18 10:47:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Klute X-Patchwork-Id: 1936724 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=gmx.de header.i=fiona.klute@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=Bs2e6928; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VhRsn1dksz20d9 for ; Sun, 19 May 2024 01:03:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6E140885DF; Sat, 18 May 2024 17:03:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=gmx.de 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; secure) header.d=gmx.de header.i=fiona.klute@gmx.de header.b="Bs2e6928"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A956088670; Sat, 18 May 2024 12:47:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 401E688659 for ; Sat, 18 May 2024 12:47:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=fiona.klute@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1716029233; x=1716634033; i=fiona.klute@gmx.de; bh=if+/q1/kWFf+4AXjAgN2uak+z/GGyPW4ACxoTm2iYec=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID: MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Bs2e6928iQEy6byIHN0VlvvF0nQ5RCwclJkc/WHOat8iAMHTLWlcgucYgMKh6owT AMO1MbEw1Q/t4KnRUqbJkiHQX4ZexJ3Rfb3pagAYsIqhpahnSW0TpnrNM3TOg0gkx 6izlJcwcqxEPjK4Xlif4/bgYpUrvTKMwLxopQj9+zJ9R55nt+YabLq89PNlpXjlVq fcRiWPtZ8AGAmle2HSBZH5U5JsnI/LxLu5vMF4/60enQRaAX525yFllR2WvRN2YrX E+UpQY+ArIA4finfAczKJ4DzMRfZoCbhdlrMWzNOufKgtuafh9nh5P0BYq60UApMV OK1A6Og32DMwH8BZXg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from haruka.lan ([85.22.125.1]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1McpNo-1shtKN12Mk-00ZvGG; Sat, 18 May 2024 12:47:13 +0200 From: Fiona Klute To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Fiona Klute , Tony Dinh Subject: [PATCH v3 1/2] doc: Detailed example for netconsole setup Date: Sat, 18 May 2024 12:47:05 +0200 Message-ID: <20240518104706.25283-1-fiona.klute@gmx.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:YpAezzAH4iYJtC0+fJ+kcwXzVuHHeNZLLJtGQ4ZHIooXje5CiEr 6y9pluMH1eN/3tB12xS2ef5oHtIuZ42Nrh5kx9KyQQX3HQDeMC2SzubDbb8Mde3OUr4v/ri 17Y2q82nVxjIRTuBSi9nEVrP9ahgGqBIyRpMopBIkbUh5Bbd1UIugzO2ZUo8fZjVZLPZ5fA GrLc+25RNKi/WdICvDsQQ== UI-OutboundReport: notjunk:1;M01:P0:7aP60uQYSPQ=;neFgof8mNWZJ+KSFuTkmvjzAFu3 3+oNSZykNFDlcGvR+SOZWn9lXJOEQh2VpUc1gYjQCKVT7ANm+UGKf3CYvJh4/2HZrqkRqm0Ue 9JeYjn8JTcSOzbiLxy+dS2HU9Baxd526pVAUiACWTME/JNbHR8+Vs4s3A5qVBZZikZoTxoC5S WaFUR5tuqcj2sUw9rENeN1iIZgxmvdsuVenja+yKNVp4ZxJ9mJunMsYNWCxlsniNcm9qf7edb 6v85JCv/LlpyE6ItPqB5KyMRA3ip1+w90XU1vY1vhZA9fUHiRnBMcSE98JJIrPUbTHQ0w7PmA 3eGMq1NL5T5mICGImTvhpzo+ozs0TkmwAp3tVjn0HlN4KHWeKylG+/cl/BXs0Ik5GBWzIDACh xa+at5yzIH4ifG7s6SeYeCoFplWuYbv+yu5/xB/rfZpW8HK2clNPFbVzUjvEC4agL4aRFo6UX F3Mjq+mFTjPXaie2GLgTHYviEDyrpPlW/PoRfrGBn56ud4pWqzMJ+FHPGBRleD9gzbdvrVGc9 KX0l5EuWQViKHusV2/DUR90QE7teolqra9Nslavv3EAPBhVLXzMOPFdtd4/DgBpeAD433Nzi/ b22nD/JqiJrSj2YMgQqe5NB3GZOlWmasOZt9Qe76CzyD2ZpRZo8SGe2MwgWCUUV0r/WSUMAkw ykK1QW04UDoArEAO5wzbPbPS4qZcKftmC9QGgqtt7YAEaxMHmZ6cCJ5svZWKxFrpPRd+Vf8Gj yd2JpQHCpxGaTBvUAndA+vuyhczG9xGsK32psOdWUp0727hH/Q+duJjoYltXeodMVFh+flgbU q1KVQeZ+IXG3W4Bx7cYCk+fp09vBY9LXVcAlHdyzcgaw0= X-Mailman-Approved-At: Sat, 18 May 2024 17:03:12 +0200 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 This adds details that I would have liked to have readily available, in particular how to activate the network interface before enabling netconsole, and how to integrate netconsole so you can use the U-Boot prompt. Signed-off-by: Fiona Klute Reviewed-by: Tony Dinh --- Changes in v2: * Include stderr redirection * Use 4 spaces instead of tabs for code block to avoid overflowing lines Changes in v3: * Use ".. prompt::" to make copying example commands easier doc/usage/netconsole.rst | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) -- 2.43.0 diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..cb9a42d918 100644 --- a/doc/usage/netconsole.rst +++ b/doc/usage/netconsole.rst @@ -18,7 +18,9 @@ broadcast address and port 6666 are used. If it is set to an IP address of 0 (or 0.0.0.0) then no messages are sent to the network. The source / listening port can be configured separately by setting the 'ncinport' environment variable and the destination port can be -configured by setting the 'ncoutport' environment variable. +configured by setting the 'ncoutport' environment variable. Note that +you need to set up the network interface (e.g. using DHCP) before it +can be used for network console. For example, if your server IP is 192.168.1.1, you could use:: @@ -107,3 +109,34 @@ as follows: Note that unlike the U-Boot implementation the Linux netconsole is unidirectional, i. e. you have console output only in Linux. + +Setup via environment +--------------------- + +If persistent environment is enabled in your U-Boot configuration, you +can configure the network console using the environment. For example: + +.. prompt:: bash => + + env set autoload no + env set hostname "u-boot" + env set bootdelay 5 + env set nc 'dhcp; env set stdout nc; env set stderr nc; env set stdin nc' + env set ncip '192.168.1.1' + env set preboot "${preboot}; run nc;" + env save + reset + +``autoload no`` tells the ``dhcp`` command to configure the network +interface without trying to load an image. ``hostname "u-boot"`` sets +the hostname to be sent in DHCP requests, so they are easy to +recognize in the DHCP server log. The command in ``nc`` calls ``dhcp`` +to make sure the network interface is set up before enabling +netconsole. + +Adding ``nc`` to ``preboot`` tells U-Boot to activate netconsole +before trying to find any boot options, so you can interact with it if +desired. + +``env save`` stores the settings persistently, and ``reset`` then +triggers a fresh start that will use the changed settings. From patchwork Sat May 18 10:47:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Klute X-Patchwork-Id: 1936725 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=gmx.de header.i=fiona.klute@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=Ke0RNYSb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VhRsx5zp9z20d9 for ; Sun, 19 May 2024 01:03:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC0688865C; Sat, 18 May 2024 17:03:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=gmx.de 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; secure) header.d=gmx.de header.i=fiona.klute@gmx.de header.b="Ke0RNYSb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E8FBB88666; Sat, 18 May 2024 12:47:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C67988659 for ; Sat, 18 May 2024 12:47:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=fiona.klute@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1716029236; x=1716634036; i=fiona.klute@gmx.de; bh=mPcVaDOUPW0AmWpksa1C9euURhJhsb7sX7HocmQ0MPg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Ke0RNYSbgXSYJXMbIr587qTOqFurskl/strHiYuAL8y8O7AzQdBLf5IFXTpZtzsU KAJfNvj37Ko8AOVVcLBCX1Q4nIYX7InXxpw2tYnXFvl98HKURquvyi1Hi9lTv7hS6 rRQ8+yl+Snr7B6TggNE9TlqDONdFqxsxOLEoGsgyw6tKdFvglKBa7IrCuXJyhrYoF 647EAIpZzLwHu5u06qHYB7i+DpyFatneYljQC1aEWK/uSFqkzCiLkP6PEIoB4QvEP VSqt8UnPK/ZpVlG6wN+JZK1DrFQD4DFtwm0EfFBOUVA3fzUyp4TVtYUata0o5fPJx OGqERmdRkjXLFQ28/w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from haruka.lan ([85.22.125.1]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAfYw-1sEvQS1xY8-00B0Yo; Sat, 18 May 2024 12:47:16 +0200 From: Fiona Klute To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Fiona Klute , Tony Dinh Subject: [PATCH v3 2/2] doc: Update netconsole examples, mention stderr Date: Sat, 18 May 2024 12:47:06 +0200 Message-ID: <20240518104706.25283-2-fiona.klute@gmx.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240518104706.25283-1-fiona.klute@gmx.de> References: <20240518104706.25283-1-fiona.klute@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:7gFKoXYicd0+CxW1jBR3D5AsXF+h8EvsqZ5zIsyxAnHbe6h2mRK NQiQAkkCq9Jl8XQ3ZiTWeOOwXa6WDfdLN4FEh2rz55Q/K2SXEwHj5n/9+gCnYtCgdIulfE1 +Br1b02KCSoUqdsF8BIuVUIDq48c7/9DMIzqark10RTfSQOIhPOyDZju8W4aGI6ZmdXIrQT uz0GaFJi4PDfevMFnEk6w== UI-OutboundReport: notjunk:1;M01:P0:6qoUKCPsMdU=;G8EobCJ26Dh+k8cvo9EJde/hotH PXF3vTw+i4k28zK8ip/mAjO6f7L+MBdF38kCftpBDP5bGd8rTrAEpPCon7AVlOBLwYVBkmRKw 0GyYatljhmthJ9UKOqpURidnBaSqAj8ZByvY1S3m1aw2/aEQ+lonNF8g+9ckaez6D65mnTMKk tpCd14hsb+pg07jHXrP+FO5HtKvcX8nQWAhTAelurr7f5oBDP3624pUL5jbYdMPhHo0iSpDnH gLp6c8/27EVS4x513POB0H48KCk4gEU4Aa2tX+PUtYr8rzQvzFlx/tBKVXhU/ztD2cAZe8n14 v9bKVF4NgV9mPXI2me/uzAfyCwIxzEcDMYlV2d6GgZx9GnKtd63ZKfkdutAKRTFHdlUPvFGFC j12vM+Qqs9Pv400gPQ3W01PddmvaghLzybULQoF4IhJYOfTBbOdyklC/DvlscGozRsWSiVqqO oq3oHJxEs7bLZAIKzZkWFxepLx+wxqA055Srf/Ac3QxFuM8CfRAb5aTOCWxM9H+/EZLa8bNjs 1ADVgJLMEzhjIyei83seEdgbBtnhNEqFHaNRvB/7NUQzhF5uCJw/JxGxD4/l74ahoqSoB9mT/ +WrJplL12c1yYot1MCpZrddAQtwWWLTqRcbVvc4ZGIMqsNnKOw8hplEWXz0RA6YJ1bGB8/W9w HIFQjYmcyPyrZqwN3jyHHcwx+ZmJLEjcR7OL5aXAbx0FuPEFMu2MONcs3tQ7vsYMsI4L15Loa mjeRflWgUHLOlleWa223/16A4K2l8AoHj1/d44FYMvcovEKBzvuTmVEGNK1Ds0o1YF7RqSm/s Ln2xDhFTpauEiXJ5KOsK7dlU3mfTyrT+ByCWWUWXP8VDM= X-Mailman-Approved-At: Sat, 18 May 2024 17:03:12 +0200 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 Stderr was missing from the initial description and example. As I understand the env command documentation the subcommand style is preferred, though the old format is still fully supported. Signed-off-by: Fiona Klute Reviewed-by: Tony Dinh Reviewed-by: Heinrich Schuchardt --- Changes in v2: * Mention stderr redirection * Use 4 spaces instead of tabs for code block to avoid overflowing lines Changes in v3: * Use ".. prompt::" to make copying example commands easier doc/usage/netconsole.rst | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) -- 2.43.0 diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index cb9a42d918..df27b78342 100644 --- a/doc/usage/netconsole.rst +++ b/doc/usage/netconsole.rst @@ -3,10 +3,10 @@ Network console In U-Boot, we implemented the networked console via the standard "devices" mechanism, which means that you can switch between the -serial and network input/output devices by adjusting the 'stdin' and -'stdout' environment variables. To switch to the networked console, -set either of these variables to "nc". Input and output can be -switched independently. +serial and network input/output devices by adjusting the 'stdin', +'stdout', and 'stderr' environment variables. To switch to the +networked console, set either of these variables to "nc". Input and +output can be switched independently. The default buffer size can be overridden by setting CFG_NETCONSOLE_BUFFER_SIZE. @@ -22,12 +22,14 @@ configured by setting the 'ncoutport' environment variable. Note that you need to set up the network interface (e.g. using DHCP) before it can be used for network console. -For example, if your server IP is 192.168.1.1, you could use:: +For example, if your server IP is 192.168.1.1, you could use: - => setenv nc 'setenv stdout nc;setenv stdin nc' - => setenv ncip 192.168.1.1 - => saveenv - => run nc +.. prompt:: bash => + + env set nc 'env set stdout nc; env set stderr nc; env set stdin nc' + env set ncip '192.168.1.1' + env save + run nc On the host side, please use this script to access the console