tftp服务器怎么开启linux,CentOS 6.4 tftp服务器配置--使用tftp下载并启动内核
最近調(diào)試一個程序,需要頻繁編譯內(nèi)核并下載到開發(fā)板運行,如果每次都燒寫到nand flash太麻煩了,所以就想到了nfs,啟動uboot試了一把,
竟然沒有實現(xiàn)nfs命令,本來想移植一個的,但還是先干正事要緊,以后再來移植。所以就想到用tftp了。
tftp分為客戶端和服務(wù)器,服務(wù)器提供數(shù)據(jù),客戶端從服務(wù)器下載。這里把CentOS 6.4 配置成服務(wù)器,開發(fā)板為客戶端。
服務(wù)器配置如下:
1. 安裝tftp服務(wù)
# yum install tftp
# yum install tftp-server
2. 配置服務(wù)器
# vim /etc/xinetd.d/tftp
service tftp
{
socket_type ? ? ? ? ? ? = dgram
protocol ? ? ? ? ? ? ? ?= udp
wait ? ? ? ? ? ? ? ? ? ?= yes
user ? ? ? ? ? ? ? ? ? ?= root
server ? ? ? ? ? ? ? ? ?= /usr/sbin/in.tftpd
server_args ? ? ? ? ? ? = -s /nfsdir/tftpboot ? ?// 改 ? tftp服務(wù)器目錄,客戶端從這個文件夾里下載數(shù)據(jù)
disable ? ? ? ? ? ? ? ? = no ? ? ? ? ? ? ? ? ? ? ? ? ? ?// 改 ?使能tftp服務(wù)器
per_source ? ? ? ? ? ? ?= 11
cps ? ? ? ? ? ? ? ? ? ? = 100 2
flags ? ? ? ? ? ? ? ? ? = IPv4
}
3. 驗證tftp服務(wù)器
驗證tftp服務(wù)器是否可以正常使用,利用自環(huán)下載數(shù)據(jù),首先在/nfsdir/tftpboot放入zImage文件
# tftp 127.0.0.1
tftp> get zImage
tftp> q
正常的話,zImage會被下載到當(dāng)前文件夾下
客戶端使用:
啟動開發(fā)板,進(jìn)入uboot模式,輸入下面命令:
>?tftp 0x30008000 zImage
>?bootm 0x30008000
## Booting image at 30008000 ...
Bad Magic Numbe
竟然不能啟動,猜想可能是因為缺少某些啟動信息,于是換成uImage(是uboot專用的映像文件,它是在zImage之前加上一個長度為64字節(jié)的“頭”,說明這個內(nèi)核的版本、加載位置、生成時間、大小等信息;其0x40之后與zImage沒區(qū)別;詳請百度)
>tftp 0x30008000uImage
>bootm 0x30008000
## Booting image at 30008000 ...
Bad Magic Numbe
還是不行,后來查看了一下原有的啟動方式,是從0x30008000啟動zImage鏡像,因為uImage鏡像比zImage多了64字節(jié)的”頭“,所以猜想下載位置可能錯了,正確的下載位置應(yīng)該是 :
0x30008000- 0x40 =?0x30007fc0
>tftp 0x30007fc0 uImage
>bootm 0x30007fc0
## Booting image at 30007fc0 ...
Image Name: ? Linux-2.6.30.4-EmbedSky
Created: ? ? ?2015-04-02 ? 4:44:59 UTC
Image Type: ? ARM Linux Kernel Image (uncompressed)
Data Size: ? ?2314836 Bytes = ?2.2 MB
Load Address: 30008000
Entry Point: ?30008000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux...................
這次終于成功了
總結(jié)
以上是生活随笔為你收集整理的tftp服务器怎么开启linux,CentOS 6.4 tftp服务器配置--使用tftp下载并启动内核的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 致新浪科技频道的一封公开信
- 下一篇: 学习indy组件