第一 在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