u-boot和linux下的netconsole

參考

uboot下netconsole的原理及使用方法
uboot下的網絡終端/控制檯

u-boot

設置環境變量nc,設置CONFIG_NETCONSOLE_BUFFER_SIZE覆蓋默認緩衝區大小,設置環境變量ncip爲通信對端ip,格式爲<ip_addr>:<port><port>不設置時爲默認值6666,發送端口和接收端口可以分別設置,ncinportncoutport

=> 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章