补充:OK6410从nfs启动

从nfs启动的话,要具有的条件是:html

a. 你的uboot支持网络;linux

b. 你的宿主机的nfs已经启动,并能够被正常挂载;ubuntu

c. 你的宿主机的tftp已经启动,并能够从上面下载(也能够直接把你编译的支持nfs启动的内核烧进开发板去,这样就直接启动开发板就能够了)小程序

要作的事有:服务器

一、配置内核

这里只讲从nfs启动须要的选项,其余的选项请参考其余博客上的内核配置的文章;网络

要用nfs文件系统的话配置内核的时候,必须选上:app

File Systems -->测试

Network File Systems -->spa

Root file system on NFS; (这个必须选上).net

以上是完整的选项路径

而后编辑.config,找到CONFIG_CMDLINE="",而后设置成

CONFIG_CMDLINE="root=/dev/nfs nfsroot=宿主机ip:nfs目录 ip=开发板ip rw console=ttySAC0 mem=256M"

我设置参考:

CONFIG_CMDLINE="root=/dev/nfs nfsroot=192.1.1.231:/nfs ip=192.1.1.119 rw console=ttySAC0 mem=256M"

配置好了以后编译内核,而后把内核放到tftp目录下,以供启动时下载内核;

二、开发板参数设置

设置ip,这里的ip要和你配置内核时设置的一致,设置子网掩码,网关;

而后还要设置一个bootargs;设置为:

setenv bootargs "root=/dev/nfs nfsroot=宿主机ip:/nfs目录 开发板ip:子网掩码:eth0:off console=ttySAC0,115200"

个人配置参考:

setenv bootargs "root=/dev/nfs nfsroot=192.1.1.231:/nfs ip=192.1.1.119:255.255.255.0:eth0:off console=ttySAC0,115200"

saveenv,而后reset,在uboot处停住,printenv 看一下有没有保存配置;若已保存则下一步。

三、启动

停在uboot的时候,先从tftp服务器下载uImage,把它下载到内存:

tftp c0800000 uImage

而后从内存启动内核:

bootm c0800000

启动完毕就能够在串口超级终端操做你的开发板了。

以上来源与: <http://blog.sina.com.cn/s/blog_77c2e1cb0101hs29.html>

本身的试验:

我在挂载的时候出现了以下的错误:

s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004120, 3=80808080
rpcbind: server 192.1.1.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.1.1.108
rpcbind: server 192.1.1.108 not responding, timed out
Root-NFS: Unable to get mountd port number from server, using default
Root-NFS: Server returned error -101 while mounting /ok6410/FileSystem/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:
b300 3813376 mmcblk0 driver: mmcblk
b301 3710976 mmcblk0p1
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[<c002c694>] (unwind_backtrace+0x0/0xec) from [<c033a3d8>] (panic+0x54/0x174)
[<c033a3d8>] (panic+0x54/0x174) from [<c0009040>] (mount_block_root+0x1d0/0x210)
[<c0009040>] (mount_block_root+0x1d0/0x210) from [<c00092d8>] (prepare_namespace+0x164/0x1bc)
[<c00092d8>] (prepare_namespace+0x164/0x1bc) from [<c00085f4>] (kernel_init+0x10c/0x14c)
[<c00085f4>] (kernel_init+0x10c/0x14c) from [<c0027e2c>] (kernel_thread_exit+0x0/0x8)

开发板能够加载内核,可是不可以挂载NFS文件系统,可能出现的问题是:

1. 本身制做的内核有问题

2. 本身虚拟机上linux的nfs配置的有问题

首先检测下linux的NFS是否正常,个人虚拟机软件里面有两个linux,一个是ubuntu(ip = 192.1.1.108),一个是RedHat(ip = 192.1.1.231),两个处于同一个网段,并且能够相互ping通,ubuntu上的nfs能够用命令:mount -t nfs 192.1.1.108:/ok6410/FileSystem/rootfs /mnt

它的/etc/exports的内容以下:

21684778

ubuntu本身将nfs目录挂载到/mnt下面成功:

21818050

用RedHat挂载ubuntu上的nfs也成功了:

21880466

这就是说ubuntu的NFS是成功安装了,外部的终端能够挂载nfs根目录。(能够用别人跑着linux的开发板来远程mount一下ubuntu的nfs,应该是能够的),因此问题应该是处在了内核的编译上面。

我在网上下载了一个能够引导NFS的内核,在开发板上试验:

RedHat上试验(成功):

先设置开发板参数:

setenv bootargs "root=/dev/nfs rw nfsroot=192.1.1.231:/nfs ip=192.1.1.119:255.255.255.0:eth0:off console=ttySAC0,115200"

保存参数:

saveenv

(下载并启动内核:nfs c0800000 192.1.1.231:/nfs/uImage3.0;bootm c0800000)

下载内核:

tftp c0800000 uImage3.0

40912557

启动内核:

bootm c0800000

40985362

其中服务器linux中/etc/exports内容以下:

24233398

nfs目录内容:

24246080

开发板启动的界面:

24079191

测试一个小程序:

在/nfs下新建hello.c

编译:arm-linux-gcc -static hello.c -o hello

24800102

开发板上执行:

./hello

24833112

===========================================================================

在ubuntu上测试(作不出来):

25131917

开发板的参数:

25160137

下载内核:

nfs c0800000 192.1.1.108:/ok6410/FileSystem/rootfs/uImage3.0;bootm c0800000

25209090

可是仍是出错了:

25441454

这就是ubuntu的NFS有问题了,查看/etc/exports的内容:

25509299

修改为:

25593399

而后重启nfs服务:

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

在下载测试:

仍是有问题:

25727560

不知道什么缘由。。。。。。。。。。。。得再查查错误

相关文章
相关标签/搜索