NFS server

The NFS server can be used to provide a root file system that can be mounted root filesystem on the traget hardware, this is very convenient for application development.

Tested with the following operating systems

Installation

On Ubuntu the nfs-kernel-server package has to be installed.

user@ubuntu:~$ sudo apt-get install nfs-kernel-server



Example Configuration for NFS boot


Create a directory on the host root filesystem.

user@ubuntu:~$ sudo mkdir /nfs
user@ubuntu:~$ sudo chmod 777 /nfs

Extract the content of root.tgz to your nfs directory.
root.tgz is located in:

user@ubuntu:~$ cd /nfs
user@ubuntu:~$ sudo tar -xvf ~/workspace/TQMaxx-BSP-REV.xxxx/platform-MBaxx/images/root.tgz

Next step is to configure the /etc/exports file. Create an entry that contains the path to your nfs folder created above.

<path/to/your/nfs/directory>       <permitted IPs>/<subnet>(<comma separated options>)

For example

This path must match the U-Boot environment variable rootpath on the target and defines the source for the NFS rootfs.

After the /etc/exports file was modified the NFS server need to be restarted:

user@ubuntu:~$ sudo service nfs-kernel-server restart

Test the configuration


With the command showmount you can see the exported directories.

user@ubuntu:~$ showmount -e localhost
Export list for localhost:
/nfs 192.168.0.0/255.255.0.0


Troubleshooting


If the root file system cannot be mounted via NFS the log file of the NFS server should be checked. In Ubuntu the log is written to the file /var/log/syslog.

An example of such a log entry looks like:

Nov 14 02:30:57 ubuntu mountd[8667]: refused mount request from 172.21.10.157 for /opt/ltib_iMX35/ltib/rootfs (/opt/ltib_iMX35/ltib/rootfs): unmatched host

In this case the server rejects the connection because the host does not match the one in the file /etc/exports.

Sources