Difference between revisions of "Setting up tftp and nfs"

From DAVE Developer's Wiki
Jump to: navigation, search
Line 10: Line 10:
 
===Introduction===
 
===Introduction===
  
Especially during development, user would like to be able to interact with the target system. This section describes how to configure your host system for this purpose.
+
Especially during development, you would like to be able to have full control over the target system. This section describes how to configure your host system for this purpose.
  
 
==== How to configure a TFTP Server ====
 
==== How to configure a TFTP Server ====
One of the most useful features of a bootloader during development is the possibility to download the Linux kernel from the network. This saves a lot of time because developer doesn't have to flash the image in NOR every time he/she modifies it. U-Boot implements the TFTP protocol (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 host Linux distribution:
+
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
  
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.
 
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:
+
* For '''Debian/Ubuntu 8.x''':
download the atftp package with the preferred method. For example, run sudo apt-get install atftp
+
** download the atftp package with the preferred method. For example, run sudo apt-get install atftp
edit the /etc/default/atftp and change the USE_INETD to false
+
** edit the /etc/default/atftp and change the USE_INETD to false
create the tftp root directory: sudo mkdir /tftpboot
+
** create the tftp root directory: sudo mkdir /tftpboot
assign the permission: sudo chmod -R 777 /tftpboot and sudo chown -R nobody /tftpboot
+
** assign the permission: sudo chmod -R 777 /tftpboot and sudo chown -R nobody /tftpboot
start the server: sudo /etc/init.d/atftpd start
+
** start the server: sudo /etc/init.d/atftpd start
 +
 
 
To change the tftp root directory, user should edit the /etc/default/atftp file.
 
To change the tftp root directory, user should edit the /etc/default/atftp file.
  
 
==== How to configure a NFS Server ====
 
==== 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.
  
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. User could split the file system in different parts, mounting them from different media (flash, network, usb...). But 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, the developer can quickly modify the root file system, even “on the fly” (meaning that the file system can be modified while the system is running).
+
* For '''Debian/Ubuntu 8.x''':
The most common way to setup a system like the one described is through NFS. As for tftp, installation and configuration depends on the host linux distribution.
+
** 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
For Debian/Ubuntu 8.x:
+
** 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.
download the nfs packages with the preferred method. For example, run sudo apt-get install nfs-kernel-server nfs-common portmap
+
<pre>
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:
 
 
/home/user *(rw,sync,no_root_squash)
 
/home/user *(rw,sync,no_root_squash)
This line exports the "/home/user" directory with read and write permissions to all hosts.
+
</pre>
Save the file and restart the server: sudo /etc/init.d/nfs-kernel-server restart
+
** 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.
 
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.

Revision as of 13:31, 20 July 2012

Info Box
Tux.png Applies to Linux
Tux.png Applies to U-Boot
Android-logo.jpg Applies to Android

Introduction[edit | edit source]

Especially during development, you would like to be able to have full control over the target system. This section describes how to configure your host system for this purpose.

How to configure a TFTP Server[edit | edit source]

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 atftp package with the preferred method. For example, run sudo apt-get install atftp
    • edit the /etc/default/atftp 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/atftp file.

How to configure a NFS Server[edit | edit source]

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.
		/home/user *(rw,sync,no_root_squash)
    • 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.