xref: /openbmc/u-boot/doc/README.NetConsole (revision 1c27059a2f7158a9c9a8778535b030935d75179d)
168ceb29eSwdenk
268ceb29eSwdenkIn U-Boot, we implemented the networked console via the standard
368ceb29eSwdenk"devices" mechanism, which means that you can switch between the
468ceb29eSwdenkserial and network input/output devices by adjusting the 'stdin' and
568ceb29eSwdenk'stdout' environment variables. To switch to the networked console,
668ceb29eSwdenkset either of these variables to "nc". Input and output can be
768ceb29eSwdenkswitched independently.
868ceb29eSwdenk
9*2c8fe512SJoe HershbergerCONFIG_NETCONSOLE_BUFFER_SIZE - Override the default buffer size
10*2c8fe512SJoe Hershberger
11eedcd078SwdenkWe use an environment variable 'ncip' to set the IP address and the
12eedcd078Swdenkport of the destination. The format is <ip_addr>:<port>. If <port> is
13eedcd078Swdenkomitted, the value of 6666 is used. If the env var doesn't exist, the
14eedcd078Swdenkbroadcast address and port 6666 are used. If it is set to an IP
15eedcd078Swdenkaddress of 0 (or 0.0.0.0) then no messages are sent to the network.
167f51898cSJoe HershbergerThe source / listening port can be configured separately by setting
177f51898cSJoe Hershbergerthe 'ncinport' environment variable and the destination port can be
187f51898cSJoe Hershbergerconfigured by setting the 'ncoutport' environment variable.
19eedcd078Swdenk
20b1bf6f2cSwdenkFor example, if your server IP is 192.168.1.1, you could use:
21b1bf6f2cSwdenk
22b1bf6f2cSwdenk	=> setenv nc 'setenv stdout nc;setenv stdin nc'
23b1bf6f2cSwdenk	=> setenv ncip 192.168.1.1
24b1bf6f2cSwdenk	=> saveenv
25b1bf6f2cSwdenk	=> run nc
26b1bf6f2cSwdenk
27b1bf6f2cSwdenk
2868ceb29eSwdenkOn the host side, please use this script to access the console:
2968ceb29eSwdenk
30bcb6dd91SMike Frysinger	tools/netconsole <ip> [port]
3168ceb29eSwdenk
32bcb6dd91SMike FrysingerThe script uses netcat to talk to the board over UDP.  It requires you to
33bcb6dd91SMike Frysingerspecify the target IP address (or host name, assuming DNS is working). The
34bcb6dd91SMike Frysingerscript can be interrupted by pressing ^T (CTRL-T).
35b1bf6f2cSwdenk
36443feb74SIgor MarnatBe aware that in some distributives (Fedora Core 5 at least)
37443feb74SIgor Marnatusage of nc has been changed and -l and -p options are considered
38443feb74SIgor Marnatas mutually exclusive. If nc complains about options provided,
39443feb74SIgor Marnatyou can just remove the -p option from the script.
40443feb74SIgor Marnat
4125d6712aSwdenkIt turns out that 'netcat' cannot be used to listen to broadcast
42eedcd078Swdenkpackets. We developed our own tool 'ncb' (see tools directory) that
43eedcd078Swdenklistens to broadcast packets on a given port and dumps them to the
441c20e4a9SMike Frysingerstandard output.  It will be built when compiling for a board which
451c20e4a9SMike Frysingerhas CONFIG_NETCONSOLE defined.  If the netconsole script can find it
461c20e4a9SMike Frysingerin PATH or in the same directory, it will be used instead.
47b1bf6f2cSwdenk
4868ceb29eSwdenkFor Linux, the network-based console needs special configuration.
4968ceb29eSwdenkMinimally, the host IP address needs to be specified. This can be
5068ceb29eSwdenkdone either via the kernel command line, or by passing parameters
5168ceb29eSwdenkwhile loading the netconsole.o module (when used in a loadable module
5268ceb29eSwdenkconfiguration). Please refer to Documentation/networking/logging.txt
5368ceb29eSwdenkfile for the original Ingo Molnar's documentation on how to pass
5468ceb29eSwdenkparameters to the loadable module.
5568ceb29eSwdenk
5668ceb29eSwdenkThe format of the kernel command line parameter (for the static
5768ceb29eSwdenkconfiguration) is as follows:
5868ceb29eSwdenk
5968ceb29eSwdenk  netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
6068ceb29eSwdenk
6168ceb29eSwdenkwhere
6268ceb29eSwdenk
6368ceb29eSwdenk  src-port	source for UDP packets
6468ceb29eSwdenk		(defaults to 6665)
6568ceb29eSwdenk  src-ip	source IP to use
6668ceb29eSwdenk		(defaults to the interface's address)
6768ceb29eSwdenk  dev		network interface
6868ceb29eSwdenk		(defaults to eth0)
6968ceb29eSwdenk  tgt-port	port for logging agent
7068ceb29eSwdenk		(defaults to 6666)
7168ceb29eSwdenk  tgt-ip	IP address for logging agent
7268ceb29eSwdenk		(this is the required parameter)
7368ceb29eSwdenk  tgt-macaddr	ethernet MAC address for logging agent
7468ceb29eSwdenk		(defaults to broadcast)
7568ceb29eSwdenk
7668ceb29eSwdenkExamples:
7768ceb29eSwdenk
7868ceb29eSwdenk  netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
7968ceb29eSwdenk
8068ceb29eSwdenkor
8168ceb29eSwdenk
8268ceb29eSwdenk  netconsole=@/,@192.168.3.1/
8368ceb29eSwdenk
8468ceb29eSwdenkPlease note that for the Linux networked console to work, the
8568ceb29eSwdenkethernet interface has to be up by the time the netconsole driver is
8668ceb29eSwdenkinitialized. This means that in case of static kernel configuration,
8768ceb29eSwdenkthe respective Ethernet interface has to be brought up using the "IP
8868ceb29eSwdenkAutoconfiguration" kernel feature, which is usually done by defaults
8968ceb29eSwdenkin the ELDK-NFS-based environment.
9068ceb29eSwdenk
9168ceb29eSwdenkTo browse the Linux network console output, use the 'netcat' tool invoked
9268ceb29eSwdenkas follows:
9368ceb29eSwdenk
9468ceb29eSwdenk	nc -u -l -p 6666
9525d6712aSwdenk
9625d6712aSwdenkNote that unlike the U-Boot implementation the Linux netconsole is
9725d6712aSwdenkunidirectional, i. e. you have console output only in Linux.
98