歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> uboot中使用tftp命令下載

uboot中使用tftp命令下載

日期:2017/3/1 11:15:42   编辑:Linux編程
uboot 提供了tftp命令,可以連接到tftp服務器以下載文件
虛擬機Fedora9下,安裝tftp服務
yum install xinetd
yum install tftp tftp-sever
下面是我的tftp配置
  1. [root@localhost /]# cat /etc/xinetd.d/tftp
  2. # default: off
  3. # description: The tftp server serves files using the trivial file transfer \
  4. # protocol. The tftp protocol is often used to boot diskless \
  5. # workstations, download configuration files to network-aware printers, \
  6. # and to start the installation process for some operating systems.
  7. service tftp
  8. {
  9. socket_type = dgram
  10. protocol = udp
  11. wait = yes
  12. user = root
  13. server = /usr/sbin/in.tftpd
  14. server_args = -s /tftpboot -c
  15. disable = no
  16. per_source = 11
  17. cps = 100 2
  18. flags = IPv4
  19. }
server_args指定tftp的目錄,我這裡是一個鏈接,指向源碼的boot目錄
ln -s /opt/FriendlyARM/mini2440/linux-2.6.32.2/arch/arm/boot/ /tftpboot

然後將目錄權限增大一點,以防萬一
chmod 777 /tftpboot
chmod 777 /opt/FriendlyARM/mini2440/linux-2.6.32.2/arch/arm/boot/
還需將selinux關閉。在桌面菜單,系統--》管理--》selinux management ,將 Enforcing Mode 設置為 Disabled .
用命令serviceconf確認一下tftp服務有沒開啟,需將其打開

在開發板uboot下如果serverip不是主機ip需要
setenv serverip 192.168.1.116(我的fedora ip)

saveenv
另外,板子的一些環境變量如下
  1. EmbedSky> printenv
  2. bootcmd=nboot 0x32000000 kernel; bootm 0x32000000
  3. bootdelay=0
  4. baudrate=115200
  5. ethaddr=0a:1b:2c:3d:4e:5f
  6. ipaddr=192.168.1.6
  7. netmask=255.255.255.0
  8. mtdids=nand0=nandflash0
  9. mtdparts=mtdparts=nandflash0:256k@0(bios),128k(params),128k(toc),512k(eboot),1024k(logo),2m(kernel),-(root)
  10. filesize=0
  11. filesize+1=0
  12. fileaddr=30000000
  13. bootargs=noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
  14. serverip=192.168.1.116
  15. stdin=serial
  16. stdout=serial
  17. stderr=serial
  18. partition=nand0,0
  19. mtddevnum=0
  20. mtddevname=bios
  21. Environment size: 497/131068 bytes
此時使用tftp便可從虛擬機上下載文件了
比如
tftp 32000000 zImage
Copyright © Linux教程網 All Rights Reserved