tftpput.rst 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. tftpput command
  3. ===============
  4. Synopsis
  5. --------
  6. ::
  7. tftpput address size [[hostIPaddr:]filename]
  8. Description
  9. -----------
  10. The tftpput command is used to transfer a file to a TFTP server.
  11. By default the destination port is 69 and the source port is pseudo-random.
  12. If CONFIG_TFTP_PORT=y, the environment variable *tftpsrcp* can be used to set
  13. the source port and the environment variable *tftpdstp* can be used to set
  14. the destination port.
  15. address
  16. memory address where the data starts
  17. size
  18. number of bytes to be transferred
  19. hostIPaddr
  20. IP address of the TFTP server, defaults to the value of environment
  21. variable *serverip*
  22. filename
  23. path of the file to be written. If not provided, the client's IP address is
  24. used to construct a default file name, e.g. C0.A8.00.28.img for IP address
  25. 192.168.0.40.
  26. Example
  27. -------
  28. In the example the following steps are executed:
  29. * setup client network address
  30. * load a file from the SD-card
  31. * send the file via TFTP to a server
  32. ::
  33. => setenv autoload no
  34. => dhcp
  35. BOOTP broadcast 1
  36. DHCP client bound to address 192.168.1.40 (7 ms)
  37. => load mmc 0:1 $loadaddr test.txt
  38. 260096 bytes read in 13 ms (19.1 MiB/s)
  39. => tftpput $loadaddr $filesize 192.168.1.3:upload/test.txt
  40. Using ethernet@1c30000 device
  41. TFTP to server 192.168.1.3; our IP address is 192.168.1.40
  42. Filename 'upload/test.txt'.
  43. Save address: 0x42000000
  44. Save size: 0x3f800
  45. Saving: #################
  46. 4.4 MiB/s
  47. done
  48. Bytes transferred = 260096 (3f800 hex)
  49. =>
  50. Configuration
  51. -------------
  52. The command is only available if CONFIG_CMD_TFTPPUT=y.
  53. CONFIG_TFTP_BLOCKSIZE defines the size of the TFTP blocks sent. It defaults
  54. to 1468 matching an ethernet MTU of 1500.
  55. If CONFIG_TFTP_PORT=y, the environment variables *tftpsrcp* and *tftpdstp* can
  56. be used to set the source and the destination ports.
  57. CONFIG_TFTP_WINDOWSIZE can be used to set the TFTP window size of transmits
  58. after which an ACK response is required. The window size defaults to 1.
  59. If CONFIG_TFTP_TSIZE=y, the progress bar is limited to 50 '#' characters.
  60. Otherwise an '#' is written per UDP package which may decrease performance.
  61. Return value
  62. ------------
  63. The return value $? is 0 (true) on success and 1 (false) otherwise.