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