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