你好!欢迎来到深圳市颖特新科技有限公司!
语言
当前位置:首页 >> Nuvoton/新唐 >> 如何为新唐NUC972配置支持NFS

如何为新唐NUC972配置支持NFS

关键字:NUC970 ARM9处理器 作者: 来源: 发布时间:2018-10-23  浏览:22
系统平台:virtualbox3.2.10+ubuntu10.10

安装nfs:

#sudo apt-get install nfs-kernel-server

ubuntu10.10中的已经是最新版本了,无需安装

打开/etc/exports文件,在末尾加入:

/home/xgc *(rw,sync,no_root_squash)

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/home/xgc:要共享的目录

* :允许所有的网段访问

rw :读写权限

sync:资料同步写入内在和硬盘

no_root_squash:nfs客户端共享目录使用者权限

重启服务:
#sudo /etc/init.d/portmap restart                <---重启portmap,很重要
#sudo /etc/init.d/nfs-kernel-server restart      <---重启nfs服务
#showmount -e                                    <---显示共享出的目录

注:nfs是一个RPC程序,使用它前,需要映射好端口,通过portmap设定

命令执行情况如下:

xgc@xgc-VirtualBox:~$ sudo /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process 474


xgc@xgc-VirtualBox:~$ sudo /etc/init.d/nfs-kernel-server restart
 * Stopping NFS kernel daemon                                         [ OK ] 
 * Unexporting directories for NFS kernel daemon...                   [ OK ] 
 * Exporting directories for NFS kernel daemon...     

  exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/home/xgc".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x
                                                                    [ OK ]
 * Starting NFS kernel daemon                                       [ OK ]

xgc@xgc-VirtualBox:~$ showmount -e
Export list for xgc-VirtualBox:
/home/xgc *

 

现在可以在本机上试一下:
#sudo mount -t nfs localhost:/home/xgc /mnt

注:localhost为本机linux的IP地址

这样就把共享目录挂到了/mnt目录,取消挂载用:
#sudo umount /mnt

如果用在嵌入式设备上挂载,要加上参数-o nolock

NFS文件系统搭建

Ubuntu主机IP地址:192.168.1.101 
开发板Ip地址:192.168.1.6 
参考网址:http://blog.chinaunix.net/uid-22030783-id-366815.html

流程: 
1、安装NFS文件系统: 
#sudo apt-get install nfs-kernel-server

2、打开/etc/exports文件,在末尾加入: 
/home/mike/learn201511/nfs *(rw,sync,no_root_squash) #前提是你必须的创建该路径[/home/mike/learn201511/nfs] 
注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下: 
/home/xgc:要共享的目录 
* :允许所有的网段访问 
rw :读写权限 
sync:资料同步写入内在和硬盘 
no_root_squash:nfs客户端共享目录使用者权限

3、重启服务: 
#sudo /etc/init.d/portmap restart <—重启portmap,很重要 
#sudo /etc/init.d/nfs-kernel-server restart <—重启nfs服务 
#showmount -e <—显示共享出的目录

上面安装可能会出错,注意下面提示的错误信息,权限问题:chmod 777 -R /var/lib/nfs/etabExporting directories for NFS kernel daemon... exportfs: could not open /var/lib/nfs/etab for lockingexportfs: can't lock /var/lib/nfs/etab for writing

4、在ubuntu上测试: 
#sudo mount -t nfs localhost:/home/mike/learn201511/nfs /mnt 
注:localhost为本机linux的IP地址 
这样就把共享目录挂到了/mnt目录,取消挂载用: 
#sudo umount /mnt

5、在开发板上挂载: 
[root@EmbedSky /]# mount -o nolock -t nfs 192.168.1.101:/home/mike/learn201511/nfs /mnt 
#192.168.1.101 为主机(UBUNTU)系统的IP地址 
#/home/mike/learn201511 为上面网址中创建的NFS文件系统

 

为了使用NFS进行调试。需要安装NFS server,具体的流程在上一篇博文中有较为详细的介绍。在配置内核时需要做如下的操作: 
这里写图片描述 
这里写图片描述 
这里写图片描述 
对于Boot option中的处理,可以不用写在env.txt配置也是可以的。 
baudrate=115200 
bootargs=noinitrd console=ttyS0,115200 root=/dev/nfs nfsroot=129.1.5.109:/home/collector/nuc970bsp/rootfs_48 bootm 0x7FC0 ip=129.1.5.107:129.1.5.109:129.1.5.109:255.255.255.0 rdinit=/sbin/init mem=64M; bootcmd=tftp 0x7FC0 970uimage; 
bootcmd=tftp 0x7FC0 970uimage ;bootm 0x7FC0 
bootdelay=3 
ethact=emac 
ethaddr=00:00:00:33:66:98 
gatewayip=129.1.88.1 
ipaddr=129.1.5.107 
netmask=255.255.255.0 
serverip=129.1.5.109 
stderr=serial 
stdin=serial 
stdout=serial 
写到这儿,过几天我还会通过修改这个文件,实现USB更新内核,文件系统的功能,在这儿先卖个关子。 
东西不难,也都是我从数据手册里拷贝的,但是时间久了,自己忘得连个思路都没有,怕不怕,惊不惊悚?从小历史学的就不好….没办法。

编辑:admin  最后修改时间:2018-10-23

联系方式

0755-82591179

传真:0755-82591176

邮箱:vicky@yingtexin.net

地址:深圳市龙华区民治街道民治大道973万众润丰创业园A栋2楼A08

Copyright © 2014-2023 颖特新科技有限公司 All Rights Reserved.  粤ICP备14043402号-4