PandaBoard NFS
From OMAPpedia
Contents |
[edit] What is NFS?
NFS stands for Network File System, is a distributed file system protocol originally developed by Sun Microsystems in last century, allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed.
[edit] What is NFS-root?
In order to use a diskless system, it is necessary for the root filesystem to be present on a non-disk device. This may be an initramfs (see linux/Documentation/filesystems/ ramfs-rootfs-initramfs.txt), a ramdisk (see linux/Documentation/initrd.txt) or a filesystem mounted via NFS.
To allow your PandaBoard to mount the root filesystem over network, you should do the following things:
- configure the kernel on the PandaBoard to enable NFS-root capabilities
- assign the IP address to the PandaBoard
- “export” the root filesystem from the host
- tell the PandaBoard that root is somewhere in the net
[edit] Enabling NFS-root capabilities on the PandaBoard
The following kernel options should be turned on:
CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y CONFIG_USB_EHCI_HCD_OMAP=y CONFIG_USB_USBNET=y CONFIG_USB_NET_SMSC95XX=y CONFIG_NETWORK_FILESYSTEMS=y CONFIG_ROOT_NFS=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y
[edit] Assign the IP address to the PandaBoard
The IP address could be assigned either dynamically or statically. If you are connecting the PandaBoard to the dedicated network card on your host, then probably dynamic IP (with DHCP daemon on the host) is the good idea. If you are connecting the PandaBoard to your office/home network where you already have the DHCP server, choose the dynamic IP address as well. Or, you can assign the IP address to your PandaBoard statically. BIG FAT WARNING – do not run your own DHCP server if you already have one in the same network! Ask your sysadmin why :)
In the samples below, it is assumed that network interface that is connected to the PandaBoard has the IP address 10.9.8.7
[edit] Dynamic IP address – host configuration
Install the dhcp daemon, if you have not done this yet
sudo apt-get install udhcpd
Then, edit the /etc/udhcpd.conf file:
start 10.9.8.100 end 10.9.8.200 interface eth2 # edit this! option router 10.9.8.7 option subnet 10.9.8.255 option domain local option lease 86400
...and /etc/default/udhcpd:
DHCPD_ENABLED="yes" DHCPD_OPTS="-S"
Now, start your dhcpd server:
sudo service udhcpd restart
[edit] Dynamic IP address – PandaBoard configuration
Add ip=dhcp to the kernel boot arguments. Probably, boot arguments are in “setenv bootargs” statement in your boot.scr.txt
[edit] Static IP address – host configuration
You have nothing to do on the host if you choose the static IP address to the PandaBoard
[edit] Static IP address – PandaBoard configuration
Add the following ip= parameter to kernel bootargs:
ip=: : : : :eth0:off
For example,
ip=10.9.8.99:10.9.8.7:10.9.8.7:255.255.255.0:panda:eth0:off
Here eth0 means the interface on the PandaBoard that you are configuring, and “off” means that it will not be autoconfigured using DHCP or BOOTP (or even RARP)
[edit] Export the root filesystem from the host
Install the nfs-server, if you have not done this yet:
sudo apt-get install nfs-server
Then, create the exported directory, for example:
sudo mkdir -p /exports/panda
...and copy all rootfs content to it:
sudo cp -a /your/rootfs/content /exports/panda
Now, add the following line to the /etc/exports file:
/exports/panda *(rw,sync,no_root_squash,no_subtree_check)
Done! Start the nfs-server and make sure that the rootfs is exported:
sudo service nfs-kernel-server restart sudo exportfs -rv
[edit] PandaBoard configuration
The remaining part is to tell the PandaBoard that root is in the network rather than on some local device. To do this, add the following options to the bootargs:
root=/dev/nfs nfsroot=2.3.4.7:/exports/panda
That's all. Now compile your boot script and copy it to the 1st (FAT) partition of boot SD card.
[edit] Nothing works! Help!
If root does not get mounted and kernel panics, check the following things:
- you are using the good and correct cable (cross ethernet cable if you are connecting the PandaBoard directly to the host, normal ethernet otherwise)
- all the daemons are started on the host (nfs and dhcp)
- you can mount the exported root file system from the another computer (try “sudo mount -t nfs 10.9.8.7:/exports/panda /mnt”)
- there is no firewall between the host and the PandaBoard
- there is no errors the dmesg output.
If nothing still works, send the request to help – and attach console output of your PandaBoard and kernel .config file.
[edit] Will this work for Android rootfs ?
Yes, this works – with some tricks and limitations. Stay tuned, I'll update this page.