为了在播放机上实现NFS服务器的功能,我们已经在uClibc中打开了完整RPC支持,并且在新编译的内核中打开了NFS服务器支持。此外还有两个软件包也是提供NFS服务所必需的:portmapnfs-utils。portmap为RPC程序提供端口映射服务,nfs-utils则是使用内核NFS服务器的支持程序。

编译portmap
1. 下载portmap_5beta: ftp://ftp.porcupine.org/pub/security/portmap_5beta.tar.gz
2. 打这个补丁: portmap_5beta.patch.zip (补丁来自buildroot-2009.11,我只是把多个补丁合并成一个)
3. $ make CC=mipsel-linux-gcc
4. $ mipsel-linux-strip portmap

编译nfs-utils
1. 下载nfs-utils-1.1.1: http://nchc.dl.sourceforge.net/project/nfs/nfs-utils/1.1.1/nfs-utils-1.1.1.tar.gz
2. 打这个补丁: nfs-utils-1.1.1-uclibc.patch.zip (在网上找到的,来源记不清了,我稍加了修改)
3. 运行配置脚本:

1 ./configure --build=i686-linux --host=mipsel-linux --disable-nfsv4 --disable-gss --disable-uuid --disable-mount --without-tcp-wrappers --with-gnu-ld CC=mipsel-linux-gcc CPP=mipsel-linux-cpp AR=mipsel-linux-ar STRIP=mipsel-linux-strip RANLIB=mipsel-linux-ranlib LD=mipsel-linux-ld

4. $ make
5. 安装到/home/user/dist/nfs-utils目录

1 $ make DESTDIR=/home/user/dist/nfs-utils install-strip

在制作固件时,我们只需要几个编译好的程序:portmap, rpc.statd, rpc.nfsd, rpc.mountd, exportfs。其中portmap 放到/sbin下,其余的放到/usr/sbin下。
此外还需要一个NFS服务启动脚本S60nfs,放在/etc/init.d目录下。下载脚本S60nfs.zip (来自buildroot,我把portmap的启动加进去了)

 1 #!/bin/sh                                
 2 #                                        
 3 # nfs           This shell script takes care of starting and stopping
 4 #               the NFS services. Stolen from RedHat FC5.            
 5 
 6 [ -x /sbin/portmap ] || exit 0
 7 [ -x /usr/sbin/rpc.statd ] || exit 0
 8 [ -x /usr/sbin/rpc.nfsd ] || exit 0 
 9 [ -x /usr/sbin/rpc.mountd ] || exit 0
10 [ -x /usr/sbin/exportfs ] || exit 0  
11 
12 # Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue.
13 [ -r /etc/exports ] || \                                                             
14     { touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \                 
15     { echo "/etc/exports does not exist" ; exit 0 ; }                                
16                                                                                      
17 # The /var/lib/nfs directory is actually on a tmpfs filesystem.                      
18 mkdir -p /var/lib/nfs/sm                                                             
19 mkdir -p /var/lib/nfs/sm.bak                                                         
20 touch /var/lib/nfs/etab                                                              
21 touch /var/lib/nfs/rmtab                                                             
22 touch /var/lib/nfs/state                                                             
23 touch /var/lib/nfs/xtab                                                              
24 
25 start() {
26         # Start daemons.
27         echo -n "Starting port mapper: "
28         portmap                         
29         echo "done"                     
30 
31         echo -n "Starting NFS statd: "
32         rpc.statd                     
33         touch /var/lock/subsys/nfslock
34         echo "done"                   
35 
36         echo -n "Starting NFS services: "
37         /usr/sbin/exportfs -r            
38         rpc.statd                        
39         echo "done"                      
40 
41         echo -n "Starting NFS daemon: "
42         rpc.nfsd 2                     
43         echo "done"                    
44 
45         echo -n "Starting NFS mountd: "
46         rpc.mountd                     
47         echo "done"                    
48         touch /var/lock/subsys/nfs     
49 }                                      
50 
51 stop() {
52         # Stop daemons.
53         echo -n "Shutting down NFS mountd: "
54         killall -q rpc.mountd               
55         echo "done"                         
56 
57         echo "Shutting down NFS daemon: "
58         kill -9 `pidof nfsd` 2>/dev/null 
59         echo "done"                      
60 
61         echo -n "Shutting down NFS services: "
62         /usr/sbin/exportfs -au                
63         rm -f /var/lock/subsys/nfs            
64         killall -q rpc.statd                  
65         echo "done"
66 
67         echo -n "Stopping NFS statd: "
68         killall -q rpc.statd
69         echo "done"
70         rm -f /var/lock/subsys/nfslock
71 
72         echo -n "Stopping port mapper: "
73         killall -q portmap
74         echo "done"
75 }
76 
77 # See how we were called.
78 case "$1" in
79   start)
80         start
81         ;;
82   stop)
83         stop
84         ;;
85   restart)
86         stop
87         start
88         ;;
89   reload)
90         /usr/sbin/exportfs -r
91         touch /var/lock/subsys/nfs
92         ;;
93   *)
94         echo "Usage: nfs {start|stop|reload}"
95         exit 1
96 esac
97 
98 exit 0
posted on 2010-03-23 16:24 gouzhuang 阅读(4774) 评论(4)  编辑 收藏 引用 所属分类: 嵌入式Linux

