Hi3516CV500中NFS配置和使用

最近在调试3516cv500板子,第一次调试通过后由于其他原因,再次调试时发现又有些同样的问题出现,由于没有记录导致时间的二次浪费,所以这一次把其中出现的问题记录下来,免得再出错。

# uname -a
Linux (none) 4.9.37 #1 SMP Tue Mar 5 21:37:32 CST 2019 armv7l GNU/Linux

#ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0c:29:57:fa:cf  
          inet addr:192.168.133.198  Bcast:192.168.133.255  Mask:255.255.254.0
          inet6 addr: fe80::20c:29ff:fe57:facf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8064495 errors:0 dropped:6004 overruns:0 frame:0
          TX packets:8044026 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1682603330 (1.6 GB)  TX bytes:2040281069 (2.0 GB)

使用nfs时还是设计到很多东西的xinetd、tftp这些都需要一一安装和配置

1.tftp

1.1.安装xinetd

# apt-get install xinetd 

安装后/etc下出现目录xinetd.d

1.2. 安装tftp

#apt-get install tftp-hpa  

#apt-get install tftpd-hpa 

1.3.建立tftp传输目录

#mkdir /media/tftpboot

#chmod 777 /media/tftpboot

1.4.配置/etc/xinetd.conf

#touch /etc/xinetd.conf

#vi /etc/xinetd.conf

添加内容:


# Simple configuration file for xinetd
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info

}

includedir /etc/xinetd.d

1.5.配置 /etc/default/tftpd-hpa

#vi etc/default/tftpd-hpa

内容:

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/media/tftpboot" # tftp传输的目录

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s" # 这里是选项,-c是可以上传文件的参数,-s是指定tftpd-hpa服务目录,上面已经指定

1.6.配置 /etc/xinetd.d/tftp

#touch /etc/xinetd.d/tftp

#vi /etc/xinetd.d/tftp

内容:

service tftp
{
  socket_type = dgram
  wait = yes 
  disable = no
  user = root
  protocol = udp 
  server = /usr/sbin/in.tftpd
  server_args = -s /media/tftpboot #只在此处按自己设置修改
  per_source = 11
  cps =100 2
  flags =IPv4

}

1.7.重启 

# service tftpd-hpa restart
# /etc/init.d/xinetd reload
# /etc/init.d/xinetd restart

2.安装NFS

2.1.安装nfs服务

# apt-get install nfs-kernel-server

# apt-get install nfs-common

2.2 配置 /etc/exports

#vi /etc/exports

末尾添加:

/home/*****/share/3516cv500sdk/smp/a7_linux/mpp      *(rw,sync,no_root_squash,no_subtree_check)

前面是待分享的目录,一般分享目录是最好往前分享一点,有可能执行main_app时需要其他文件。

2.3重启nfs 

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

2.4.试挂载

其他目录下:

#mount -t nfs 192.168.133.198://home/*****/share/3516cv500sdk/smp/a7_linux/mpp    /mnt

进入/mnt目录下发现有新文件出现

退出/mnt 然后 # umount /mnt 

单板配置:

2.5. 配置单板网络

#vi /etc/init.d/S80network 

ipaddr=192.168.133.110
bootp=
gateway=192.168.133.254
netmask=255.255.254.0
hostname=
netdev=eth0
autoconf=

2.6.挂载虚拟机上的编译目录到单板/mnt

#mount -t nfs -o nolock 192.168.133.198:/home/lijunwei/share/3516cv500sdk/smp/a7_linux/mpp /mnt

2.7.进入/mnt/**/out/prog 执行主程序

#./main_app &      //&为后台执行,方便终端处理其他事情。

此时发现问题 打印显示缺少libsecurec.so动态库,但是分析后发现/mnt/lib存在这个动态库。百度后发现原来是环境变量的问题,

访问单板/etc/profile发现 LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" 这个主管lib的环境变量并没有包含文件/mnt/lib这也就导致libsecurec.so库始终无法访问到。

修改:export LD_LIBRARY_PATH=/mnt/lib:$LD_LIBRARY_PATH。然后在执行./main_app&就可以了

注意:如果感觉不方便,可以把挂载,环境变量添加,甚至主程序加载都放到启动脚本文件里。

 

 

你可能感兴趣的:(海思芯片,nfs,ubuntu)