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