uboot中配置并使用tftp命令

使用 U-Boot 下载 Linux 内核或者应用程序的快捷的方法是通过网络传输。为了这一目的, U-Boot 实现了 TFTP 协议(参见 U-Boot 中的 tftpboot 命令)。
 
为了使主机支持 TFTP ,你必须确保 TFTP 后台程序 /usr/sbin/in.tftpd 已经安装。在 RedHat 系统中,你可以运行下面的命令来确认:
$ rpm -q tftp-server
如果没有安装,请从你的 Linux 安装盘或者其它媒介安装。
 
大多数的 Linux 发行版都默认关闭 TFTP 服务。以 RedHat 系统为例,如果要使能 TFTP 服务,编辑文件 /etc/xinetd.d/tftp ,移除这一行:
disable = yes
或者注释掉它:
# default: off
# description: The tftp server serves files using the trivial file transfer
#       protocol.  The tftp protocol is often used to boot diskless
#       workstations, download configuration files to network-aware printers,
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args           = -s /tftpboot //server端主目录
#       disable                 = yes
        per_source              = 11
        cps                     = 100 2
}
此外,确保 /tftpboot 目录存在,而且有访问权限(至少应该 "dr-xr-xr-x" )。
或者把disable = yes 改为 disable = no
这样就已经打开了主机linux中的tftp服务。下面我们可以用uboot的tftp命令来传输文件到目标板的ram中运行。
我们在目标板用命令printenv查看ip地址。
serverip 192.168.0.2 //主机ip
ipaddr 192.168.0.55  //目标机的ip
 
setenv命令可以修改主机和目标机的ip地址。
#setenv serverip 192.168.0.55  //该命令可设置主机ip,该命令只是把设置保存到ram中,如果重启的话设置会重新回到原来的设置。这时我们用saveenv命令把设置保存到flash中。
#saveenv
 
配置好各个参数后,我们在uboot命令窗口中使用tftp命令把内核,文件系统拷贝到ram中。
#tftp 30008000 zImage  //在主机 /tftpboot目录中的zImage文件下载到目标板内存的30008000地址中。
 
 
参考文章:http://blog.chinaunix.net/u1/35496/showart_272596.html
 
 
 
 

你可能感兴趣的:(职场,休闲)