SSD20X使用NFS服务

  • Ubuntu下安装NFS服务
# sudo apt-get install nfs-kernel-server
  • 准备NFS文件系统
# cd ~/ssd20x
# mkdir nfs
# cd  nfs
# cp ../project/image/output/rootfs/* ./ -rf
# cp ../project/image/output/customer/ ./ -rf
# cp ../project/image/output/appconfigs/ ./ -rf
# cp ../project/image/output/miservice/config/ ./ -rf
  • ubuntu开启NFS服务
# sudo vi /etc/exports

+ /home/industio/ssd20x/nfs/ *(rw,sync)

# sudo /etc/init.d/nfs-kernel-server restart

本地验证

# sudo mount -t nfs -o nolock 192.168.1.125:/home/industio/ssd20x/nfs/ /mnt
# ls /mnt
# sudo umount /mnt

  • 开发板挂载NFS

确认开发板与ubuntu处于同一局域网内,且能相互通信:

# mount -t nfs -o nolock 192.168.1.125:/home/industio/ssd20x/nfs/ /mnt
# ls /mnt
# umount /mnt

  • NFS根文件系统
  1. 将nfs编译进kernel
# cd kernel
# ARCH=arm make menuconfig
-*- Networking support  --->
        Networking options  --->
            -*- TCP/IP networking
            [*] IP: kernel level autoconfiguration
            [*]     IP: DHCP support
            [*]     IP: BOOTP support
File systems  --->
    [*] Network File Systems  --->
        <*>   NFS client support
        <*>       NFS client support for NFS version 2
        <*>       NFS client support for NFS version 3
        <*>       NFS client support for NFS version 4
        [*]   Root file system on NFS

重新编译并更新kernel。

# ./Release_to_customer.sh -f nand -p ssd201 -o 2D07
  1. 重新设置bootargs

需要将bootargs设置根文件系统指向nfs,这里192.168.1.125是ubuntu的IP,192.168.1.85是与ubuntu ip同一局域网的随机ip:

SigmaStar# setenv bootargs console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.1.125:/home/industio/ssd20x/nfs ip=192.168.1.85:192.168.1.125:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc rootwait=1 LX_MEM=0x3f00000 mma_heap=mma_heap_name0,miu=0,sz=0xa00000 mma_memblock_remove=1 highres=off mmap_reserved=fb,miu=0,sz=0x300000,max_start_off=0x3300000,max_end_off=0x3600000 mtdparts=nand0:384k@1280k(IPL0),384k(IPL1),384k(IPL_CUST0),384k(IPL_CUST1),768k(UBOOT0),768k(UBOOT1),256k(ENV),256k(ENV1),0x20000(KEY_CUST),0x60000(LOGO),0x500000(KERNEL),0x500000(RECOVERY),-(UBI)

重新启动开发板后,将看到nfs正常挂载了:


文档更新时间: 2021-09-06 11:30   作者:Aeeditor