NFS作为根文件系统启动的几个关键点

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010979030/article/details/78308527

第一 在uboot中修改bootargs的内容
1、bootargs的参数是传入内核的,例如:

bootargs=noinitrd console=ttyS0,115200 init=/linuxrc mem=64M root=/dev/nfs nfsroot=192.168.0.107:/home/yangzheng/nfs/rootfs ip=192.168.0.103:192.168.0.107:192.168.0.1:255.255.255.0:centos6.localdomain:eth0:off

注:a、设备的ip地址要和环境变量的IP(ipaddr=192.168.0.103)一样;
uboot的环境如下:

[yangzheng@fl2440]# printenv 
bootdelay=3
baudrate=115200
ethaddr=08:00:3e:26:0a:5b
ipaddr=192.168.0.103
serverip=192.168.0.107
netmask=255.255.255.0
ethact=dm9000
bootcmd=nfs 0x30008000 192.168.0.107:/home/yangzheng/nfs/uImage-s3c2440.gz; bootm 30008000
bootargs=noinitrd console=ttyS0,115200 init=/linuxrc mem=64M root=/dev/nfs nfsroot=192.168.0.107:/home/yangzheng/nfs/rootfs ip=192.168.0.103:192.168.0.107:192.168.0.1:255.255.255.0:centos6.localdomain:eth0:off
stdin=serial
stdout=serial
stderr=serial

第二 在内核中选择nfs作文根文件系统
在Linux内核中选择nfs文件系统的支持:

File systems  ---> 
    [*] Network File Systems  --->
        <*>   NFS client support
        [*]   Root file system on NFS

注:a、关闭initramfs的支持;
b、网卡驱动需移植好,可以使用其他类型根文件系统测试网卡驱动;

第三 创文件系统建根目录树
1、创建根文件系统目录树,方法:http://blog.csdn.net/yangzheng_yz/article/details/13120055

第四 在Linux服务器或者主机上启动nfs服务
1、在Linux服务器或主机上启动nfs服务;
2、修改nfs配置文件,让第三步创建的根目录树使用nfs共享;

可参考文档:
http://blog.csdn.net/yangzheng_yz/article/details/13128465

猜你喜欢

转载自blog.csdn.net/u010979030/article/details/78308527