Chinaunix首页 | 论坛 | 博客
  • 博客访问: 118464
  • 博文数量: 30
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 260
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-24 15:22
个人简介

记录每一次遇到的问题,避免走太多的弯路。

文章分类

全部博文(30)

文章存档

2016年(1)

2015年(13)

2014年(13)

2013年(3)

我的朋友

分类: LINUX

2014-08-27 11:01:00

 
主机:Ubuntu12.04
目标板:Atmel AT91SAM9X5-EK开发
1、在主机上安装nfs服务
#apt-get install nfs-kernel-server
2、完成安装之后,配置/etc/exports文件
编辑exports(如果之前没有配置过,改文件是空的)
#vim exports
添加/home/at91samx35/buildroot/output/target *(rw,sync,no_root_squash)


/home/at91samx35/buildroot/output/target :目标主机共享的目录
*                                        :表示任意用户都可以使用,也可以使用IP(如:192.168.0.*)
rw                                       :目标机对该目录具有读写权限
no_root_squash                           :挂载此目录的目标机享有主机的root权限
3、使修改完成由的/etc/exports生效
#exportfs -rv


4、启动nfs
#service nfs-kernel-server start


5、在目标机挂载
#mount -t nfs -o nolock 192.168.0.252:/home/at91samx35/buildroot/output/target /mnt
将主机上的/home/at91samx35/buildroot/output/target挂载到目标机上的/mnt上。
(主机的ip跟目标的ip必须在同一个网段,且在局域网内不能有IP冲突)
取消挂载:
#umount /mnt


通过NFS启动系统
当nfs服务配置好并启动之后,我们就可以把nfs作为根文件系统来启动开发板。通过使用nfs作为根文件系统,开发板的“硬盘”就可以变得很大,因为我们使用的是主机的硬盘。
方法:
开发启动时按下空格键,进入uboot模式。
#setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.0.252:/home/at91samx35/buildroot/output/target ip=192.168.0.90:192.168.0.252:192.168.0.1:255.255.255.0:AT91SAM9X35:eth0:off
#saveenv


需要内核支持的:
在内核版本2.6.29–2.6.39, 3.0–3.8, 3.9-rc+HEAD,在menuconfig找不到Root file system on NFS,所以需要修改我们板级的配置文件
#gedit arch/arm/configs/at91sam9x5ek_defconfig
在大概230行出添加CONFIG_IP_PNP=y。
#make at91sam9x5ek_defconfig
#make menuconfig
File systems  --->  
[*] Network File Systems  --->
[*]   Root file system on NFS 
为了安全起见,以下这些选项也选上。
[*] Networking support  ---> 
Networking options  ---> 
[*]   IP: kernel level autoconfiguration                                                            
                   [*]     IP: DHCP support                                                                          
                   [*]     IP: BOOTP support                                                                          
                   [*]     IP: RARP support 
#make
关于内核启动参数和nfs需要哪些配置选项的更多详细信息就参考:



不使用从NFS启动的参数:
bootargs mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs
阅读(1436) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~