Adding the NFS Daemons

By Jim Buzbee, published on August 10, 2004
Source: Tom's Guide US | Keywords: , , , ,

4. Adding the NFS Daemons

One compile down, one more to go. Now we'll tackle the NFS daemons themselves. The build process for the NFS daemons requires the execution of a script called BUILD. I could find no option in this script for cross-compilation, so I just let it do its thing and fixed the results after. A number of questions are asked during the run of the script. Answer everything with the default except for the question:

Do you want to protect mountd with HOST ACCESS?

Answer "no" to this question since we don't have the required library. After the configuration runs to completion, you'll need to edit the resulting Makefile to fix it up for our cross compiler. Near the top of the makefile, there are three variables for CC, AR and RANLIB. Add the prefix for your cross-compiler. For example, my CC now looks like this:

CC = /home/jbuzbee/gpl_code_2.03/usr/local/openrg/armsaeb/bin/armv4b-hardhat-linux-gcc

Next, we need to add an include path to the CFLAGS line. Mine looks like so:

CFLAGS = -g -O -D_GNU_SOURCE -I /home/jbuzbee/snapgear/linux-2.4.x/include/

The final change we need to make is in the file nfsd.h. Near the top, add an additional include that is needed for our environment:

#include

Once this is done, a simple make will build the two required binaries: rpc.mountd and rpc.nfsd. Stripping these binaries doesn't seem to reduce their size. Now we're ready to try NFS out.

Move the three binaries; portmap, rpc.mountd, rpc.nfsd over to the NSLU2. I decided to put my new system level binaries under the conf partition in order to keep them separate from my data. I created three new directories under /share/hdd/conf - bin, etc, and rc.d, mirroring the directories in the normal tree.

The binaries go to the bin directory, startup scripts go to the rc.d directory, and configuration files go to the etc directory. In our case, the only configuration file needed is the exports file. NFS requires an exports file to tell the NFS daemon which directories to export and to whom among other things. I created an exports file that looked like this:

/share/ 192.168.1.100 (rw, insecure) /share/ 192.168.1.103 (rw ) /share/ 192.168.1.102 (rw )

The insecure option is for my Mac OS X box which uses insecure network ports. You'll obviously need to create a exports file that matches your network needs, so for more options, consult the standard NFS documentation.

Comments | Print | Send to a friend

Sponsored links

Comments

Comments are closed on this page.

Sponsored links