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