• 开发板搭建NFS文件系统


    最重要的发现 开发板不能和设备直接相连接,不然会出现开发板子ping不通pc段的问题,好像网上有其余的问题,这只是我遇到的问题。

    一、连接设备

    把设备上的端口和wifi陆游端口连接起来,笔记本使用wifi连接
    查看pc段的ip

    tony@lc:~$ ifconfig 
    enp4s0f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 34:97:f6:d1:5c:79  txqueuelen 1000  (以太网)
            RX packets 12  bytes 1839 (1.8 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 40  bytes 4848 (4.8 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (本地环回)
            RX packets 5121  bytes 681921 (681.9 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 5121  bytes 681921 (681.9 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.28.119  netmask 255.255.255.0  broadcast 192.168.28.255
            inet6 fe80::56b:62f3:c41:4368  prefixlen 64  scopeid 0x20<link>
            ether 74:c6:3b:1e:dc:21  txqueuelen 1000  (以太网)
            RX packets 24351  bytes 18714849 (18.7 MB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 22367  bytes 4984080 (4.9 MB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    可以看到 最后那个就是我们pc端口
    地址是 192.168.28.119

    二、修改开发板的ip

    [root@imx6ull:~]# vi /etc/network/interfaces 
    
    • 1

    将里面的内容改为这个(永久生效的方法)
    临时方法可以执行下面的命令

     ifconfig eth0 192.168.28.100 netmask 255.255.255.0 up
    
    • 1

    注意这里的address要和你的pc段在同一网段,我这里是28但是你的可能不是,需要你的修改。gatway一样注意网段, netwask就是子网掩码照抄就行。

    iface lo inet loopback
    auto eth0
    iface eth0 inet static
        address 192.168.28.100
        netmask 255.255.255.0
        gateway 192.168.28.1
    ~
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    重启你的设备你就可以看到对应的ip地址了

    [root@imx6ull:~]# ifconfig 
    eth0      Link encap:Ethernet  HWaddr 00:01:3F:2D:3E:4D  
              inet addr:192.168.28.100  Bcast:0.0.0.0  Mask:255.255.255.0
              inet6 addr: fe80::201:3fff:fe2d:3e4d/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1428 errors:0 dropped:0 overruns:0 frame:0
              TX packets:787 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:122127 (119.2 KiB)  TX bytes:53764 (52.5 KiB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:5850 errors:0 dropped:0 overruns:0 frame:0
              TX packets:5850 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1 
              RX bytes:435912 (425.6 KiB)  TX bytes:435912 (425.6 KiB)
    
    [root@imx6ull:~]# 
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    三、网络测试

    测试之前先重启下你的设备。

    [root@imx6ull:~]# ping 192.168.28.119
    PING 192.168.28.119 (192.168.28.119): 56 data bytes
    64 bytes from 192.168.28.119: seq=0 ttl=64 time=4.083 ms
    64 bytes from 192.168.28.119: seq=1 ttl=64 time=3.084 ms
    64 bytes from 192.168.28.119: seq=2 ttl=64 time=4.011 ms
    64 bytes from 192.168.28.119: seq=3 ttl=64 time=4.992 ms
    64 bytes from 192.168.28.119: seq=4 ttl=64 time=3.028 ms
    64 bytes from 192.168.28.119: seq=5 ttl=64 time=10.511 ms
    64 bytes from 192.168.28.119: seq=6 ttl=64 time=3.060 ms
    64 bytes from 192.168.28.119: seq=7 ttl=64 time=2.986 ms
    64 bytes from 192.168.28.119: seq=8 ttl=64 time=3.682 ms
    64 bytes from 192.168.28.119: seq=9 ttl=64 time=3.963 ms
    64 bytes from 192.168.28.119: seq=10 ttl=64 time=3.651 ms
    64 bytes from 192.168.28.119: seq=11 ttl=64 time=4.933 ms
    64 bytes from 192.168.28.119: seq=12 ttl=64 time=3.620 ms
    64 bytes from 192.168.28.119: seq=13 ttl=64 time=4.416 ms
    ^C
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    
    tony@lc:~$ ping 192.168.28.100
    PING 192.168.28.100 (192.168.28.100) 56(84) bytes of data.
    64 bytes from 192.168.28.100: icmp_seq=1 ttl=64 time=3.66 ms
    64 bytes from 192.168.28.100: icmp_seq=2 ttl=64 time=3.81 ms
    64 bytes from 192.168.28.100: icmp_seq=3 ttl=64 time=3.17 ms
    ^C
    --- 192.168.28.100 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2003ms
    rtt min/avg/max/mdev = 3.172/3.551/3.818/0.279 ms
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    可以看到我们在pc端和开发板端就已经可以Ping通了

    四、挂在nfs文件系统

    首先ubuntu安装一个nfs

    sudo apt install nfs-kernel-server
    
    • 1

    然后打开对应的文件

    sudo vi /etc/exports 
    
    • 1

    在末尾添加一个文件夹作为后期的nfs文件夹

    # /etc/exports: the access control list for filesystems which may be exported
    #               to NFS clients.  See exports(5).
    #
    # Example for NFSv2 and NFSv3:
    # /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
    #
    # Example for NFSv4:
    # /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
    # /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
    #
    
    /home/tony/book  *(rw,nohide,insecure,async,no_subtree_check,no_root_squash)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    然后在开发板的里面挂在对应的目录

    [root@imx6ull:~]# mount -t nfs -o nolock,vers=3 192.168.28.119:/home/tony/book /mnt
    
    • 1
    [root@imx6ull:~]# ls /mnt/
    1.txt
    
    
    • 1
    • 2
    • 3

    就可以了 后续我们传输的镜像文件这些都可以通过这个文件夹来进行拷贝这些。

  • 相关阅读:
    前端发版本,页面白屏报错,微信缓存不更新资源
    JVM 和 HotSpot 的区别?
    【Qt-22】Qt乱码问题解决
    ScalableViT网络模型
    JS 模块化 - 03 AMD 规范与 Require JS
    vue 项目打包图片没有打包进去问题解决
    解决phpstudy无法启动MySQL服务
    基本数据类型之字符串
    面试金典--面试题 17.19. 消失的两个数字
    Leetcode 刷题日记 剑指 Offer II 055. 二叉搜索树迭代器
  • 原文地址:https://blog.csdn.net/weixin_51178981/article/details/132866796