Setting up tftp and nfs
Especially during the development phase, you would like to be able to have full control over the target system boot process. This section describes how to configure your host system for this purpose.
How to configure a TFTP Server
One of the most useful features of a bootloader during development is the capability to download the Linux kernel from the network. This saves a lot of time because you don't have to flash the image in flash NOR every time you want to try a different one. U-Boot implements the a TFTP client (see the tftp command), so the host system must be configured to enable the TFTP service. Installation and configuration of a tftp server depends on the Linux distribution running on the host machine:
- For Fedora/Red Hat:
- if not included in the distribution, download the tftp package with the preferred method. For example, run yum install tftp-server
- edit the configuration file /etc/xinetd.d/tftp and change the option disable from yes to no
- create the tftp root directory: mkdir /tftpboot
- assign the permission: chmod -R 777 /tftpboot and chown -R nobody /tftpboot
- run chkconfig tftp on
- restart xinetd: /etc/init.d/xinetd restart
To change the tftp root directory, user should edit the /etc/xinetd.d/tftp file and modify the server_args option.
- For Debian/Ubuntu 8.x:
- download the atftpd package with the preferred method. For example, run sudo apt-get install atftpd
- edit the /etc/default/atftpd and change the USE_INETD to false
- create the tftp root directory: sudo mkdir /tftpboot
- assign the permission: sudo chmod -R 777 /tftpboot and sudo chown -R nobody /tftpboot
- start the server: sudo /etc/init.d/atftpd start
To change the tftp root directory, user should edit the /etc/default/atftpd file.
Please note that, beside atftpd, there are other software packages providing a tftp server, e.g. tftpd-hpa and tftpd.
How to configure a NFS Server
One of the most important components of a Linux system is the root file system. A good development root file system provides the developer with all the useful tools that can help him/her on his/her work. Such a root file system can become very big in size, so it's hard to store it in flash memory. So the most convenient thing is to mount the whole root file system from the network, allowing the host system and the target to share the same files. In such a way, you can quickly modify the root file system, even “on the fly” (meaning that the file system can be modified while the system is running). The most common way to setup a system like the one described is through NFS. As for tftp, installation and configuration depends on the Linux distribution on the host.
- For Debian/Ubuntu 8.x:
- download the nfs packages with the preferred method. For example, run sudo apt-get install nfs-kernel-server nfs-common portmap
- when configuring portmap, do not bind loopback. If loopback is bound, reconfigure portmap (sudo dpkg-reconfigure portmap), then restart it: sudo /etc/init.d/portmap restart
- NFS exports from a server are controlled by the file /etc/exports. So, to export the directory /home/user, edit the /etc/exports file adding the following line. This line exports the "/home/user" directory with read and write permissions to all hosts.
- Save the file and restart the server: sudo /etc/init.d/nfs-kernel-server restart
For other distributions, the procedure will be very similar: the NFS configuration is always modified editing the /etc/exports file. The packages names, the method to install them and how to restart the servers may vary.