Heinrich Schuchardt | 8766b78 | 2022-09-03 13:31:04 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
Heinrich Schuchardt | 1b0c316 | 2024-01-14 14:53:13 +0100 | [diff] [blame^] | 3 | .. index:: |
| 4 | single: tftpput (command) |
| 5 | |
Heinrich Schuchardt | 8766b78 | 2022-09-03 13:31:04 +0200 | [diff] [blame] | 6 | tftpput command |
| 7 | =============== |
| 8 | |
| 9 | Synopsis |
| 10 | -------- |
| 11 | |
| 12 | :: |
| 13 | |
| 14 | tftpput address size [[hostIPaddr:]filename] |
| 15 | |
Tom Rini | 4f942f8 | 2022-09-09 14:10:51 -0400 | [diff] [blame] | 16 | Description |
| 17 | ----------- |
Heinrich Schuchardt | 8766b78 | 2022-09-03 13:31:04 +0200 | [diff] [blame] | 18 | |
| 19 | The tftpput command is used to transfer a file to a TFTP server. |
| 20 | |
| 21 | By default the destination port is 69 and the source port is pseudo-random. |
| 22 | If CONFIG_TFTP_PORT=y, the environment variable *tftpsrcp* can be used to set |
| 23 | the source port and the environment variable *tftpdstp* can be used to set |
| 24 | the destination port. |
| 25 | |
| 26 | address |
| 27 | memory address where the data starts |
| 28 | |
| 29 | size |
| 30 | number of bytes to be transferred |
| 31 | |
| 32 | hostIPaddr |
| 33 | IP address of the TFTP server, defaults to the value of environment |
| 34 | variable *serverip* |
| 35 | |
| 36 | filename |
| 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 | |
| 41 | Example |
| 42 | ------- |
| 43 | |
| 44 | In 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 | |
| 70 | Configuration |
| 71 | ------------- |
| 72 | |
| 73 | The command is only available if CONFIG_CMD_TFTPPUT=y. |
| 74 | |
| 75 | CONFIG_TFTP_BLOCKSIZE defines the size of the TFTP blocks sent. It defaults |
| 76 | to 1468 matching an ethernet MTU of 1500. |
| 77 | |
| 78 | If CONFIG_TFTP_PORT=y, the environment variables *tftpsrcp* and *tftpdstp* can |
| 79 | be used to set the source and the destination ports. |
| 80 | |
| 81 | CONFIG_TFTP_WINDOWSIZE can be used to set the TFTP window size of transmits |
| 82 | after which an ACK response is required. The window size defaults to 1. |
| 83 | |
| 84 | If CONFIG_TFTP_TSIZE=y, the progress bar is limited to 50 '#' characters. |
| 85 | Otherwise an '#' is written per UDP package which may decrease performance. |
| 86 | |
| 87 | Return value |
| 88 | ------------ |
| 89 | |
| 90 | The return value $? is 0 (true) on success and 1 (false) otherwise. |