1.. SPDX-License-Identifier: GPL-2.0+:
2
3load command
4============
5
6Synopsis
7--------
8
9::
10
11    load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
12
13Description
14-----------
15
16The load command is used to read a file from a filesystem into memory.
17
18The number of transferred bytes is saved in the environment variable filesize.
19The load address is saved in the environment variable fileaddr.
20
21interface
22    interface for accessing the block device (mmc, sata, scsi, usb, ....)
23
24dev
25    device number
26
27part
28    partition number, defaults to 0 (whole device)
29
30addr
31    load address, defaults to environment variable loadaddr or if loadaddr is
32    not set to configuration variable CONFIG_SYS_LOAD_ADDR
33
34filename
35    path to file, defaults to environment variable bootfile
36
37bytes
38    maximum number of bytes to load
39
40pos
41    number of bytes to skip
42
43addr, bytes, pos are hexadecimal numbers.
44
45Example
46-------
47
48::
49
50    => load mmc 0:1 ${kernel_addr_r} snp.efi
51    149280 bytes read in 11 ms (12.9 MiB/s)
52    =>
53    => load mmc 0:1 ${kernel_addr_r} snp.efi 1000000
54    149280 bytes read in 9 ms (15.8 MiB/s)
55    =>
56    => load mmc 0:1 ${kernel_addr_r} snp.efi 1000000 100
57    149024 bytes read in 10 ms (14.2 MiB/s)
58    =>
59    => load mmc 0:1 ${kernel_addr_r} snp.efi 10
60    16 bytes read in 1 ms (15.6 KiB/s)
61    =>
62
63Configuration
64-------------
65
66The load command is only available if CONFIG_CMD_FS_GENERIC=y.
67
68Return value
69------------
70
71The return value $? is set to 0 (true) if the file was successfully loaded
72even if the number of bytes is less then the specified length.
73
74If an error occurs, the return value $? is set to 1 (false).
75