U-Boot的网络控制台netcon的使用
2016-01-06 12:13
519 查看
之前一直疑惑Linux下有netconsloe,那么U-Boot中的是否也有相应的工具使用,果然,发现了一个网络控制台的实现方法。
需要的工具:HerculesU-BOOT命令的源码:
#include <common.h>
#include <command.h>
#include <errno.h>
static int do_netcon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *s;
/* Our IP addr (0 = unknown) */
IPaddr_t NetOurIP;
/* NetConsole IP addr (0 = unknown) */
IPaddr_t NetConsoleIP;
s = getenv("ncip");
if (!s)
{
printf("Not set environment variable 'ncip',");
s = getenv("serverip");
if (!s){
printf(" please set it.\n");
return -EINVAL;
}
printf(" used serverip as ncip.\n");
run_command("set ncip ${serverip}", 0);
}
else
{
}
NetOurIP = getenv_IPaddr("ipaddr");
NetConsoleIP = getenv_IPaddr("ncip");
printf("NetConsole IP address %pI4; Our IP address is %pI4",
&NetConsoleIP, &NetOurIP);
setenv("stdin", "nc");
setenv("stdout", "nc");
setenv("stderr", "nc");
printf("NetConsole IP address %pI4; Our IP address is %pI4",
&NetConsoleIP, &NetOurIP);
return 0;
}
U_BOOT_CMD(netcon, 1, 0, do_netcon,
"To switch to the network console",
"\t- Just do: set stdin nc; set stdout nc; set stderr nc.\n"
"You must has set environment variable 'ncip' ,before execute netcon command."
);
使用方法:
1、打开Hercules程序,将界面调到 UDP 选项卡
2、在UDP选项卡上的配置参数上,Module IP设置为U-Boot上的IP,Port和Local Port个端口都设为6666,并点击Listen
3、将U-Boot中的服务端IP设置成Hercules软件所在机器的IP地址,然后在U-boot中运行netcon命令,就连上了
这个软件的貌似 Ctrl+C指令 不好用
相关文章推荐
- OkHttp的UI层回调封装
- 基于OkHttp的封装库TigerOkHttp的使用
- TCP通信流程解析
- 详解Nginx服务器中配置全站HTTPS安全连接的方法
- 用nginx搭建http/rtmp/hls协议的MP4/FLV流媒体服务器
- HttpPostedFile类 HttpPostedFile转字节bate
- HttpPostedFile类
- $_SERVER['HTTP_HOST']
- Web容器自动对HTTP请求中参数进行URLDecode处理
- TCP连接探测中的Keepalive 和心跳包
- 在Linux下,在网络没有配置好前,怎样查看网卡的MAC地址?
- Android OkHttp完全解析
- linux上网络配置不生效现象处理
- http请求417错误
- 深入理解HTTP Session
- Bacula网络备份环境搭建
- HttpClients 如何自动处理重定向
- python中http请求方法库汇总
- C#网络编程之同步异步
- 元旦闲得:网络流量的经济属性浅解