Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1495914
  • 博文数量: 267
  • 博客积分: 3010
  • 博客等级: 少校
  • 技术积分: 3089
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-05 17:09
个人简介

尊天命,尽人事

文章分类

全部博文(267)

文章存档

2017年(6)

2015年(4)

2014年(27)

2013年(52)

2012年(59)

2011年(120)

分类: 嵌入式

2011-08-25 22:12:49

一开始的配置是启动之后完全没有反应,2.6.23,仅配置了
<*> NFS file system support                                                                   
[*] Provide NFSv3 client support 
[*]     Provide client support for the NFSv3 ACL protocol extension                            
[ ]   Provide NFSv4 client support (EXPERIMENTAL)                                              
[*]   Allow direct I/O on NFS files          
启动参数
bootargs=console=ttyS0,115200 root=/dev/nfs rw ip=192.168.0.55 nfsroot=192.168.0.200:/mnt/new/nfs/rootfs
内核最后报错
VFS: Cannot open root device "nfs" or unknown-block(0,255)
Please append a correct "root=" boot option; here are the available partitions:
1f00      65536 mtdblock0 (driver?)
1f01      65536 mtdblock1 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
Rebooting in 180 seconds..

这个坎还是比较狠,幸好我有买书的好习惯。ELDD、Embedded Linux primer这种书真是充满了细节,每次阅读都能有新收获。原来NFS当根文件系统时必须配置
[*] Root file system on NFS
但是我却没有找到这个选项,自然是某些条件不满足了。利用make menuconfig的搜索功能 / 
能够轻易地找到其相关的依赖选项和位置 ,如果你找不到,记住对自己狠一点,就能找到了
对自己要狠,不然凭啥Linux工程师能多拿那么一点薪水呢

之后内核换了一副态度:
Looking up port of RPC 100003/2 on 192.168.0.200
rpcbind: server 192.168.0.200 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.0.200
rpcbind: server 192.168.0.200 not responding, timed out
Root-NFS: Unable to get mountd port number from server, using default
mount: server 0.0.0.16 not responding, timed out
Root-NFS: Server returned error -5 while mounting /mnt/new/nfs/rootfs-54suo
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      65536 mtdblock0 (driver?)
1f01      65536 mtdblock1 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
Rebooting in 180 seconds..

就是说,内核已经尽了最大的努力,尝试了各种可能的nfs路径还是不行
仔细想想,老是超时,原来是我的网卡eth0 还未调通啊
bootargs=console=ttyS0,115200 root=/dev/nfs rw ip=192.168.0.55 nfsroot=192.168.0.200:/mnt/new/nfs/rootfs
对ip的设置默认应该是对eth0的,那么如何指定为其他网卡呢

内核启动参数参见Documentation/kernel-parameters.txt
它说 ip 这个选项
See Documentation/filesystems/nfs/nfsroot.txt.

ip=::::::

This parameter tells the kernel how to configure IP addresses of devices
and also how to set up the IP routing table. It was originally called
`nfsaddrs', but now the boot-time IP configuration works independently of
NFS, so it was renamed to `ip' and the old name remained as an alias for
compatibility reasons.

If this parameter is missing from the kernel command line, all fields are
assumed to be empty, and the defaults mentioned below apply. In general
this means that the kernel tries to configure everything using
autoconfiguration.

The parameter can appear alone as the value to the `ip'
parameter (without all the ':' characters before).  If the value is
"ip=off" or "ip=none", no autoconfiguration will take place, otherwise
autoconfiguration will take place.  The most common way to use this
is "ip=dhcp".

    IP address of the client.

Default:  Determined using autoconfiguration.

    IP address of the NFS server. If RARP is used to determine
the client address and this parameter is NOT empty only
replies from the specified server are accepted.

Only required for NFS root. That is autoconfiguration
will not be triggered if it is missing and NFS root is not
in operation.

Default: Determined using autoconfiguration.
The address of the autoconfiguration server is used.

    IP address of a gateway if the server is on a different subnet.

Default: Determined using autoconfiguration.

    Netmask for local network interface. If unspecified
the netmask is derived from the client IP address assuming
classful addressing.

Default:  Determined using autoconfiguration.

    Name of the client. May be supplied by autoconfiguration,
but its absence will not trigger autoconfiguration.

Default: Client IP address is used in ASCII notation.

    Name of network device to use.

Default: If the host only has one device, it is used.
Otherwise the device is determined using
autoconfiguration. This is done by sending
autoconfiguration requests out of all devices,
and using the device that received the first reply.

    Method to use for autoconfiguration. In the case of options
which specify multiple autoconfiguration protocols,
requests are sent using all protocols, and the first one
to reply is used.

Only autoconfiguration protocols that have been compiled
into the kernel will be used, regardless of the value of
this option.

off or none: don't use autoconfiguration
(do static IP assignment instead)
on or any:   use any protocol available in the kernel
(default)
dhcp:        use DHCP
bootp:       use BOOTP
rarp:        use RARP
both:        use both BOOTP and RARP but not DHCP
(old option kept for backwards compatibility)

Default: any

好吧,那就好好调教下内核,给它参数:
console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.200:/mnt/new/nfs/rootfs ip=192.168.0.55:192.168.0.200:192.168.0.1:255.255.255.0:xxxx:eth2:on

至此,nfs作为根是起来了。可能是启动顺序的不一致吧,原来作为jffs2启动的镜像改成nfs就会报

Warning: unable to open an initial console.

 

 

这个主要是没有建立控制台,解决方式:

缺少 /dev/console 和 /dev/null
在建立他們之前UDEV就先使用到他們了

cd /dev
mknod -m 660 console c 5 1
mknod -m 660 null c 1 3
阅读(1103) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~