This article is all setting up NFS for MicroZed Zynq AVNET. It becomes extremely easy if we have NFS setup for development process. There are two sides of NFS - client and server. The client is the Zedboard and the server is the Ubuntu 18.04. First we will go through the server side like what configration we need to do in order to support NFS.
NFS Server Installation - I didn’t have to install NFS server on Ubuntu 18.04. It supported the NFS by default. In case you don’t have you can install or re-install the NFS Kernel server.
Setup for NFS Server - I am using Ubuntu 18.04 on Windows 10 host machine. I had a little trouble in getting the NFS server running on Ubuntu 18.04. But, I figured out that Ubuntu 18.04 was disabled for nfs version 2. However, my embedded linux was using NFS version 2.
How to find what NFS Server version is enabled or disabled by Ubuntu
The ‘-2’ here tells that the nfsd is disabled for the version number ‘2’. Thus, we need to enable the version 2 for NFS server.
How to enable NFS Server version 2 in Ubuntu
Go to the following file.
Now, edit this file to include the version 2. First, find the line saying - “RPCNFSDCOUNT=8”. Change this to include Version 2 also. Update/edit as follows to enable NFSv2 on Ubuntu Linux.
Here is how my entire file looks like.
Now, restart the NFS Kernel service.
*Check the nfsd version afterwards
+2 means it is enabled.
How to check the NFS Server status Ubuntu 18.04 uses Systemd to manage services. In order to check the nfs server status. We could run the following command.
How to export the microzed root file system in Ubuntu 18.04 You need to be very careful while extracting the microzed root file system. If accidentally, you place the microzed root file system on your machine’s root file system then nothing will work. The reason is that microzed root file system is built for ARM and not X86. So, be super careful while extracting the microzed root file system. Here is how I do.
How to give appropriate permission to the microzed rootfile system
How to export the root file system so that it can be read by the NFS client This is pretty important step, we should be able to export the folder so that the NFS client can read it. Go to the /etc/exports file first. Add the following line to tell that you want to share this folder rootf_microzed using the interface 11.11.0.0/16. Thus, any client who are in the same subnet can read this folder. You could have given * instead of 11.11.0.0/16 to export to the world.
Now, run the following command to see whether you are exporting this folder correctly or not. The below command and the output tells me that I am exporting the rootfs_microzed folder through 11.11.0.0/16 interface.
Other primary services to check for You need to ensure that these services are running properly. Otherwise, the above command can fail.
How to re-export the NFS kernel server folder This pretty simple. You just need to run the following command in order to re-export the folders.
How to tell firewall to allow the NFS connection I didn’t get into this problem but you could use the following command to tell the iptables i.e linux firewall to allow any connection coming from the interface 11.11.0.0/16. Probably, it is not a secure way to allow NFS connection but if it is a private connection then it really doesn’t matter.
Setup for NFS Client - Zynq Zedboard This is pretty straight forward. If you have followed my tutorial on bringing up zedboard then this is pretty straight forward. By default kernel configuration, the zynq zedboard will enable the NFS version 2.
Setting up Bootargs This is pretty important step. What I have done is that I have changed the uboot uEnv.txt bootargs to
or you can change the bootargs on the uboot prompt.
Here 11.11.11.19 is my Ubuntu 18.04 interface IP address. So, the above command will read the NFS folder rootfs_microzed from the nfs server 11.11.11.19. The earlyprintk ensures that we see some log messages on the serial port until the kernel serial port is setup by the kernel. The console parameters are same - device - ttyPS0 and the baud rate 115200.
Here is the core-image-minimal-microzed-zynq tar rootfs tar file for you to download. microzed root fs
Troubleshooting NFS in general
Ensure that the embedded zynq kernel has the following configuration turned on.
Here is the way to check these configurations in yocto
In case the above command fails, then do install the ncurses package so that the graphics can be rendered.
Now, check the NFS configuration in the kernel, in the menuconfig do the following. Escape and forward slash i.e. ‘/’ and type NFS in the search configuration parameter window. You should check for NFS_COMMON , NFS_FS, NFS_V2, ROOTFS_NFS. They all should be set to ‘y’.
After changing the menuconfig, you might need to recompile the kernel. In Yocto, we do this using the following command.
Also, if it is still not working then it worth to check using wireshark and check for NFS protocol. Here is the screen shot of wireshark. You should see something like this. Here 11.11.11.19 is the server ip address and 11.11.11.18 is the NFS client i.e. zynq zedboard.
This brings an end to this article.