linux主机上用tftp做开发板移植

一、Linux主机上安装配置tftp

1.安装

sudo apt-get install tftpd-hpa tftp-hpa

tftpd-hpa是服务端程序,tftp-hpa是客户端程序。

开发板的Bootloaer上已经有了tftp-client,所只需要配置主机上的tftp。


2.配置

sudo gedit /etc/default/tftpd-hpa

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/opt/tftpboot" //填入你的tftp服务目录

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s"

选项参考

OPTIONS

-l

 Run the server in standalone (listen) mode, rather than run from inetd. In listen mode, the -t option is ignored, and the -a option can be used to specify a specific local address or port to listen to.

-a [address][:port]

Specify a specific address and port to listen to when called with the -l option. The default is to listen to the tftp port specified in /etc/services on all local addresses.listen ip address Port

-c

Allow new files to be created. By default, tftpd will only allow upload of files that already exist. Files are created with default permissions allowing anyone to read or write them, unless the -p or -U options are specified.

-s

 (决定tftp根目录)Change root directory on startup. This means the remote host does not need to pass along the directory as part of the transfer, and may add security. When -s is specified, exactly one directory should be specified on the command line. The use of this option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request.


重启OK

注意:10.04以下的版本用下面的配置

RUN_DAEMON="yes"

OPTIONS="-l -c -s /tftpboot"


3.启动服务

sudo service tftpd-hpa restart

其实tftp-server服务安装TFTP后就自动启动,并且重启电脑时也是自动启动的。

4.测试

sudo mkdir /opt/tftpboot

sudo chmod 777 /opt/tftpboot                 #如果不进行此项权限设置,则其他用户可以get,但put时发生permission denied

cd /opt/tftpboot

sudo touch tftp_down.txt


echo i am an tftp download test doc! > tftp_down.txt


cd ~/

tftp localhost

get test.txt

同理!put一个tftp_up文件上去测试.

 

5.把下面4个bin文件放到/opt/tftpboot中,且文件名必须是下面的格式,因为这是开发板下载这四个文件时所要求的

u-boot.bin    #BootLoader

zImage.bin       #Linux Kernel

root.bin         #File System

logo.bin         #logon picture

 

二、系统移植

1.拔掉USB下载线,插上串口线,NorFlash启动开发板

 

#####Boot for Nor Flash Main Menu #####

#####EmbedSky USB download mode#####

[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash

[2] Download Eboot (eboot.nb0) to Nand Flash

[3] Download Linux Kernel (zImage.bin) to Nand Flash

[5] Download CRAMFS image to Nand Flash

[6] Download YAFFS image (root.bin) to Nand Flash

[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it

[8] Boot the system

[9] Format the Nand Flash

[0] Set the boot parameters

[a] Download User Program (eg: uCOS-II or TQ2440_Test)

[b] Download LOGO Picture (.bin) to Nand Flash

[l] Set LCD Parameters

[n] Enter TFTP download mode menu

[o] Download u-boot to Nor Flash

[r] Reboot u-boot

[t] Test Linux Image (zImage)

[q] quit from menu

选择n
接下来选择[5] Set TFTP parameters(PC IP,TQ2440 IP,Mask IP...)
Enter the TFTP Server(PC) IP address:(xxx.xxx.xxx.xxx)
192.168.1.8                              ;输入 PC 端的 IP 地址(可以是 Windows 的,也可以是 Linux 的),必须保证一点,该 IP 地址对应的 PC 的环境有 TFTP 服务器,有您想要烧写的镜像文件。
Enter the SKY2440/TQ2440 IP address:(xxx.xxx.xxx.xxx)
192.168.1.6                              ;输入 TQ2440 的 IP 地址
Enter the Mask IP address:(xxx.xxx.xxx.xxx)
255.255.255.0                            ;输入掩码
Save TFTP IP parameters?(y/n)
y                                        ;建议保存刚刚设置的参数,未完成移植之前若重启了开发板,这一项就不用重新设置了
完成网络设置后,使用命令 p 可以测试 TQ2440 和 PC 间的网络是否接通:
� 接通的信息:
Enter your selection: p
TQ2440 ping PC IP:ping 192.168.1.8
dm9000 i/o: 0x20000300, id: 0x90000a46
MAC: 0a:1b:2c:3d:4e:5f
host 192.168.1.8 is alive          ;表示已经连通
� 没有接通的信息:
Enter your selection: p
TQ2440 ping PC IP:ping 192.168.1.8
dm9000 i/o: 0x20000300, id: 0x90000a46
MAC: 0a:1b:2c:3d:4e:5f
ping failed; host 192.168.1.8 is not alive;表示没有连通
2.烧写
回到主菜单分别选择
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash
[3] Download Linux Kernel (zImage.bin) to Nand Flash
[6] Download YAFFS image (root.bin) to Nand Flash
[b] Download LOGO Picture (.bin) to Nand Flash

3.设置从Yaffs文件系统启动
因为之前可能设置的是从NFS启动文件系统,所以导致从NandFlash启动时显示开机画面后无法进入文件系统(如果此时主机上NFS没有配置好的话)。
从主菜单选择[0] Set the boot parameters
然后选择[2] Set Yaffs boot parameter 

然后选择[s] Save the parameters to Nand Flash就可以了

posted @ 2011-01-10 09:33  高性能golang  阅读(4386)  评论(0编辑  收藏  举报