blob: 6c048b7bdac9d9455cfec77f6a25efbf0fa5b220 [file] [log] [blame]
Heinrich Schuchardt09c14442022-02-18 19:33:09 +01001.. SPDX-License-Identifier: GPL-2.0+:
2
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01003.. index::
4 single: fatload (command)
5
Heinrich Schuchardt09c14442022-02-18 19:33:09 +01006fatload command
7===============
8
9Synopsis
10--------
11
12::
13
14 fatload <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
15
16Description
17-----------
18
19The fatload command is used to read a file from a FAT filesystem into memory.
20You can always use the :doc:`load command <load>` instead.
21
22The number of transferred bytes is saved in the environment variable filesize.
23The load address is saved in the environment variable fileaddr.
24
25interface
26 interface for accessing the block device (mmc, sata, scsi, usb, ....)
27
28dev
29 device number
30
31part
32 partition number, defaults to 0 (whole device)
33
34addr
35 load address, defaults to environment variable loadaddr or if loadaddr is
36 not set to configuration variable CONFIG_SYS_LOAD_ADDR
37
38filename
39 path to file, defaults to environment variable bootfile
40
41bytes
42 maximum number of bytes to load
43
44pos
45 number of bytes to skip
46
47addr, bytes, pos are hexadecimal numbers.
48
49If either 'pos' or 'bytes' are not aligned according to the minimum alignment
50requirement for DMA transfer (ARCH_DMA_MINALIGN) additional buffering will be
51used, a misaligned buffer warning will be printed, and performance will suffer
52for the load.
53
54Example
55-------
56
57::
58
59 => fatload mmc 0:1 ${kernel_addr_r} snp.efi
60 149280 bytes read in 11 ms (12.9 MiB/s)
61 =>
62 => fatload mmc 0:1 ${kernel_addr_r} snp.efi 1000000
63 149280 bytes read in 9 ms (15.8 MiB/s)
64 =>
65 => fatload mmc 0:1 ${kernel_addr_r} snp.efi 1000000 100
66 149024 bytes read in 10 ms (14.2 MiB/s)
67 =>
68 => fatload mmc 0:1 ${kernel_addr_r} snp.efi 10
69 16 bytes read in 1 ms (15.6 KiB/s)
70 =>
71
72Configuration
73-------------
74
75The fatload command is only available if CONFIG_CMD_FAT=y.
76
77Return value
78------------
79
80The return value $? is set to 0 (true) if the file was successfully loaded
81even if the number of bytes is less then the specified length.
82
83If an error occurs, the return value $? is set to 1 (false).