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