软件版本
VirtualBox v7.0、Ubuntu 20.04.3 LTS
网络搭建
采用"路由器"+"有线网"来将Linux开发板和Ubuntu虚拟机连接在同一个局域网中。具体接线如下:
Linux开发板通过网线直接连接到"路由器"的LAN接口上,然后笔记本电脑通过Wifi与路由器连接。

VirtualBox虚拟机网络设置
在"网线"设置界面中选择"网卡1"

"网卡2"禁用或者设置为如下:

在Windows端设置无线网卡的IP地址为自动获取

Ubuntu虚拟机中网络设置
连接eth0并且关闭eth1

然后设置eth0的IP地址:192.168.1.100,子网掩码:255.255.255.0


等待10秒左右,通过Ubuntu中命令行查看下当前IP地址:ifconfig

在Linux开发板端使用ping命令,ping下Ubuntu虚拟机:ping 192.168.1.100
此进应该显示XXX is alive表示网络通畅

问题1------"NFS网络无响应"及解决
原先我没有使用"网卡1",而是使用的"网卡2"。

所以在bootargs中的参数如下:
setenv bootargs root=/dev/nfs nfsroot=192.168.1.100:/porting_x210/rootfs/rootfs ip=192.168.1.10:192.168.1.100:192.168.1.1:255.255.255.0::eth1:off init=/linuxrc console=ttySAC2,115200
但是在挂载nfs时,Kernel启动打印出如下关于NFS的错误提示:

错误:rpcbind: server 192.168.1.100 not responding, timed out

切换为只使用"网卡1"而关闭"网卡2"

同时设置bootargs参数如下:
setenv bootargs root=/dev/nfs nfsroot=192.168.1.100:/porting_x210/rootfs/rootfs ip=192.168.1.10:192.168.1.100:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200
但是又出现新的问题:VFS: Cannot open root device "nfs" or unknown-block(2,0)
经过在网上搜索发下这个问题是当前NFS文件系统的版本不支持V2版本。
问题2------"NFS服务器版本问题"及解决
执行:sudo vi /etc/default/nfs-kernel-server并在在nfs-kernel-server配置文件中添加v2版本


重启nfs服务

NFS文件系统挂载实验
重启系统并尝试挂载NFS,如下表示挂载成功了!

参考资料: