Linux TFTP Setup
上一篇 / 下一篇 2009-04-21 15:29:30 / 个人分类:Linux
我的栏目
- 栏目:Linux
1 Setup Test Environment with TFTP
1.1 General setup about the environment:
Firstly, you should make sure the environment as below:
WUo^,E,Mu(I,c01. Setup tftp on server or on your personal PC using tftp tool51Testing软件测试网.W2NC3]]6|]`%M
Here is the detail on how to setup tftp on server
&A{Ic+pJ/?-z7h+D0You should plug the upper serial interface (another didn’t work!)
Ey2h yEO0Configure the tftp server51Testing软件测试网4y/~OC4x
# vi /etc/xinetd.d/tftp
Change thedisable = no
Configure the minicom like below:51Testing软件测试网H!}A5S\9S6j
# minicom –s
Then you pressOto configure the Serial Port Setup (you just need to change two of them) as below:
O Hj:FEjA0Serial Device: /dev/ttyS0
Bps/Par/Bits: 115200 8N1
Get the release package, then you do the actions like below:51Testing软件测试网"h x }5I?N-Y-a
# tar zxvf rootfs.tar.gz
# mv rootfs /
# vi /etc/exports
Add the contents: /rootfs *(rw,no_root_squash)
# mv zImage /tftpboot
# mv rootdemo.jffs2 /tftpboot
1.2 Download Redboot
1. Use real view ICE to download redboot
;??KQ [:s;eX0#The readboot has been setup in MX37 board
K ?S&h2D`0Use real ice include init_ddr.inc and press go after load completed51Testing软件测试网,d cN9p6vi]7q
2. Do "nand scan -o" under Redboot to force erase the whole 2GB NAND
CYe0g}F0flash and re-construct the bad block table.51Testing软件测试网t2u6KM+p]3hv7jd
# nand scan -o
3. Do "romupdate" under Redboot to save it into the NAND. -- This step51Testing软件测试网$q4Ns/O7\3m5Mv)K
is always needed after "nand scan -o" since the "scan" operation51Testing软件测试网+T'^MO7m7^+x\~
always erase everything including the Redboot itself.
Y0zM YzZ5L w0# romupdate
1.3 Boot up from nand flash
1. Configure the script. of the MX3751Testing软件测试网n)gT~g$l4P
# fconfig
Then you should make sure the script. like below(and you should make sure theLocal IP addressis our MX37 board IP, theDefault server IP addressis tftp server IP):51Testing软件测试网-S5UQ(qy
2. Burn the linux kernel
4R@?5n#~4_ g-{u0#fis init
#load -r -b 0x100000 zImage
s3^2gO`1}]0#fis create -f 0x200000 kernel 51Testing软件测试网5g r/w:f] L1A
--Set SW2 1, 4, 5 on to boot from Nand on personality board
!sB,|]? `0--Set SW2 all off to boot from Nor on personality board51Testing软件测试网 FN(SX&l8w
#fis create -f 0x100000 kernel 51Testing软件测试网%BKm8fA8}G#r l8x%B3e
3. Burn the linux rootfs51Testing软件测试网wV"L+n-R
#load -r -b 0x100000 rootfs.jffs2
#fis create -f 0x600000 rootfs.jffs2
Use fis list to confirm kernel/rootfs flash correctly.51Testing软件测试网A*Siq!j7jSi)K
3. use fconfig to change the boot script51Testing软件测试网3Qd)l?8tq7xg0P
#fconfig
_%B SHL$h0Run script. at boot:true51Testing软件测试网;\,vnxe.rfj7U
Boot script.:51Testing软件测试网.[(~0FbB
.. fis load kernel
@8pZ5La.k2x+yg?0.. exec -c "noinitrd console=ttymxc0 root=/dev/mtdblock7 rw ip=dhcp rootfstype=cramfs"51Testing软件测试网 Xh5H f!h V v
Enter script, terminate with empty line
+`:B6H*zo*u7X0fis load kernel;
b1Q G*j7Ys*q/y:B Q0e -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock2rw rootfstype=jffs2 ip=off"
fis load kernel51Testing软件测试网%sWW%yk2D.\ {
exec -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock8rw rootfstype=jffs2 ip=dhcp"
Boot script. timeout (1000ms resolution): 1
0]6G/De MS0Use BOOTP for network configuration:true
7W)oyWtQml0Default server IP address:
xbj1a,k3P0Board specifics: 0
)aG{e3p0Console baud rate: 11520051Testing软件测试网:J'T m[ A
Set eth0 network hardware address [MAC]: false51Testing软件测试网8^.nr1x? B2Z
GDB connection port: 900051Testing软件测试网 a1W:q2Jp$|:k!H
Force console for special debug messages: false51Testing软件测试网y I`GJ
Network debug at boot time: false51Testing软件测试网#T$^GV+[hj8}
Update RedBoot non-volatile configuration - continue (y/n)?y
... Read from 0x07ee0000-0x07eff000 at 0xa1fe0000: .
9NE{;x4{(p+D0... Erase from 0xa1fe0000-0xa2000000: .51Testing软件测试网3^6k(U.Y@Q
... Program from 0x07ee0000-0x07f00000 at 0xa1fe0000: .51Testing软件测试网vg~a$r@1z
Reset51Testing软件测试网u)LWctU2I(H
1.4 Boot up from nfs server
If you want to boot up from nfs server, please use the script.
Tp(VDfW:N0#fconfig51Testing软件测试网'oY[%sW7ie)B
Run script. at boot:true
;k ~C D,R }i5I6L0Boot script.:51Testing软件测试网d/K~:j"d
.. fis load kernel
:J#}KM*cx,@"anCj0.. exec -c "noinitrd console=ttymxc0 root=/dev/mtdblock7 rw ip=dhcp rootfstype=cramfs"
%K9l5H0A*V!x,U0Enter script, terminate with empty line
1QJ*@ R:s5L0>>fis load kernel
>>e -c "noinitrd console=ttymxc0 root=/dev/nfs nfsroot=xx.xx.xx.xx:/rootfs/Release/imx37demo_rootfs rw ip=dhcp"
>>
Boot script. timeout (1000ms resolution): 151Testing软件测试网-I2e9I/TX:f*`y R&Q/`
Use BOOTP for network configuration:true
$G-an4W"g0Default server IP address:xx.xx.xx.xx
F+sT#NGYn0Board specifics: 0
b v^(Gwa jyj0Console baud rate: 11520051Testing软件测试网t3sf[Yh
Set eth0 network hardware address [MAC]: false
8\$o+ec{qQ0GDB connection port: 9000
qocx.q2n.S|x0Force console for special debug messages: false51Testing软件测试网 d2T%N8]&OW3i|
Network debug at boot time: false51Testing软件测试网f2B%n:`r
Update RedBoot non-volatile configuration - continue (y/n)?y
... Read from 0x07ee0000-0x07eff000 at 0xa1fe0000: .
K-CK5j}m)HU0... Erase from 0xa1fe0000-0xa2000000: .51Testing软件测试网+\#A nq4n.E+tg
... Program from 0x07ee0000-0x07f00000 at 0xa1fe0000: .51Testing软件测试网q6XfO`
Reset
)p1Z8x0Jr~oJ02 Ubuntu下安装tftp服务器的步骤
51Testing软件测试网
a~&Uy0@ j sReference:http://www.oklinux.cn/html/network/ser/20080301/47786.html
1、首先在Ubuntu下安装server与client51Testing软件测试网Glg~ ^h%S
51Testing软件测试网C/|]~8P~];n"V打开Ubuntu的终端,输入以下命令:51Testing软件测试网#Nt8TFTaa;J(v~w
sudo apt-get install tftpd-hpa tftp-hpa
A:r5Kj$T?02、删除standalone的启动方式51Testing软件测试网T0t(?Qn
^
Yag#O
update-rc.d -f tftpd-hpa remove
3、新建用户tftpd及其主目录
?q#mi?w5Z,@w0sudo mkdir -p /home/tftpd
h?2U;ucF,}0sudo useradd -s /bin/false -g nogroup -d /home/tftpd [-p PASSWORD] tftpd
!cJ?K+v2LZ v0示例:sudo useradd -s /bin/false -g nogroup -d /home/tftpd tftpd51Testing软件测试网;v0[w{(L+NW
加密码:sudo useradd -s /bin/false -g nogroup -d /home/tftpd tftpd -p 12345651Testing软件测试网"vZ7~t`6n
*W:Bu cU0install xinetd
sudo apt-get install xinetd
%A;F)o v?5{o04.配置一下/etc/default/tftpd-hpa,就可以了
3B~(xCa$l,AH0#Defaults for tftpd-hpa
Q7qjC+k/A'b0RUN_DAEMON="yes"51Testing软件测试网,Y%yp"v5`5nnHv:t
OPTIONS="-l -s /home/ttk/tftpboot"51Testing软件测试网8r0_T;nzr
5cn2qyHxL.Fu0
7p0x5[+WWvpf6]9z05、新建xinetd启动文件
/\};d'V'?%Q0cat /etc/xinetd.d/tftpd
]k~PK
Z:P:v0service tftp
oOQ$? @`)n0{
r"a$K}P2I8b0disable = no
Jj2Q$gs"x
gD0socket_type = dgram51Testing软件测试网/azG2| tc:stBx
wait = no
-K9Z7t1eTy,rJ0user = root
,yn;i,D{'o;_;CK0protocol = udp51Testing软件测试网 nVt_nJ;aD@D
server = /usr/sbin/in.tftpd
_`?
l#?#rtg"cic0server_args = -s /home/tftpd -p -c -U 077 -u tftpd #//表示tftp操作目录在/home/tftpd上51Testing软件测试网
jc9Fa5kM
log_on_success = PID HOST DURATION
nr*U#\/M
j0log_on_failure = HOST
t:?8q&Tr5J)Td0}
e%KSP1KX0
5|-E^5s#OG4c7@!c06、注释掉/etc/inetd.conf文件中tftpd启动51Testing软件测试网2u$n-VA,^ ~b"G%l-^
#tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot51Testing软件测试网+|ptl
KU(B8F
G1Lx-v"V9T [ap0if you have other network connections, such as WiFi, dual-eth cards, pls shutdown the others if tftp is not working.
5h(n&B"uL*V0:d1]I/Be8Na07、重新启动xinetd服务
j1vH
M(`Yl$i0sudo /etc/init.d/xinetd restart
8、测试tftpd服务是否成功51Testing软件测试网?6_LZ(qZn
tftp localhost51Testing软件测试网)wafrv+]
tftp> put 123.log
,` N+N/Kg_%Uc0tftp> put 123.log test.log