终于挂上NFS了,记录如下。首先感谢sblpp和zhdphao两位坛友的帮助!
1. 在BeagleBone的文件系统中挂载NFS文件系统
开发环境搭建的时候在PC上要运行setup.sh,主要就是安装一些文件和配置。
主要需要这些文件:
#sudo apt-get install xinetd tftpd nfs-kernel-server minicom build-essential libncurses5-dev uboot-mkimage autoconf automake
1) 安装完后,需要修改/etc/exports文件
#gedit /etc/exports
增加nfs文件目录/mnt/nfs *(rw,sync,no_root_squash)
2) #/etc/init.d/nfs-kernel-server restart //重启NFS服务
到这里只能说PC端的NFS server搭建好了,在BeagleBone上还无法挂载NFS系统,会报错的:
mount: wrong
fs type, bad option, bad superblock on 192.168.1.104:/home
missing codepage or
helper program, or other error
(for several
filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.
In some cases useful info is found in syslog - try
dmesg | tail or so
怎么办呢?这个在sblpp的大作中已经说的很明白了,还要在beagleBone上安装两个文件:
nfs-utils-client_1.1.2-2.1_armv7a.ipk 和 portmap_6.0-r3.1_armv7a.ipk
一定要注意是在BeagleBone上安装!!!
1) root@beaglebone:/# opkg install ./portmap_6.0-r3.1_armv7a.ipk
Installing portmap (6.0-r3.1) to root...
Configuring portmap.
Adding system startup for /etc/init.d/portmap.
2) root@beaglebone:/# opkg install ./nfs-utils-client_1.1.2-2.1_armv7a.ipk
Installing nfs-utils-client (1.1.2-2.1) to root...
Configuring nfs-utils-client.
如何把这两个文件拷贝到BeagleBone里面去的呢?我是这么做的:
BeagleBone启动的时候,已经在PC上虚拟出了一个U盘,我直接把这两个文件拷贝到这个U盘里,然后在BeagleBone上建立了一个脚本文件sd.sh,内容如下:
mkdir /home/sd
mount -t vfat /dev/mmcblk0p1 /home/sd
这个时候在/home/sd下就有所需要的东西了
root@beaglebone:/home#./sd.sh
root@beaglebone:/home# cd sd
root@beaglebone:/home/sd# ls
Docs info.txt Drivers
LICENSE.txt nfs-utils-client_1.1.2-2.1_armv7a.ipk uImage
MLO portmap_6.0-r3.1_armv7a.ipk
README.htm u-boot.img
2. 通过NFS文件系统启动BeagleBone
在没有实现上面功能的时候,其实我已经尝试这从NFS根文件系统启动BeagleBone,并已经成功实现,条条大路通罗马,呵呵
主要步骤:
在BeagleBone启动的时候,敲回车,使得启动停在uboot部分
U-Boot 2011.09-00000-gf63b270-dirty (Nov 14 2011 - 10:37:14)
I2C: ready
DRAM: 256 MiB
No daughter card present
NAND: HW ECC Hamming Code selected
nand_get_flash_type: unknown NAND device: Manufacturer ID: 0x10, Chip ID: 0x10
No NAND device found!!!
0 MiB
MMC: OMAP SD/MMC: 0
*** Warning - readenv() failed, using default environment
Net: cpsw
Hit any key to stop autoboot: 0
然后依次输入:
U-Boot# setenv ipaddr 192.168.1.103
U-Boot# setenv serverip 192.168.1.104
U-Boot# setenv bootargs console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.1.104:/mnt/nfs ip=192.168.1.103:192.168.1.104:192.168.1.1:255.255.255.0::eth0:off
U-Boot# run mmc_load_uimage
U-Boot#bootm 0x80007fc0
系统启动:
[ 4.293236] IP-Config: Complete:
[ 4.296636] device=eth0, addr=192.168.1.103, mask=255.255.255.0, gw=192.168.1.1,
[ 4.304648] host=192.168.1.103, domain=, nis-domain=(none),
[ 4.310965] bootserver=192.168.1.104, rootserver=192.168.1.104, rootpath=
[ 4.417566] VFS: Mounted root (nfs filesystem) on device 0:15.
[ 4.424250] Freeing init memory: 240K
grep: /proc/mounts: No such file or directory
grep: /proc/mounts: No such file or directory
Populating /dev using udev: /etc/init.d/S10udev: line 79: can't create /proc/sys/kernel/hotplug: nonexistent directory
到这就挂载成功了!
激动人心的时刻从这里开始!