You are here

Network File System (NFS)

The target system does not generally have direct access to a disk, so any files it requires (other than the downloaded kernel file) must be accessed remotely.

The most convenient option for development purposes is to have the target's root file system mounted as a remote file system accessed across the network. In this way, a selected directory on the host PC (and all the files and directories contained within it) is made to function as though it was the root file system of the target.

This functionality uses a protocol called Network File System (NFS). It requires a a server daemon to be set up on the host PC to give the target access to the selected files.

Preparing the root file system

A root file system is set up as part of the installation of the development kit. The first thing to decide is whether to mount the installed root file system directly, or to make a copy of it first.

Using the installed system directly has the advantage that no additional disk space is taken up by the copy. However, if more than one person intends to use the same host for development, it is beneficial to have individual root file systems on the target for each user. This enables configuration files and start up scripts to be freely modified, and prevents one user accidentally interfering with another user's data. In addition, a single root file system cannot be safely shared between multiple targets simultaneously (the generation of unique file names and lock files assumes that only one machine writes into any given directory). For these reasons, it is better for each user to have a separate target root file system, keeping the original installed system intact as a reference copy.

It is important that the copying of the file system is done correctly. Firstly, it can only be performed when logged in as the root user, as the file system contains device special files (in /dev) which can only be created by root. The file system can be copied for each user (<user>) with the command:

host# cp --archive /opt/STM/STLinux-X.X/devkit/sh4/target  /export/rootfs/<user>

The disadvantage of this is that every user now has a complete copy of the root file system, which takes up a lot of disk space. In particular, most of the files within the file system will never be modified, which means (especially if there are a large number of users sharing a single machine) it would be worthwhile to consider setting up the root file systems so that the immutable files are created as hard links to the original file, and only those files that are likely to be modified are actual copies.

For more information on setting up NFS root file systems, see the Network Boot HOW-TO.

A Note on Updating the STLinux Distribution

STMicroelectronics periodically makes updates available in the form of new RPM files. These updates can be installed using either rpm or stmyum. The updates in the RPM files are installed in the default locations, that is, in the /opt/STM/STLinux-X.X/... tree.

Consequently, if the root file system has been copied for the use of individual users, these copies have not been updated automatically. In this case, it is necessary to update the copied root file systems manually, but at the same time making sure that any local customizations have been preserved.