zoukankan      html  css  js  c++  java
  • 编译portmap和nfs-utils

    为了在播放机上实现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 -/sbin/portmap ] || exit 0
     7 -/usr/sbin/rpc.statd ] || exit 0
     8 -/usr/sbin/rpc.nfsd ] || exit 0 
     9 -/usr/sbin/rpc.mountd ] || exit 0
    10 -/usr/sbin/exportfs ] || exit 0  
    11 
    12 # Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue.
    13 -/etc/exports ] ||                                                              
    14     { touch /etc/exports && chmod u+rw,g+r,o+/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 -/var/lib/nfs/sm                                                             
    19 mkdir -/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 -"Starting port mapper: "
    28         portmap                         
    29         echo "done"                     
    30 
    31         echo -"Starting NFS statd: "
    32         rpc.statd                     
    33         touch /var/lock/subsys/nfslock
    34         echo "done"                   
    35 
    36         echo -"Starting NFS services: "
    37         /usr/sbin/exportfs -r            
    38         rpc.statd                        
    39         echo "done"                      
    40 
    41         echo -"Starting NFS daemon: "
    42         rpc.nfsd 2                     
    43         echo "done"                    
    44 
    45         echo -"Starting NFS mountd: "
    46         rpc.mountd                     
    47         echo "done"                    
    48         touch /var/lock/subsys/nfs     
    49 }                                      
    50 
    51 stop() {
    52         # Stop daemons.
    53         echo -"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 -"Shutting down NFS services: "
    62         /usr/sbin/exportfs -au                
    63         rm -/var/lock/subsys/nfs            
    64         killall -q rpc.statd                  
    65         echo "done"
    66 
    67         echo -"Stopping NFS statd: "
    68         killall -q rpc.statd
    69         echo "done"
    70         rm -/var/lock/subsys/nfslock
    71 
    72         echo -"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时出现上面的提示会是什么原因  回复  更多评论 
      
  • 相关阅读:
    剑指Offer-30.连续子数组的最大和(C++/Java)
    剑指Offer-29.最小的K个数(C++/Java)
    UVA 1616 Caravan Robbers 商队抢劫者(二分)
    UVA 10570 Meeting with Aliens 外星人聚会
    UVA 11093 Just Finish it up 环形跑道 (贪心)
    UVA 12673 Erratic Expansion 奇怪的气球膨胀 (递推)
    UVA 10954 Add All 全部相加 (Huffman编码)
    UVA 714 Copying Books 抄书 (二分)
    UVALive 3523 Knights of the Round Table 圆桌骑士 (无向图点双连通分量)
    codeforecs Gym 100286B Blind Walk
  • 原文地址:https://www.cnblogs.com/LiuYanYGZ/p/7452876.html
Copyright © 2011-2022 走看看