Mounting the root filesystem using NFS
If your device has a network interface, it is often useful to mount the root filesystem over the network during development. It gives you access to the almost unlimited storage on your host machine, so you can add in debug tools and executables with large symbol tables. As an added bonus, updates made to the root filesystem on the development machine are made available on the target immediately. You can also access all the target's log files from the host.
To begin with, you need to install and configure an NFS server on your host. On Ubuntu, the package to install is named nfs-kernel-server
:
$ sudo apt install nfs-kernel-server
The NFS server needs to be told which directories are being exported to the network; this is controlled by /etc/exports
. There is one line for each export. The format is described in the manual page exports(5)
. As an example, to export the root filesystem on my host, I have this:
/home/chris/rootfs *(rw...