Net console in Uboot

 

 

[转自:http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:netconsole]

If you are deploying a system, which has no UART connected to it, or is not practical to connect, you can use the network console.

In U-Boot, the network console is implemented via the standard “devices” mechanism, which means that you can switch between the serial and network input/output devices by adjusting the 'stdin' and 'stdout' environment variables. To switch to the networked console, set either of these variables to nc. Input and output can be switched independently.

The environment variable ncip controls the IP address and the port of the destination host.

The format is <ip_addr>:<port>. If <port> is omitted, port 6666 is used.

If the environment variable does not exist, the broadcast address and port 6666 are used.

If it is set to an IP address of 0 (or 0.0.0.0) then no messages are sent to the network.

==============================

1. Enabling NetConsole
To add NetConsole support to U-Boot, just add the following like to the board config.h file:

#define CONFIG_NETCONSOLE 1

If you want to have it used when booting a system, then you probably want to use the setting:

#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1

See also the CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE setting. These are documented in the toplevel README file for more information.

2. Using NetConsole
U-Boot Devices

First you need to tell U-Boot who to talk to:

bfin> set ncip 192.168.0.2

Then you have to tell U-Boot to actually use the network:

bfin> set stdin nc; set stdout nc; set stderr nc


Host Machine
On the machine U-Boot is now configured to talk to, you need to setup a program to listen and transmit.

Netcat tends to be a pretty common program on Linux machines and is perfect for the task.

Make sure you have it installed in your host distribution first.

There is a helper script in the U-Boot source tree called netconsole.

Assuming you're using the default netconsole settings, you can do:

$ ./tools/netconsole 192.168.0.15
NOTE: the interrupt signal (normally ^C) has been remapped to ^T
bfin> bdinfo
bdinfo
U-Boot      = U-Boot 1.1.6-svn1026 (ADI-2007R2-pre) (Nov 15 2007 - 13:08:49)
CPU         = bf537-0.2
Board       = bf537-stamp
VCO         = 500 MHz
CCLK        = 500 MHz
SCLK        = 100 MHz
boot_params = 0x00000000
memstart    = 0x00000000
memsize     = 0x04000000
flashstart  = 0x20000000
flashsize   = 0x00400000
flashoffset = 0x00000000
ethaddr     = 00:E0:22:FE:44:EC
ip_addr     = 192.168.0.15
baudrate    = 57600 bps
bfin> print ncip
print ncip
ncip=192.168.0.17

 

============总结测试步骤===================

#define CONFIG_NETCONSOLE 1
Rebuild and reflash your image.
Then tell uboot where your desktop is and redirect the console.

uboot> set ncip 192.168.1.4
uboot> set stdin nc; set stdout nc
Start nc (network cat) on your desktop.

jonsmirl@terra:/home/apps/u-boot$ nc -u -l -p 6666 < /dev/null &
[1] 5444
jonsmirl@terra:/home/apps/u-boot$ nc -u 192.168.1.11 6666
And now you're connected. Next I have to figure out how to make this the boot default.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值