[PATCH 1/2] doc: Detailed example for netconsole setup

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 fiona.klute@gmx.de --- doc/usage/netconsole.rst | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..0c983e6970 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,32 @@ 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:: + + => env set autoload no + => env set hostname "u-boot" + => env set bootdelay 5 + => env set nc 'dhcp; env set stdout 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. -- 2.43.0

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 fiona.klute@gmx.de --- doc/usage/netconsole.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 0c983e6970..b5832843f3 100644 --- a/doc/usage/netconsole.rst +++ b/doc/usage/netconsole.rst @@ -24,9 +24,9 @@ can be used for network console.
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 + => env set nc 'env set stdout 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 -- 2.43.0

On 5/14/24 22:20, Fiona Klute wrote:
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 fiona.klute@gmx.de
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
doc/usage/netconsole.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 0c983e6970..b5832843f3 100644 --- a/doc/usage/netconsole.rst +++ b/doc/usage/netconsole.rst @@ -24,9 +24,9 @@ can be used for network console.
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
=> env set nc 'env set stdout 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
-- 2.43.0

Hi Fiona,
On Tue, May 14, 2024 at 5:28 PM Fiona Klute fiona.klute@gmx.de wrote:
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 fiona.klute@gmx.de
doc/usage/netconsole.rst | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..0c983e6970 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,32 @@ 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::
=> env set autoload no
=> env set hostname "u-boot"
=> env set bootdelay 5
=> env set nc 'dhcp; env set stdout nc; env set stdin nc'
We would need "env set stderr nc" here, too.
All the best, Tony
=> 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.
2.43.0

Am 15.05.24 um 21:05 schrieb Tony Dinh:
Hi Fiona,
On Tue, May 14, 2024 at 5:28 PM Fiona Klute fiona.klute@gmx.de wrote:
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 fiona.klute@gmx.de
doc/usage/netconsole.rst | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..0c983e6970 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,32 @@ 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::
=> env set autoload no
=> env set hostname "u-boot"
=> env set bootdelay 5
=> env set nc 'dhcp; env set stdout nc; env set stdin nc'
We would need "env set stderr nc" here, too.
Thanks, I guess I should add that to the existing description and example as well then. I'll test it and then send an update.
Best regards, Fiona

On 5/14/24 22:20, Fiona Klute wrote:
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 fiona.klute@gmx.de
doc/usage/netconsole.rst | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..0c983e6970 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,32 @@ 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::
Thanks for adding this information.
Prefixing lines with => makes copying harder. If you see value in showing the prompt, please, use
.. prompt:: bash =>
Best regards
Heinrich
- => env set autoload no
- => env set hostname "u-boot"
- => env set bootdelay 5
- => env set nc 'dhcp; env set stdout 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.
2.43.0

Am 17.05.24 um 09:32 schrieb Heinrich Schuchardt:
On 5/14/24 22:20, Fiona Klute wrote:
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 fiona.klute@gmx.de
doc/usage/netconsole.rst | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/usage/netconsole.rst b/doc/usage/netconsole.rst index 2aa3b9ccc5..0c983e6970 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,32 @@ 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::
Thanks for adding this information.
Prefixing lines with => makes copying harder. If you see value in showing the prompt, please, use
.. prompt:: bash =>
Good point, I've sent a v3 series to address this.
Best regards, Fiona
+ => env set autoload no + => env set hostname "u-boot" + => env set bootdelay 5 + => env set nc 'dhcp; env set stdout 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.
2.43.0
participants (3)
-
Fiona Klute
-
Heinrich Schuchardt
-
Tony Dinh