summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/tftpsrv.rst
blob: d067afdba57eb869d43bf2ed17849b4c223492c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.. SPDX-License-Identifier: GPL-2.0+

.. index::
   single: tftpsrv (command)

tftpsrv command
===============

Synopsis
--------

::

    tftpsrv [loadAddress]

Description
-----------

The tftpsrv command listens for an incoming TFTP write request and receives
the first transferred file into memory.

loadAddress
    memory address where the received file is stored. If not provided, the
    address is taken from the *loadaddr* environment variable or the default
    image load address.

After a successful transfer, the *fileaddr* and *filesize* environment
variables describe the received file. The command returns successfully after
the transfer has completed. It does not boot the file automatically; boot
scripts can use commands such as bootm, booti or bootefi to boot from the
load address.

The transfer is aborted if no transfer has started after about 50 seconds or
if Ctrl-C is pressed.

Example
-------

In the example the following steps are executed:

* setup the board network address
* receive a FIT image from a host
* boot the received FIT image

::

    => setenv autoload no
    => dhcp
    BOOTP broadcast 1
    DHCP client bound to address 192.168.1.40 (7 ms)
    => tftpsrv $loadaddr
    Using ethernet@1c30000 device
    Listening for TFTP transfer on 192.168.1.40
    Load address: 0x42000000
    Loading: #################################################################
             6.5 MiB/s
    done
    Bytes transferred = 1048576 (100000 hex)
    => bootm $fileaddr

On the host, send the file to the board while U-Boot is listening:

::

    $ curl --upload-file image.fit tftp://192.168.1.40/image.fit

Configuration
-------------

The command is only available if CONFIG_CMD_TFTPSRV=y.

The command is supported by both the legacy network stack and the lwIP network
stack.