Simon Glass | 257ddc2 | 2024-07-17 09:31:01 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | Script Bootmeth |
| 4 | =============== |
| 5 | |
| 6 | This bootmeth provides a way to locate and run a script on a block or network |
| 7 | device. It can also support SPI flash. |
| 8 | |
| 9 | For a block device the file is read from the selected partition, which must use |
| 10 | a supported filesystem. The subdirectory to search in is defined by the bootstd |
| 11 | list of prefixes (``{"/", "/boot"}`` by default) and can be adjust with the |
| 12 | `filename-prefixes` property in the bootstd device. |
| 13 | |
| 14 | For a network device, the filename is obtained from the `boot_script_dhcp` |
| 15 | environment variable and the file is read using tftp. It must be in the |
| 16 | top-level directory of the tftp server. |
| 17 | |
| 18 | In either case (file or network), the bootmeth searches for the file and creates |
| 19 | a bootflow if found. The bootmeth searches for "boot.scr.uimg" first, then |
| 20 | "boot.scr" if not found. |
| 21 | |
| 22 | For SPI flash, a script is read from flash using the offset provided by the |
| 23 | "script_offset_f" environment variable. |
| 24 | |
| 25 | Some attempt is made to identify the Operating System: so far this only detects |
| 26 | an `Armbian <https://www.armbian.com>`_ |
| 27 | distro. For block devices, if a file called "boot.bmp" exists in the same |
| 28 | directory then it is used as the bootflow logo. |
| 29 | |
| 30 | When the bootflow is booted, the bootmeth sets these environment variables: |
| 31 | |
| 32 | devtype |
| 33 | device type (e.g. "usb", "mmc", "ethernet" or "spi_flash") |
| 34 | |
| 35 | devnum |
| 36 | device number, corresponding to the device 'sequence' number |
| 37 | ``dev_seq(dev)`` |
| 38 | |
| 39 | distro_bootpart |
| 40 | (block devices only) partition number on the device (numbered from 1) |
| 41 | |
| 42 | prefix |
| 43 | prefix used to find the file |
| 44 | |
| 45 | mmc_bootdev |
| 46 | device number (same as `devnum`), set for sunxi mmc devices only |
| 47 | |
| 48 | The script file must be a FIT or a legacy uImage. It is loaded into memory and |
| 49 | executed. |
| 50 | |
| 51 | The compatible string "u-boot,script" is used for the driver. It is present |
| 52 | if `CONFIG_BOOTMETH_SCRIPT` is enabled. |