0 PrefaceSome time ago, I purchased the easyarm I. mx287 Development Board developed by Zhou ligong. The work of the previous three months was also related to Linux. I used easyarm of Zhou ligong to summarize several notes during Linux development. This article describes how to install the TFTP server in Ubuntu. Compile a script for flashing the led in Ubuntu and log on to easyarm using the serial port, in easyarm, the script file in the host is obtained through the tftp command of busybox. After the executable permission is added, the script file is run, and the LED light flashes at intervals.
1. Install TFTP[1] create a directory and modify the permissions. Create a folder named tftpboot in the user directory and modify the permissions. This directory contains all the files to be exchanged through TFTP, which can be called the tftp root directory. Mkdir tftpboot chmod-r 777 tftpboot
[2] before installing TFTP and tftpd, update the software source sudo apt-Get Update to install TFTP, tftpd, and sudo apt-Get install tftpd TFTP Xinetd, where TFTP is the client, TFTP is the server side, and xinetd is the Linux super daemon process.
[3] modify the configuration file and create a tftpd configuration file sudo VI/etc/xinetd. d/TFTP under/etc/xinetd/
service tftp{ socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /home/<user>/tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4}Server_args =-S/home/<user>/tftpboot
Specify the tftp root directory. All files exchanged by TFTP are stored in this directory.
[4] Run xinetdsudo/etc/init again. d/xinetd restart [5] Check the configuration is successful. The following output indicates that the console is working normally. sudo netstat-A | grep TFTP # Return the result. UDP runs normally 0 0 *: TFTP *:*
2. Use TFTP[In ubuntu] [1] compile the script-blink. Sh
#!/bin/shLEDFILE=/sys/class/leds/led-err/brightnessfor i in $( seq 1 10 )do echo 1 >$LEDFILE sleep 1 echo 0 >$LEDFILE sleep 1 echo "LED Blink!"done
[2] copy to the tftp root directory CP blink ~ /Tftpboot
[In easyarm] [1] set the IP address and try to ping ubuntu. If no IP address is set, you can use ifconfig to set the IP address of the target board, ensure that the target board and virtual machine are in the same network segment. Ifconfig eth0 192.168.1.211 when the host's IP address is 192.168.1.106, you can try to ping the host from the virtual machine to ping 192.168.1.106-C 4
[2] obtain the file TFTP-G-r blink. Sh 192.168.1.106 [note] [1] easyarm uses the busybox toolbox. the TFTP commands in this toolbox are different from those in Debian/ubuntu. [2] The-G parameter is obtained. The-R parameter indicates the remote host, and blink. Sh indicates the file name. In this case, the file name in the arm and Ubuntu host is the same. 192.168.1.106 is the address of the TFTP server. For more information, see [2.
[3] modify the execution permission and execute chmod A + x blink. Sh./blink. Sh.
3. Conclusion[1] There are differences between busybox commands in arm and Ubuntu commands. [2] TFTP-G-r <File Name> <IP address> obtain files from the remote host in arm.
4 references[1] setting up the TFTP service in Ubuntu [2] using the TFTP Command in busybox [3] using the cyclic statements for, while, and until in shell scripts [4] Linux super daemon xinetd