参考
u-boot
设置环境变量nc
,设置CONFIG_NETCONSOLE_BUFFER_SIZE
覆盖默认缓冲区大小,设置环境变量ncip
为通信对端ip,格式为<ip_addr>:<port>
,<port>
不设置时为默认值6666
,发送端口和接收端口可以分别设置,ncinport
和ncoutport
,
=> setenv nc 'setenv stdout nc;setenv stdin nc'
=> setenv ncip 192.168.1.1
=> saveenv
=> run nc
主机端,使用命令
$ tools/netconsole <ip> [port]
netcat无法接收广播包,使用u-boot/tools中的ncb,
linux
通过cmdline或者动态加载模块指定参数Documentation/networking/logging.txt
的方式,linux的netconsole只有输出没有输入。
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
where
src-port source for UDP packets
(defaults to 6665)
src-ip source IP to use
(defaults to the interface's address)
dev network interface
(defaults to eth0)
tgt-port port for logging agent
(defaults to 6666)
tgt-ip IP address for logging agent
(this is the required parameter)
tgt-macaddr ethernet MAC address for logging agent
(defaults to broadcast)
Examples:
netconsole=[email protected]/eth1,[email protected]/12:34:56:78:9a:bc
or
netconsole=@/,@192.168.3.1/
主机端nc
,
nc -u -l -p 6666