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