Zynq design from scratch. Part 31.
Running an NFS sever on the Mac OS X
Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network much like local storage is accessed. NFS server
An NFS server allows NFS-mount root file system (or NFS mount) on the targeting board. This is normally used during application development stage. The main idea here is to provide application/software developers a rapid turnaround during testing and development environment, because downloading the modified file system image to the target hardware is not necessary.
Windows PC solution
FreeNFS is a solution for all of you using a Windows PC.
Create a directory to share
We will add a directory called NFSshare in our home directory:
Create the exports file
We will create a file named exports and add the following text line:
/Users/zoocad/NFSshare -mapall=zoocad -network 192.168.33.0 -mask 255.255.255.0
XXX -mapall=YYY -network ZZZ -mask 255.255.255.0
XXX = Path name of our shared directory
yyy = Name of the user account
ZZZ = IP of our network segment, e.g. if the Mac IP Address is 192.168.33.1 so our segnent is 192.168.33.0
If we like we can add more directory to share. When finished we copy this file to the /etc directory:
sudo cp exports /etc/.
Starting the NFS server
There are only a few commands needed to start the built-in NFS server on the Mac host.
sudo nfsd update
To show status:
sudo nfsd status
To show exported file systems:
The NFS server is up and running.
Mounting NFSshare in PetaLinux
After booting PetaLinux we can mount the NFSshare directory into the PetaLinux file system. Here is the command to mount it under the /mnt directory:
mount -o nolock -t nfs 192.168.33.1:/Users/zoocad/NFSshare /mnt -otcp,rsize=4096,wsize=4096
This is telling mount that
- we want to mount a file system of NFS type (-t NFS)
- the host of this file system has IP address 192.168.33.1
- the directory on that host we wish to mount is /Users/zoocad/NFSshare
- we want this file system to be mounted underneath the local /mnt directory
- data transfer uses TCP protocol (-otcp)
- the read and write operations should use block size of 4096
Running an NFS sever on Ubuntu
We also want to run an NFS server on our Ubuntu Linux OS to enable export of directories to the MaC OS X. First let's make sure we have the following package installed in Ubuntu:
->sudo apt-get install nfs-kernel-server
Here is information on how to setup a Ubuntu server and here is a how-to document.
Edit exports file
In order to export a file system in our host, we need to edit a file called /etc/exports. The file /etc/exports serves as the access control list for file systems which may be exported to NFS clients.
->sudo gedit /etc/exports
Each line contains an export point and a clients allowed to mount the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client.
The notation 192.168.56.0/24 means that all IP addresses between 192.168.56.0 and 192.168.56.255 are allowed clients.
- insecure (must be used when exporting to Mac OS X)
Start NFS sever
Use this command to start the NFS server:
->sudo service nfs-kernel-server start
Mount the exported file systemWe will mount the file system in our Mac OS X client. Open a terminal and type the following commands:
->sudo mount -t nfs 192.168.56.101:/home/svenand /Users/zoocad/linux-vm
- 192.168.56.101 - IP address of NFS server
- /home/svenand - File system on the NFS server
- /Users/zoocad/linux-vm - Mount point on the client
Here is the Finder window showing the svenand file system mounted.
Setting up the TFTP serverNow when we have the Ubuntu file system mounted in Mac OS X we can setup the TFTP server to access the exported file system. Like this:
This means that we never ever have to copy kernel images when we rebuild PetaLinux.Top Previous Next