mini2440使用nfs无法启动的问题解决

作者: leon1741 2017-01-30 15:47:34

研究了一下如何通过super-vivi来使用nfs网络文件系统来启动mini2440开发板,一开始一直无法成功,折腾了半天总算搞定了,总结一下:


 


1、首先,介绍一下我的开发环境。


物理机:win10;


虚拟机:ubuntu 12.04;


模拟器:virtualbox 5.20;


我的步骤是,按照用户手册的说明,先用super-vivi引导系统,输入q进入命令行模式,然后输入nfs启动命令(如下),最后输入boot启动系统。


param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=192.168.100.108:/opt/FriendlyARM/mini2440/rootfs ip=192.168.100.230:192.168.100.108:192.168.100.1:255.255.255.0:sbc2440.arm9.net:eth0:off"


但是,系统始终无法启动。每次都提示:


Copy linux kernel from 0x00060000 to 0x30008000, size = 0x00500000 ... done


zImage magic = 0x016f2818


Setup linux parameters at 0x30000100


linux command line is: "console=ttySAC0 root=/dev/nfs nfsroot=192.168.100.108:/opt/FriendlyARM/mini2440/rootfs ip=192.168.100.230:192.168.100.108:192.168.100.1:255.255.255.0:mini2440.arm9.net:eth0:off"


MACH_TYPE = 1999


NOW, Booting Linux......


Uncompressing Linux........................... done, booting the kernel.


Linux version 2.6.32.2-FriendlyARM (root@LEON) (gcc version 4.4.3 (ctng-1.6.1) )


.......【此处略去N个字】.........


eth0: link down


IP-Config: Complete:


device=eth0, addr=192.168.100.230, mask=255.255.255.0, gw=192.168.100.1,


host=mini2440, domain=, nis-domain=arm9.net,


bootserver=192.168.100.108, rootserver=192.168.100.108, rootpath=


Looking up port of RPC 100003/2 on 192.168.100.108


eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1


rpcbind: server 192.168.100.108 not responding, timed out


Root-NFS: Unable to get nfsd port number from server, using default


Looking up port of RPC 100005/1 on 192.168.100.108


rpcbind: server 192.168.100.108 not responding, timed out


Root-NFS: Unable to get mountd port number from server, using default


Root-NFS: Server returned error -5 while mounting /opt/FriendlyARM/mini2440/rootfs


VFS: Unable to mount root fs via NFS, trying floppy.


VFS: Cannot open root device "nfs" or unknown-block(2,0)


Please append a correct "root=" boot option; here are the available partitions:


1f00             256 mtdblock0 (driver?)


1f01             128 mtdblock1 (driver?)


1f02            5120 mtdblock2 (driver?)


1f03           60032 mtdblock3 (driver?)


1f04           65536 mtdblock4 (driver?)


Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)


可以看到,上述log中最关键的地方就是”rpcbind: server 192.168.100.108 not responding, timed out“这句话了。它的意思就是,开发板尝试通过局域网连接到目标系统的nfs,但是目标无响应,超时了。这就意味着,要么就是ubuntu系统的nfs没有挂载成功,要么就是开发板没有连入局域网,要么就是ubuntu系统没有连入局域网。于是一个一个来排查吧。


 


