blob: 48bedf1e845093e6d989d067f301d9c51e94a538 [file] [log] [blame]
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +08001.. SPDX-License-Identifier: GPL-2.0+:
2
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01003.. index::
4 single: wget (command)
5
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +08006wget command
7============
8
9Synopsis
10--------
11
12::
Heinrich Schuchardt311fe212022-12-22 11:32:03 +010013
Jerome Forissierd67fae62024-11-18 10:18:01 +010014 wget [address] [host:]path
15 wget [address] url # lwIP only
16
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +080017
18Description
19-----------
20
Jerome Forissierd67fae62024-11-18 10:18:01 +010021The wget command is used to download a file from an HTTP(S) server.
22In order to use HTTPS you will need to compile wget with lwIP support.
23
24Legacy syntax
25~~~~~~~~~~~~~
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +080026
Jerome Forissierd67fae62024-11-18 10:18:01 +010027The legacy syntax is supported by the legacy network stack (CONFIG_NET=y)
28as well as by the lwIP base network stack (CONFIG_NET_LWIP=y). It supports HTTP
29only.
30
Marek Vasut22a95082023-12-13 22:11:13 +010031By default the destination port is 80 and the source port is pseudo-random.
Jerome Forissierd67fae62024-11-18 10:18:01 +010032On the legacy nework stack the environment variable *httpdstp* can be used to
33set the destination port
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +080034
35address
36 memory address for the data downloaded
37
Jerome Forissierd67fae62024-11-18 10:18:01 +010038host
39 IP address (or host name if `CONFIG_CMD_DNS` is enabled) of the HTTP
40 server, defaults to the value of environment variable *serverip*.
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +080041
42path
43 path of the file to be downloaded.
44
Jerome Forissierd67fae62024-11-18 10:18:01 +010045New syntax (lwIP only)
46~~~~~~~~~~~~~~~~~~~~~~
47
48In addition to the syntax described above, wget accepts URLs if the network
49stack is lwIP.
50
51address
52 memory address for the data downloaded
53
54url
55 HTTP or HTTPS URL, that is: http[s]://<host>[:<port>]/<path>.
56
57Examples
58--------
59
60Example with the legacy network stack
61~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +080062
63In the example the following steps are executed:
64
65* setup client network address
66* download a file from the HTTP server
67
68::
69
70 => setenv autoload no
71 => dhcp
72 BOOTP broadcast 1
73 *** Unhandled DHCP Option in OFFER/ACK: 23
74 *** Unhandled DHCP Option in OFFER/ACK: 23
75 DHCP client bound to address 192.168.1.105 (210 ms)
76 => wget ${loadaddr} 192.168.1.254:/index.html
77 HTTP/1.0 302 Found
78 Packets received 4, Transfer Successful
79
Jerome Forissierd67fae62024-11-18 10:18:01 +010080Example with lwIP
81~~~~~~~~~~~~~~~~~
82
83In the example the following steps are executed:
84
85* setup client network address
86* download a file from the HTTPS server
87
88::
89
90 => dhcp
91 DHCP client bound to address 10.0.2.15 (3 ms)
92 => wget https://download.rockylinux.org/pub/rocky/9/isos/aarch64/Rocky-9.4-aarch64-minimal.iso
93 ##########################################################################
94 ##########################################################################
95 ##########################################################################
96 [...]
97 1694892032 bytes transferred in 492181 ms (3.3 MiB/s)
98 Bytes transferred = 1694892032 (65060000 hex)
99
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +0800100Configuration
101-------------
102
103The command is only available if CONFIG_CMD_WGET=y.
Jerome Forissierd67fae62024-11-18 10:18:01 +0100104To enable lwIP support set CONFIG_NET_LWIP=y.
105
106TCP Selective Acknowledgments in the legacy network stack can be enabled via
107CONFIG_PROT_TCP_SACK=y. This will improve the download speed. Selective
108Acknowledgments are enabled by default with lwIP.
109
110.. note::
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +0800111
Jerome Forissierd67fae62024-11-18 10:18:01 +0100112 U-Boot currently has no way to verify certificates for HTTPS.
113 A place to store the root CA certificates is needed, and then MBed TLS would
114 need to walk the entire chain. Therefore, man-in-the middle attacks are
115 possible and HTTPS should not be relied upon for payload authentication.
Ying-Chun Liu (PaulLiu)2dbb7a42022-11-08 14:17:30 +0800116
117Return value
118------------
119
120The return value $? is 0 (true) on success and 1 (false) otherwise.