1、PC端NFS服务器,可参考前一篇文章。
2、在PC机上新建NFS共享文件夹,如/home/san/root_fs,并且将Linux文件系统解压至此目录下。
3、设置开发板NFS启动参数
选3设置参数(选1,一步步按提示设置NFS启动参数)
bootargs console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.65:/home/san/root_fs ip=192.168.1.108:192.168.1.6:192.168.0.1:255.255.255.0:www.sanux.org:eth0:off'
##### Parameter Menu #####
[1] Set NFS boot parameter
[2] Set Yaffs boot parameter
[3] Set parameter
[4] View the parameters
[d] Delete parameter
[s] Save the parameters to Nand Flash
[q] Return main Menu
Enter your selection
4、启动开发板,如果一切正常,应该可以看到成功启动的信息,恭喜!
注意:如果Linux内核中没有网卡启动或者网卡启动有问题,那么开发板是无法从NFS启动的。
以下是系统启动后的相关信息:
[root@san /]#ls
bin etc linuxrc proc sys usr
dev lib mnt sbin tmp var
[root@san /]#ls -ld
drwxr-xr-x 14 1000 1000 4096 Mar 9 2010 .
[root@san /]#df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 7.3G 4.6G 2.4G 66% /
tmpfs 29.8M 0 29.8M 0% /tmp
tmpfs 29.8M 0 29.8M 0% /dev
var 29.8M 0 29.8M 0% /dev
[root@san /]#mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,har
d,nointr,nolock,proto=udp,timeo=11,retrans=3,sec=sys,addr=192.168.1.101)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
var on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
[root@san /]#cd /
[root@san /]#ping 192.168.1.101
PING 192.168.1.108 (192.168.1.108): 56 data bytes
64 bytes from 192.168.1.108: seq=0 ttl=128 time=4.577 ms
64 bytes from 192.168.1.108: seq=1 ttl=128 time=0.966 ms
注意:U-boot参数一览
bootcmd =nboot 0x32000000 kernel; bootm 0x32000000
bootdelay =0
baudrate =115200
ethaddr =0a:1b:2c:3d:4e:5f
ipaddr =192.168.1.6
serverip =192.168.1.8
netmask =255.255.255.0
mtdids =nand0=nandflash0
mtdparts =mtdparts=nandflash0:256k@0(bios),128k(params),128k(toc),512k(eboot),102
4k(logo),2m(kernel),-(root)
filesize=1d5c54
filesize+1=1d8000
fileaddr=30000000
NFS挂载启动:bootargs =console=ttySAC0 root=/dev/nfs nfsroot=192.168.1.101:/home/san/Desktop/root_fs ip=192.168.1.6:192.168.1.101:192.168.1.6:255.255.255.0:SKY2440.embedsky.net:eth0:off
或者
本地启动:bootargs noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 (在Uboot中使用setenv指令设置,boot_zImage指令启动)
stdin=serial
stdout=serial
stderr=serial
partition=nand0,0
mtddevnum=0
mtddevname=bios