2、首先排查第一个问题,确认一下ubuntu的nfs文件系统是否挂载成功了。这个问题,可直接参考我的另一篇(如何在ubuntu 12.04系统下开启nfs网络文件系统)(http://www.linuxdiyf.com/linux/28054.html)中提到的第5点。我确认了我的系统,没有问题。


 


3、然后排查第二个问题,确认一下mini2440开发板是否成功连入局域网。可参见我的另一篇(mini2440开发板linux系统下的网络参数设置)(http://www.linuxdiyf.com/linux/28053.html)中的第3点。我确认了我的开发板,没有问题。


 


4、上述两个方面都验证过了,都没问题,那问题肯定就出在第3个方面了。也就是说,是ubuntu系统没有连入到局域网中,导致开发板无法接入到nfs文件系统。换句话说,就是ubuntu系统和mini2440开发板并没有处于同一个局域网中。


一开始我意识到这一点时,我还怀疑是不是因为我的笔记本没有使用网线,而用的是无线网络。所以我把笔记本的无线网卡禁用掉,然后特地找了一根网线来试试。结果仍然一样。这就证明跟无线/有线并没有什么关系,应该是其他方面的问题。


然后我就去网上查阅各位大神的博客、论坛等。偶然间看到一篇文章里提到了virtualbox下的虚拟机网络模式配置,提到了桥接模式和ip地址设置,不然无法上网。我立马灵光一闪,感觉可能跟我的虚拟机网络模式和ip地址配置有点关系。


因为我在这之前只是确认了一下物理机的ip地址是192.168.100.108,然后就简单的以为我的虚拟机也是这个ip地址,然后就把这个ip地址写入到nfs的启动参数中,配置给mini2440。但是,物理机和虚拟机的IP地址是不一样的。我的nfs目录是挂载在虚拟机ubuntu的系统下,而不是物理机win10的系统下。因此我需要获取到虚拟机ubuntu系统的ip地址。可是此时在ubuntu系统下运行ifconfig命令时,得到的ip地址信息却是127.0.0.1之类的信息。这显然是不对的!而且,此时从虚拟机ping物理机是OK的,但是从物理机ping虚拟机是失败的,这样肯定是无法从外面挂载虚拟机里的nfs文件系统的。那该怎么办呢?


 


5、这就要回到virtualbox的网络模式的配置问题上面了。如下图,将virtualbox的网卡模式设置为桥接模式(至于具体原因,请自行搜索)。




 


6、重新启动虚拟机,输入ifconfig命令查询,发现其ip地址变成了:


leon@Ubuntu:~$ ifconfig


eth3      Link encap:以太网  硬件地址 08:00:27:ea:ba:41  


inet 地址:192.168.100.104  广播:192.168.100.255  掩码:255.255.255.0


inet6 地址: fe80::a00:27ff:feea:ba41/64 Scope:Link


UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1


接收数据包:242 错误:0 丢弃:0 过载:0 帧数:0


发送数据包:126 错误:0 丢弃:0 过载:0 载波:0


碰撞:0 发送队列长度:1000 


接收字节:42431 (42.4 KB)  发送字节:17387 (17.3 KB)


lo        Link encap:本地环回  


inet 地址:127.0.0.1  掩码:255.0.0.0


inet6 地址: ::1/128 Scope:Host


UP LOOPBACK RUNNING  MTU:65536  跃点数:1


接收数据包:24 错误:0 丢弃:0 过载:0 帧数:0


发送数据包:24 错误:0 丢弃:0 过载:0 载波:0


碰撞:0 发送队列长度:0 


接收字节:3519 (3.5 KB)  发送字节:3519 (3.5 KB)


这就说明修改成功了。此时的虚拟机已经跟物理机一样并存于局域网中了,它的ip地址,就可以直接提供给mini2440使用了。


 


7、于是,将此时的虚拟机的ip地址,录入到mini2440的nfs启动参数中:


param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=192.168.100.104:/opt/FriendlyARM/mini2440/rootfs ip=192.168.100.230:192.168.100.104:192.168.100.1:255.255.255.0:sbc2440.arm9.net:eth0:off"


然后输入boot,便可以看到mini2440成功启动了!


Copy linux kernel from 0x00060000 to 0x30008000, size = 0x00500000 ... done


zImage magic = 0x016f2818


Setup linux parameters at 0x30000100


linux command line is: "console=ttySAC0 root=/dev/nfs nfsroot=192.168.100.108:/opt/FriendlyARM/mini2440/rootfs ip=192.168.100.230:192.168.100.108:192.168.100.1:255.255.255.0:mini2440.arm9.net:eth0:off"


MACH_TYPE = 1999


NOW, Booting Linux......


Uncompressing Linux................................ done, booting the kernel.


Linux version 2.6.32.2-FriendlyARM (root@LEON) (gcc version 4.4.3 (ctng-1.6.1) )


................


eth0: link down


IP-Config: Complete:


device=eth0, addr=192.168.100.230, mask=255.255.255.0, gw=192.168.100.1,


host=mini2440, domain=, nis-domain=arm9.net,


bootserver=192.168.100.104, rootserver=192.168.100.104, rootpath=


Looking up port of RPC 100003/2 on 192.168.100.104


eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1


Looking up port of RPC 100005/1 on 192.168.100.104


VFS: Mounted root (nfs filesystem) on device 0:11.


Freeing init memory: 156K


hwclock: settimeofday() failed: Invalid argument


Try to bring eth0 interface up......NFS root ...Done


Please press Enter to activate this console.


 


8、哈哈,搞定,收工!


 


篇后语:


1、开发板和目标系统一定要处于同一个局域网下。当然,所谓同一个局域网,可以是通过有线的网线连入同一个路由器,也可以是通过无线网卡连入同一个路由器。但是一定要保证二者的IP地址处于同一个网段,网关和掩码也是一样的。


2、nfs文件系统如果搭建于虚拟机下,则一定要将虚拟机的网络模式设置为桥接模式,否则虚拟机将无法满足上述第一点。


 


本文永久更新地址:http://www.linuxdiyf.com/linux/28055.html

相关资讯