Chinaunix首页 | 论坛 | 博客
  • 博客访问: 314493
  • 博文数量: 33
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1928
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-22 16:27
文章分类

全部博文(33)

文章存档

2015年(33)

分类: LINUX

2015-04-02 00:52:57

最近调试一个程序,需要频繁编译内核并下载到开发板运行,如果每次都烧写到nand flash太麻烦了,所以就想到了nfs,启动uboot试了一把,
竟然没有实现nfs命令,本来想移植一个的,但还是先干正事要紧,以后再来移植。所以就想到用tftp了。

tftp分为客户端和服务器,服务器提供数据,客户端从服务器下载。这里把CentOS 6.4 配置成服务器,开发板为客户端。

服务器配置如下:
1. 安装tftp服务

# yum install tftp
# yum install tftp-server

2. 配置服务器
# 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服务器目录,客户端从这个文件夹里下载数据
        disable                 = no                            // 改  使能tftp服务器
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

3. 验证tftp服务器
验证tftp服务器是否可以正常使用,利用自环下载数据,首先在/nfsdir/tftpboot放入zImage文件

# tftp 127.0.0.1
tftp> get zImage
tftp> q
正常的话,zImage会被下载到当前文件夹下


客户端使用:

启动开发板,进入uboot模式,输入下面命令:
> tftp 0x30008000 zImage
> bootm 0x30008000
## Booting image at 30008000 ...
Bad Magic Numbe
竟然不能启动,猜想可能是因为缺少某些启动信息,于是换成uImage(是uboot专用的映像文件,它是在zImage之前加上一个长度为64字节的“头”,说明这个内核的版本、加载位置、生成时间、大小等信息;其0x40之后与zImage没区别;详请百度)

tftp 0x30008000 uImage
bootm 0x30008000
## Booting image at 30008000 ...
Bad Magic Numbe
还是不行,后来查看了一下原有的启动方式,是从0x30008000启动zImage镜像,因为uImage镜像比zImage多了64字节的”头“,所以猜想下载位置可能错了,正确的下载位置应该是 :
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...................

这次终于成功了


阅读(7779) | 评论(0) | 转发(3) |
给主人留下些什么吧!~~