How to build and test TFTP server if using 4412 development board

In the previous video, the realization of the program that controls the led is introduced. You need to copy the compiled led executable file to the file system, use the make_ext4fs command to recreate the system.img file system, and then burn it to the iTOP- 4412 development board , And then run the led executable file. The disadvantage of this method is that every time the application is modified, the file system needs to be re-created, and the efficiency of re-programming the file system is very low.
This chapter explains how to achieve a first-line transfer files via TFTP, the first virtual machine  Ubuntu  set up a server, client and do a test on a virtual machine Ubuntu.
TFTP (Trivial File Transfer Protocol, Trivial File Transfer Protocol) is a protocol based on UDP protocol for simple file transfer between client and server, suitable for low-cost and uncomplicated applications. The TFTP protocol is specially designed for small file transfer. It can only obtain files from the server or write files to the server, but cannot list directories or perform authentication.
The supporting video for this chapter is: "Video 08 TFTP Server Construction and Testing"
Learning method of Linux network part
I won't bother to introduce the TFTP protocol here. It is of little significance. It is mainly to teach you how to operate and make progress in the process. The network protocol is very complicated. If one person reads the information through the complete network protocol, it is estimated that this life will pass. In this huge network project, different engineers do different tasks. As an embedded  linux engineer, what you have to do is to transplant things done by others and improve the embedded functions.
In fact, all the functions on the embedded system have been transplanted from the PC from the very beginning. Many codes and software have been implemented on the PC.  The development of the embedded  ARM processor is relatively lagging behind (the popularity of ARM was in 2000). The next thing), so transplanting on the embedded system has become a very important ability.
19.1 Setting up the Ubuntu server
Open the terminal on the virtual machine Ubuntu, as shown below.
First enter the command "sudo apt-get install xinetd" to install xinetd, as shown in the figure below.
After installing xinetd, as shown below.
Then enter the command "sudo apt-get install tftp tftpd" to install tftp and tftpd, as shown below.
After the installation is complete, as shown below.
Then create the TFTP configuration file, and use the command "vi /etc/xinetd.d/tftp" to create the file, as shown in the figure below.
Write the following:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/tftpboot/
disable = no
per_source = 11
cps = 100 2
flags= IPv4
}
As shown below.
Note: As shown in the figure above, this file must be aligned strictly according to the above format after pasting the content.
Exit and save. The /var/tftpboot directory set by server_args is the directory of the tftp server, and the TFTP client obtains the files on the server from this directory. Use the command mkdir /var/tftpboot to create the directory of the tftp server, as shown in the figure below.
Then set the access permission of /var/tftpboot to 777, as shown in the figure below.
Input: sudo /etc/init.d/xinetd restart command to restart the xinetd service, as shown in the figure below.
The server is set up at this step, and we will test it later.
Server test
Local test: Create a file test under /var/tftpboot, enter hello world in it, and then save the file, as shown in the figure below.
Start another terminal, as shown below.
Then enter: tftp 127.0.0.1, as shown below.
Enter get test to get the test file, as shown in the figure below.
In the above figure, you can see that 13 bytes of test information are obtained, and then enter q to exit tftp, as shown in the following figure.
Then enter ls to check whether there is a test file in the current directory. After checking, it is found that there should be a test file in the current directory. This is the test file in the /var/tftpboot directory, as shown in the figure below.
Use the cat command to view the contents of the test file, as shown in the figure below.
Through the screenshot above, you can see that the content in the test file is hello world, which is the same as the test in the /var/tftpboot directory. So far, the configuration and testing of the TFTP server side is complete.

Guess you like

Origin blog.csdn.net/mucheni/article/details/113179895