评论

# re: 编译portmap和nfs-utils 2010-03-23 21:58 ccc
继续关注中  回复  更多评论 
  

# re: 编译portmap和nfs-utils 2010-10-28 17:33 kwingart
ls, 如何在1073方案的海美迪300系列固件上实现nfs server啊,后续能出一个指南吗。谢谢分享。
kwing.guo@gmail.com  回复  更多评论 
  

# re: 编译portmap和nfs-utils 2013-05-04 23:15 xlx
这个portmap的补丁是为了解决那个
"cannot find any active local network interfaces"
的问题吗?如果是,希望博主放个修复了这个问题的编译好的portmap出来。  回复  更多评论 
  

# re: 编译portmap和nfs-utils 2013-08-14 10:27 nuc07
exportfs: /xx/xx/path does not support NFS export
运行exportfs时出现上面的提示会是什么原因  回复  更多评论 
  

编译portmap和nfs-utils的更多相关文章

  1. NFS资料

      Linux NFS服务器的安装与配置 http://www.cnblogs.com/mchina/archive/2013/01/03/2840040.html Linux NFS服务器的安装与配 ...

  2. 网络文件系统nfs文件系统使用(很全面)

    一.NFS简介 1.NFS就是Network FileSystem的缩写,它的最大功能就是可以通过网络让不同的机器,不同的操作系统彼此共享文件(sharefiles)——可以通过NFS挂载远程主机的目 ...

  3. 网络文件系统nfs文件系统使用(比较全面)

    一.NFS简介 1.NFS就是Network FileSystem的缩写,它的最大功能就是可以通过网络让不同的机器,不同的操作系统彼此共享文件(sharefiles)——可以通过NFS挂载远程主机的目 ...

  4. nfs服务器的搭建和使用

    目录 更新记录 1.nfs介绍 1.1 nfs概念 1.2 nfs工作原理 1.3 nfs通讯过程 2.搭建和测试 NFS 服务器 2.1 搭建NFS服务器 2.2 测试NFS服务器 3.在线调试:N ...

  5. centos7中nfs共享的配置方法

    NFS是Network File System的缩写,即网络文件系统.客户端通过挂载的方式将NFS服务器端共享的数据目录挂载到本地目录下. 一.nfs为什么需要RPC? 因为NFS支持的功能很多,不同 ...

  6. Linux NFS服务器的安装与配置

    一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操 ...

  7. 搭建NFS服务器

    1:yum install -y nfs-utils-* portmap-* 2:NFS安装完毕,需要创建共享目录,共享目录在vi /etc/exports文件里面配置,可配置参数如下: /data/ ...

  8. NFS 文件系统

    NFS的安装是非常简单的,只需要两个软件包即可,而且在通常情况下,是作为系统的默认包安装的. NFS服务的主要配置文件 /etc/exports /etc/exports文件内容格式: <输出目 ...

  9. Linux NFS 服务部署

    系统环境:Oracle Linux 5.7 服务端:192.168.1.111 客户端:192.168.1.171 一.服务端配置 二.客户端配置 一.服务端配置 1.依次启动portmap和nfs服 ...

随机推荐

  1. python 基础 2.1 if 流程控制(一)

    一.if  else 1.if 语句     if expression:   //注意if后有冒号,必须有        statement(s)     //相对于if缩进4个空格 注:pytho ...

  2. delphi视频聊天

    用Delphi开发视频聊天软件 一.引言 我们知道视频聊天软件的关键技术在于采集视频,并实时传输给聊天软件在线的人.对于视频的采集,这里采用微软公司的关于数字视频的一个软件包VFW(Video for ...

  3. SQLServer中游标实例介绍(转)

    引言 我们先不讲游标的什么概念,步骤及语法,先来看一个例子: 表一 OriginSalary                      表二 AddSalary 现在有2张表,一张是OriginSal ...

  4. with(nolock) 与 with(readpast) 与不加此2个的区别

    调试窗口一: 或者查询窗口一: 总之:事务没有结束 查询窗口二:

  5. net上传文件的三种方法

    ASP.NET依托.net framework类库,封装了大量的功能,使得上传文件非常简单,主要有以下三种基本方法. 方法一:用Web控件FileUpload,上传到网站根目录. Test.aspx关 ...

  6. Android环境下通过C框架层控制WIFI【转】

    本文转载自:https://blog.csdn.net/edw200/article/details/52192631 本人是从事Linux嵌入式开发的,安卓wifi控制在安卓JAVA层已经做得非常成 ...

  7. OpenGL几何变换---翻译http://www.songho.ca/opengl/gl_projectionmatrix.html

    Overview 几何数据——顶点位置,和法向量(normal vectors),在OpenGL 管道raterization 处理过程之前可通过顶点运算(Vertex Operation)和基本组合 ...

  8. python读取文件的几种方式

    http://www.cnblogs.com/nkwy2012/p/6023710.html

  9. Meta viewport 学习整理

    The meta viewport tag contains instructions to the browser in the matter of viewports and zooming. I ...

  10. 微信小程序module.exports 模块化

    //common.js var studentList = [     {         name: "xiaoming",         age: "22" ...