配置内核菜单

1、在BSP包的目录下,输入下面命令导入编译环境

host$ . sources/poky/oe-init-build-env

2、输入下面命令进入内核的配置菜单

host$ bitbake linux-mainline -c menuconfig              	#i.MX6
host$ bitbake linux-ti -c menuconfig 						#AM335X

3、在内核菜单下进入File systems→ Network File Systems

选中NFS client support for NFS version 4,NFS client support for 

选中NFS client support for NFSv4.1,

选中NFS client support for NFSv4.2,

选中NFSv4.1 client support for migration。

4、保存退出菜单。

yocto上增加NFS客户端软件

1、查找NFS客户端软件在YOCTO下的编译信息

host$ bitbake -s | grep nfs-utils

2、在build/conf/local.conf中添加nfs-utils软件,local.conf添加下面信息将nfs-utils编译进文件系统

# file build/conf/local.conf
IMAGE_INSTALL_append = " nfs-utils"                             (nfs-utils前面有个空格)

重新编译内核镜像

1、编译内核

host$ bitbake linux-mainline -c compile -f					(i.MX6)
host$ bitbake linux-mainline -c deploy						(i.MX6)
host$ bitbake linux-ti -c compile -f						(AM335X)
host$ bitbake linux-ti -c deploy							(AM335X)

2、编译根文件系统

host$ bitbake phytec-qt5demo-image -c rootfs -f

3、编译镜像

host$ bitbake phytec-qt5demo-image 

4、以上步骤完成后将新的内核、设备树、根文件系统更新到开发板。

测试方法

1、将NFS共享目录挂载在开发板

target$ mkdir /mnt/nfs
target$ mount -t nfs 192.168.5.104:/home/nicola/nfsroot /mnt/nfs

2、可以在/mnt/nfs目录下看到挂载的共享目录

3、取消挂载共享目录命令

target$ unmount -t nfs 192.168.5.104:/home/nicola/nfsroot

开发板作为nfs服务端创建nfs共享目录

ubifs文件系统不支持创建nfs共享目录, 具体原因参考

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_nfs

首先内核的menuconfig需要增加支持nfs server功能,

CONFIG_NFSD=y

CONFIG_NFSD_V3=y

CONFIG_NFSD_V4=y

nfs-utils软件包中也包含nfs服务的相关功能, 根据以上章节方法在BSP中增加nfs-utils.

以上操作完成后, 更新开发板的镜像, 然后在开发板上创建nfs共享目录,

root@phyboard-segin-imx6ul-2:~# mkdir /home/root/nfs

新建/etc/exports配置nfs共享目录的权限

/etc/exports
/home/root/nfs *(rw,no_root_squash,sync,no_subtree_check)

配置完成后,使能开发板的nfs服务端的功能

root@phyboard-segin-imx6ul-2:~# systemctl enable nfs-server.service
root@phyboard-segin-imx6ul-2:~# systemctl start nfs-server.service
  • No labels