1Network console
2===============
3
4In U-Boot, we implemented the networked console via the standard
5"devices" mechanism, which means that you can switch between the
6serial and network input/output devices by adjusting the 'stdin' and
7'stdout' environment variables. To switch to the networked console,
8set either of these variables to "nc". Input and output can be
9switched independently.
10
11The default buffer size can be overridden by setting
12CONFIG_NETCONSOLE_BUFFER_SIZE.
13
14We use an environment variable 'ncip' to set the IP address and the
15port of the destination. The format is <ip_addr>:<port>. If <port> is
16omitted, the value of 6666 is used. If the env var doesn't exist, the
17broadcast address and port 6666 are used. If it is set to an IP
18address of 0 (or 0.0.0.0) then no messages are sent to the network.
19The source / listening port can be configured separately by setting
20the 'ncinport' environment variable and the destination port can be
21configured by setting the 'ncoutport' environment variable.
22
23For example, if your server IP is 192.168.1.1, you could use::
24
25	=> setenv nc 'setenv stdout nc;setenv stdin nc'
26	=> setenv ncip 192.168.1.1
27	=> saveenv
28	=> run nc
29
30On the host side, please use this script to access the console
31
32.. code-block:: bash
33
34	tools/netconsole <ip> [port]
35
36The script uses netcat to talk to the board over UDP.  It requires you to
37specify the target IP address (or host name, assuming DNS is working). The
38script can be interrupted by pressing ^T (CTRL-T).
39
40Be aware that in some distributives (Fedora Core 5 at least)
41usage of nc has been changed and -l and -p options are considered
42as mutually exclusive. If nc complains about options provided,
43you can just remove the -p option from the script.
44
45It turns out that 'netcat' cannot be used to listen to broadcast
46packets. We developed our own tool 'ncb' (see tools directory) that
47listens to broadcast packets on a given port and dumps them to the
48standard output.  It will be built when compiling for a board which
49has CONFIG_NETCONSOLE defined.  If the netconsole script can find it
50in PATH or in the same directory, it will be used instead.
51
52For Linux, the network-based console needs special configuration.
53Minimally, the host IP address needs to be specified. This can be
54done either via the kernel command line, or by passing parameters
55while loading the netconsole.o module (when used in a loadable module
56configuration). Please refer to Documentation/networking/logging.txt
57file for the original Ingo Molnar's documentation on how to pass
58parameters to the loadable module.
59
60The format of the kernel command line parameter (for the static
61configuration) is as follows
62
63.. code-block:: bash
64
65    netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
66
67where
68
69src-port
70    source for UDP packets (defaults to 6665)
71
72src-ip
73    source IP to use (defaults to the interface's address)
74
75dev
76    network interface (defaults to eth0)
77
78tgt-port
79  port for logging agent (defaults to 6666)
80
81tgt-ip
82  IP address for logging agent (this is the required parameter)
83
84tgt-macaddr
85    ethernet MAC address for logging agent (defaults to broadcast)
86
87Examples
88
89.. code-block:: bash
90
91  netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
92  netconsole=@/,@192.168.3.1/
93
94Please note that for the Linux networked console to work, the
95ethernet interface has to be up by the time the netconsole driver is
96initialized. This means that in case of static kernel configuration,
97the respective Ethernet interface has to be brought up using the "IP
98Autoconfiguration" kernel feature, which is usually done by defaults
99in the ELDK-NFS-based environment.
100
101To browse the Linux network console output, use the 'netcat' tool invoked
102as follows:
103
104.. code-block:: bash
105
106	nc -u -l -p 6666
107
108Note that unlike the U-Boot implementation the Linux netconsole is
109unidirectional, i. e. you have console output only in Linux.
110