手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

移植Linux 2.6.26到S3C2410(ARM9)

[日期:2009-10-11] 来源:eslxf.blog.51cto.com  作者:eslxf [字体:大 中 小]

3.        开发主机TFTP、DHCP与NFS网络服务配置
3.1.      TFTP服务与测试
u-boot通过TFTP网络服务可快速下载u-boot、内核与文件系统文件,从而提高开发效率。按照下列步骤就可安装、配置好TFTP服务。
3.1.1.      获得下列软件包
从网络上下载TFTP服务主要依赖的下列软件包:
tftp-0.42-3.1.i386.rpm
tftp-server-0.42-3.1.i386.rpm
xinetd-2.3.14-8.i386.rpm
3.1.2.      安装软件包
[root@lxf tftp]# rpm -ivh *.rpm
warning: tftp-0.42-3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...          ########################################### [100%]
   1:tftp             ########################################### [ 33%]
   2:xinetd           ########################################### [ 67%]
   3:tftp-server      ########################################### [100%]
3.1.3.      修改配置文件
修改文件/etc/xinetd.d/tftp内容,把disable = yes修改为disable = no即可,文件具体内容参见清单3。
清单3 文件/etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
3.1.4.      启动TFTP服务
[root@lxf tftp]# service xinetd restart
停止 xinetd:                                              [失败]
启动 xinetd:                                              [确定]
 
3.1.5.      测试TFTP服务
采用清单4的步骤在开发主机测试配置的TFTP服务是否配置成功。
清单4 测试配置的TFTP服务

--------------------------------------------------------------------------------

//查看当前工作目录tftp下的文件信息
[root@lxf tftp]# ls
tftp tftp-0.42-3.1.i386.rpm tftp-server-0.42-3.1.i386.rpm xinetd-2.3.14-8.i386.rpm
//在tftp服务器的根目录/tftpboot下建立一个测试文件testtftp,文件内容为:
//This is a tftp test file!
[root@lxf tftp]# vi /tftpboot/testtftp
This is a tftp test file!
[root@lxf tftp]# vi /tftpboot/testtftp
//在本机上测试tftp服务器,下载testtftp文件到当前工作目录tftp下
[root@lxf tftp]# tftp 135.1.2.192
tftp> get testtftp
tftp> quit
//查看当前工作目录tftp下的文件信息
[root@lxf tftp]# ls
testtftp  tftp  tftp-0.42-3.1.i386.rpm  tftp-server-0.42-3.1.i386.rpm  xinetd-2.3.14-8.i386.rpm
// 文件testtftp下载成功,察看文件内容
[root@lxf tftp]# vi testtftp
This is a tftp test file!

--------------------------------------------------------------------------------

测试结果表明TFTP服务配制成功。
3.2.      DHCP服务
DHCP服务在开发环境中的主要作用是支持Linux内核通过网络根文件系统启动。开发主机通过DHCP服务为目标机提供各网络配置。按下列步骤安装、配置并启动DHCP服务。
3.2.1.      获得下列软件包
从网络上下载DHCP服务主要依赖的下列软件包:
dhcp-3.0.5-1.fc6.i386.rpm
dhcp-devel-3.0.5-1.fc6.i386.rpm
dhcpv6-0.10-32.fc6.i386.rpm
dhcpv6_client-0.10-32.fc6.i386.rpm
3.2.2.      删除已安装的冲突软件包
[root@lxf dhcp]# rpm -e --nodeps dhclient-3.0.6-10.fc8
[root@lxf dhcp]# rpm -e --nodeps dhcpv6-client-0.10-51.fc8
3.2.3.      安装软件包
[root@lxf dhcp]# rpm -ivh *.rpm
warning: dhcp-3.0.5-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...          ########################################### [100%]
   1:dhcp             ########################################### [ 25%]
   2:dhcp-devel       ########################################### [ 50%]
   3:dhcpv6           ########################################### [ 75%]
   4:dhcpv6_client    ########################################### [100%]
3.2.4.      修改配置文件
修改配置文件/etc/dhcpd.conf,具体内容参见清单5。
清单5 文件/etc/dhcpd.conf

--------------------------------------------------------------------------------

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style none;
allow bootp;
subnet 135.1.2.0 netmask 255.255.255.0{
        default-lease-time 1209600;
        max-lease-time 31557600;
        group{
                host 135.1.2.150{
                #hardware ethernet 00:00:C0:FF:EE:01;
                hardware ethernet 08:00:3e:26:0a:5b;
                fixed-address 135.1.2.150;
 
                option root-path "/arm-linux/rootfs/nfs-rootfs"
                }
        }
}

--------------------------------------------------------------------------------

 
3.2.5.      启动DHCP服务
[root@lxf dhcp]# service dhcpd restart
关闭 dhcpd:                                               [失败]
启动 dhcpd:                                               [确定]
 
3.3.      NFS服务配置与测试
NFS服务在开发环境中的主要作用是给通过网络根文件系统启动的Linux内核提供共享文件服务。操作系统Fedora 8安装时可选择安装与NFS相关的各软件包,按下列步骤配置就可使用NFS服务。
3.3.1.      设置NFS配置文件
设置NFS配置文件/etc/exports,导出NFS目录,具体配置参见清单6。
清单6 文件/etc/exports

--------------------------------------------------------------------------------

/arm-linux/rootfs/nfs-rootfs *(rw,sync,no_root_squash,no_all_squash)

--------------------------------------------------------------------------------

 
3.3.2.      启动NFS服务
[root@lxf tools]# service nfs restart
关闭 NFS mountd:                                          [失败]
关闭 NFS 守护进程:                                        [失败]
关闭 NFS quotas:                                          [失败]
关闭 NFS 服务:                                            [确定]
启动 NFS 服务:                                            [确定]
关掉 NFS 配额:                                            [确定]
启动 NFS 守护进程:                                        [确定]
启动 NFS mountd:                                          [确定]
 
3.3.3.      测试NFS服务
采用清单7的步骤在开发主机测试配置的NFS服务是否配置成功。
清单7 测试配置的NFS服务

--------------------------------------------------------------------------------

//重新输出NFS目录
[root@lxf tools]# exportfs -rv
exporting *:/arm-linux/rootfs/nfs-rootfs
//查看主机导出的NFS目录
[root@lxf tools]# showmount -e 135.1.2.192
Export list for 135.1.2.192:
/arm-linux/rootfs/nfs-rootfs *
//测试NFS
[root@lxf tools]# mkdir /mnt/nfs
[root@lxf tools]# ls /mnt/nfs
[root@lxf tools]# vi /arm-linux/rootfs/nfs-rootfs/testNFS
This is a NFS test file.
 
[root@lxf tools]# mount -t nfs 135.1.2.192:/arm-linux/rootfs/nfs-rootfs /mnt/nfs
[root@lxf tools]# ls /mnt/nfs
testNFS
[root@lxf tools]# cat /mnt/nfs/testNFS
This is a NFS test file.
[root@lxf tools]# rm /mnt/nfs/testNFS

--------------------------------------------------------------------------------

测试结果表明NFS服务配制成功。

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款