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