Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 2 | |
| 3 | Generic Distro Configuration Concept |
| 4 | ==================================== |
| 5 | |
| 6 | Linux distributions are faced with supporting a variety of boot mechanisms, |
| 7 | environments or bootloaders (PC BIOS, EFI, U-Boot, Barebox, ...). This makes |
| 8 | life complicated. Worse, bootloaders such as U-Boot have a configurable set |
| 9 | of features, and each board chooses to enable a different set of features. |
| 10 | Hence, distros typically need to have board-specific knowledge in order to |
| 11 | set up a bootable system. |
| 12 | |
| 13 | This document defines a common set of U-Boot features that are required for |
| 14 | a distro to support the board in a generic fashion. Any board wishing to |
| 15 | allow distros to install and boot in an out-of-the-box fashion should enable |
| 16 | all these features. Linux distros can then create a single set of boot |
| 17 | support/install logic that targets these features. This will allow distros |
| 18 | to install on many boards without the need for board-specific logic. |
| 19 | |
| 20 | In fact, some of these features can be implemented by any bootloader, thus |
| 21 | decoupling distro install/boot logic from any knowledge of the bootloader. |
| 22 | |
| 23 | This model assumes that boards will load boot configuration files from a |
| 24 | regular storage mechanism (eMMC, SD card, USB Disk, SATA disk, etc.) with |
Masahiro Yamada | 28fd00b | 2015-07-07 18:47:17 +0900 | [diff] [blame] | 25 | a standard partitioning scheme (MBR, GPT). Boards that cannot support this |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 26 | storage model are outside the scope of this document, and may still need |
| 27 | board-specific installer/boot-configuration support in a distro. |
| 28 | |
| 29 | To some extent, this model assumes that a board has a separate boot flash |
| 30 | that contains U-Boot, and that the user has somehow installed U-Boot to this |
| 31 | flash before running the distro installer. Even on boards that do not conform |
| 32 | to this aspect of the model, the extent of the board-specific support in the |
| 33 | distro installer logic would be to install a board-specific U-Boot package to |
Masahiro Yamada | 28fd00b | 2015-07-07 18:47:17 +0900 | [diff] [blame] | 34 | the boot partition during installation. This distro-supplied U-Boot can still |
| 35 | implement the same features as on any other board, and hence the distro's boot |
| 36 | configuration file generation logic can still be board-agnostic. |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 37 | |
| 38 | Locating Bootable Disks |
| 39 | ----------------------- |
| 40 | |
| 41 | Typical desktop/server PCs search all (or a user-defined subset of) attached |
| 42 | storage devices for a bootable partition, then load the bootloader or boot |
| 43 | configuration files from there. A U-Boot board port that enables the features |
| 44 | mentioned in this document will search for boot configuration files in the |
| 45 | same way. |
| 46 | |
| 47 | Thus, distros do not need to manipulate any kind of bootloader-specific |
| 48 | configuration data to indicate which storage device the system should boot |
| 49 | from. |
| 50 | |
| 51 | Distros simply need to install the boot configuration files (see next |
| 52 | section) in an ext2/3/4 or FAT partition, mark the partition bootable (via |
| 53 | the MBR bootable flag, or GPT legacy_bios_bootable attribute), and U-Boot (or |
| 54 | any other bootloader) will find those boot files and execute them. This is |
| 55 | conceptually identical to creating a grub2 configuration file on a desktop |
| 56 | PC. |
| 57 | |
Masahiro Yamada | 28fd00b | 2015-07-07 18:47:17 +0900 | [diff] [blame] | 58 | Note that in the absence of any partition that is explicitly marked bootable, |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 59 | U-Boot falls back to searching the first valid partition of a disk for boot |
| 60 | configuration files. Other bootloaders are recommended to do the same, since |
| 61 | I believe that partition table bootable flags aren't so commonly used outside |
| 62 | the realm of x86 PCs. |
| 63 | |
| 64 | U-Boot can also search for boot configuration files from a TFTP server. |
| 65 | |
| 66 | Boot Configuration Files |
| 67 | ------------------------ |
| 68 | |
| 69 | The standard format for boot configuration files is that of extlinux.conf, as |
| 70 | handled by U-Boot's "syslinux" (disk) or "pxe boot" (network). This is roughly |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 71 | as specified at `Boot Loader Specification`_: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 72 | |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 73 | |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 74 | ... with the exceptions that the Boot Loader Specification document: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 75 | |
| 76 | * Prescribes a separate configuration per boot menu option, whereas U-Boot |
| 77 | lumps all options into a single extlinux.conf file. Hence, U-Boot searches |
| 78 | for /extlinux/extlinux.conf then /boot/extlinux/extlinux.conf on disk, or |
| 79 | pxelinux.cfg/default over the network. |
| 80 | |
| 81 | * Does not document the fdtdir option, which automatically selects the DTB to |
| 82 | pass to the kernel. |
| 83 | |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 84 | See also doc/README.pxe under 'pxe file format'. |
| 85 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 86 | One example extlinux.conf generated by the Fedora installer is:: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 87 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 88 | # extlinux.conf generated by anaconda |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 89 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 90 | ui menu.c32 |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 91 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 92 | menu autoboot Welcome to Fedora. Automatic boot in # second{,s}. Press a key for options. |
| 93 | menu title Fedora Boot Options. |
| 94 | menu hidden |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 95 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 96 | timeout 50 |
| 97 | #totaltimeout 9000 |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 98 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 99 | default Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae) 22 (Rawhide) |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 100 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 101 | label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl) 22 (Rawhide) |
| 102 | kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl |
| 103 | append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf |
| 104 | fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl |
| 105 | initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl.img |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 106 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 107 | label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae) 22 (Rawhide) |
| 108 | kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae |
| 109 | append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf |
| 110 | fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae |
| 111 | initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae.img |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 112 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 113 | label Fedora-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc (0-rescue-8f6ba7b039524e0eb957d2c9203f04bc) |
| 114 | kernel /boot/vmlinuz-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc |
| 115 | initrd /boot/initramfs-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc.img |
| 116 | append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 |
| 117 | fdtdir /boot/dtb-3.16.0-0.rc6.git1.1.fc22.armv7hl+lpae |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 118 | |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 119 | |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 120 | One example of hand-crafted extlinux.conf:: |
| 121 | |
| 122 | menu title Select kernel |
| 123 | timeout 100 |
| 124 | |
| 125 | label Arch with uart devicetree overlay |
| 126 | kernel /arch/Image.gz |
| 127 | initrd /arch/initramfs-linux.img |
| 128 | fdt /dtbs/arch/board.dtb |
| 129 | fdtoverlays /dtbs/arch/overlay/uart0-gpio0-1.dtbo |
| 130 | append console=ttyS0,115200 console=tty1 rw root=UUID=fc0d0284-ca84-4194-bf8a-4b9da8d66908 |
| 131 | |
| 132 | label Arch with uart devicetree overlay but with Boot Loader Specification keys |
| 133 | kernel /arch/Image.gz |
| 134 | initrd /arch/initramfs-linux.img |
| 135 | devicetree /dtbs/arch/board.dtb |
| 136 | devicetree-overlay /dtbs/arch/overlay/uart0-gpio0-1.dtbo |
| 137 | append console=ttyS0,115200 console=tty1 rw root=UUID=fc0d0284-ca84-4194-bf8a-4b9da8d66908 |
| 138 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 139 | Another hand-crafted network boot configuration file is:: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 140 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 141 | TIMEOUT 100 |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 142 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 143 | MENU TITLE TFTP boot options |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 144 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 145 | LABEL jetson-tk1-emmc |
| 146 | MENU LABEL ../zImage root on Jetson TK1 eMMC |
| 147 | LINUX ../zImage |
| 148 | FDTDIR ../ |
| 149 | APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=80a5a8e9-c744-491a-93c1-4f4194fd690b |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 150 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 151 | LABEL venice2-emmc |
| 152 | MENU LABEL ../zImage root on Venice2 eMMC |
| 153 | LINUX ../zImage |
| 154 | FDTDIR ../ |
| 155 | APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=5f71e06f-be08-48ed-b1ef-ee4800cc860f |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 156 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 157 | LABEL sdcard |
| 158 | MENU LABEL ../zImage, root on 2GB sdcard |
| 159 | LINUX ../zImage |
| 160 | FDTDIR ../ |
| 161 | APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=b2f82cda-2535-4779-b467-094a210fbae7 |
| 162 | |
| 163 | LABEL fedora-installer-fk |
| 164 | MENU LABEL Fedora installer w/ Fedora kernel |
| 165 | LINUX fedora-installer/vmlinuz |
| 166 | INITRD fedora-installer/initrd.img.orig |
| 167 | FDTDIR fedora-installer/dtb |
| 168 | APPEND loglevel=8 ip=dhcp inst.repo=http://10.0.0.2/mirrors/fedora/linux/development/rawhide/armhfp/os/ rd.shell cma=64M |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 169 | |
| 170 | U-Boot Implementation |
| 171 | ===================== |
| 172 | |
| 173 | Enabling the distro options |
| 174 | --------------------------- |
| 175 | |
Hans de Goede | 9f82361 | 2016-06-20 23:16:28 +0200 | [diff] [blame] | 176 | In your board's defconfig, enable the DISTRO_DEFAULTS option by adding |
| 177 | a line with "CONFIG_DISTRO_DEFAULTS=y". If you want to enable this |
| 178 | from Kconfig itself, for e.g. all boards using a specific SoC then |
Masahiro Yamada | 7325f6c | 2018-04-25 18:47:52 +0900 | [diff] [blame] | 179 | add a "imply DISTRO_DEFAULTS" to your SoC CONFIG option. |
Hans de Goede | 9f82361 | 2016-06-20 23:16:28 +0200 | [diff] [blame] | 180 | |
Simon Glass | e7b2ce1 | 2022-04-24 23:31:26 -0600 | [diff] [blame] | 181 | |
| 182 | TO BE UPDATED: |
| 183 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 184 | In your board configuration file, include the following:: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 185 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 186 | #ifndef CONFIG_SPL_BUILD |
| 187 | #include <config_distro_bootcmd.h> |
| 188 | #endif |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 189 | |
| 190 | The first of those headers primarily enables a core set of U-Boot features, |
| 191 | such as support for MBR and GPT partitions, ext* and FAT filesystems, booting |
| 192 | raw zImage and initrd (rather than FIT- or uImage-wrapped files), etc. Network |
| 193 | boot support is also enabled here, which is useful in order to boot distro |
| 194 | installers given that distros do not commonly distribute bootable install |
| 195 | media for non-PC targets at present. |
| 196 | |
| 197 | Finally, a few options that are mostly relevant only when using U-Boot- |
| 198 | specific boot.scr scripts are enabled. This enables distros to generate a |
| 199 | U-Boot-specific boot.scr script rather than extlinux.conf as the boot |
| 200 | configuration file. While doing so is fully supported, and |
Adam Ford | ba8bf94 | 2018-02-06 07:49:32 -0600 | [diff] [blame] | 201 | CONFIG_DISTRO_DEFAULTS exposes enough parameterization to boot.scr to |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 202 | allow for board-agnostic boot.scr content, this document recommends that |
| 203 | distros generate extlinux.conf rather than boot.scr. extlinux.conf is intended |
| 204 | to work across multiple bootloaders, whereas boot.scr will only work with |
| 205 | U-Boot. TODO: document the contract between U-Boot and boot.scr re: which |
| 206 | environment variables a generic boot.scr may rely upon. |
| 207 | |
| 208 | The second of those headers sets up the default environment so that $bootcmd |
| 209 | is defined in a way that searches attached disks for boot configuration files, |
| 210 | and executes them if found. |
| 211 | |
| 212 | Required Environment Variables |
| 213 | ------------------------------ |
| 214 | |
| 215 | The U-Boot "syslinux" and "pxe boot" commands require a number of environment |
| 216 | variables be set. Default values for these variables are often hard-coded into |
| 217 | CONFIG_EXTRA_ENV_SETTINGS in the board's U-Boot configuration file, so that |
| 218 | the user doesn't have to configure them. |
| 219 | |
| 220 | fdt_addr: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 221 | Mandatory for any system that provides the DTB in HW (e.g. ROM) and wishes |
| 222 | to pass that DTB to Linux, rather than loading a DTB from the boot |
| 223 | filesystem. Prohibited for any other system. |
| 224 | |
| 225 | If specified a DTB to boot the system must be available at the given |
| 226 | address. |
| 227 | |
| 228 | fdt_addr_r: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 229 | Mandatory. The location in RAM where the DTB will be loaded or copied to when |
| 230 | processing the fdtdir/devicetreedir or fdt/devicetree options in |
| 231 | extlinux.conf. |
| 232 | |
| 233 | This is mandatory even when fdt_addr is provided, since extlinux.conf must |
| 234 | always be able to provide a DTB which overrides any copy provided by the HW. |
| 235 | |
| 236 | A size of 1MB for the FDT/DTB seems reasonable. |
| 237 | |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 238 | fdtoverlay_addr_r: |
| 239 | Mandatory. The location in RAM where DTB overlays will be temporarily |
| 240 | stored and then applied in the load order to the fdt blob stored at the |
| 241 | address indicated in the fdt_addr_r environment variable. |
| 242 | |
Dennis Gilmore | 74f8977 | 2020-09-11 11:56:59 -0500 | [diff] [blame] | 243 | fdtfile: |
Dennis Gilmore | 74f8977 | 2020-09-11 11:56:59 -0500 | [diff] [blame] | 244 | Mandatory. the name of the DTB file for the specific board for instance |
| 245 | the espressobin v5 board the value is "marvell/armada-3720-espressobin.dtb" |
| 246 | while on a clearfog pro it is "armada-388-clearfog-pro.dtb" in the case of |
| 247 | a board providing its firmware based DTB this value can be used to override |
| 248 | the DTB with a different DTB. fdtfile will automatically be set for you if |
| 249 | it matches the format ${soc}-${board}.dtb which covers most 32 bit use cases. |
| 250 | AArch64 generally does not match as the Linux kernel put the dtb files under |
Wolfgang Denk | 0a50b3c | 2021-09-27 17:42:38 +0200 | [diff] [blame] | 251 | SoC vendor directories. |
Dennis Gilmore | 74f8977 | 2020-09-11 11:56:59 -0500 | [diff] [blame] | 252 | |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 253 | ramdisk_addr_r: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 254 | Mandatory. The location in RAM where the initial ramdisk will be loaded to |
| 255 | when processing the initrd option in extlinux.conf. |
| 256 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 257 | It is recommended that this location be highest in RAM out of fdt_addr_r, |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 258 | kernel_addr_r, and ramdisk_addr_r, so that the RAM disk can vary in size |
| 259 | and use any available RAM. |
| 260 | |
| 261 | kernel_addr_r: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 262 | Mandatory. The location in RAM where the kernel will be loaded to when |
| 263 | processing the kernel option in the extlinux.conf. |
| 264 | |
| 265 | The kernel should be located within the first 128M of RAM in order for the |
| 266 | kernel CONFIG_AUTO_ZRELADDR option to work, which is likely enabled on any |
| 267 | distro kernel. Since the kernel will decompress itself to 0x8000 after the |
Masahiro Yamada | 28fd00b | 2015-07-07 18:47:17 +0900 | [diff] [blame] | 268 | start of RAM, kernel_addr_r should not overlap that area, or the kernel will |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 269 | have to copy itself somewhere else first before decompression. |
| 270 | |
| 271 | A size of 16MB for the kernel is likely adequate. |
| 272 | |
Atish Patra | 414c34e | 2020-03-05 16:24:23 -0800 | [diff] [blame] | 273 | kernel_comp_addr_r: |
| 274 | Optional. This is only required if user wants to boot Linux from a compressed |
Heinrich Schuchardt | 3af8d1c | 2021-02-17 08:06:05 +0100 | [diff] [blame] | 275 | Image(.gz, .bz2, .lzma, .lzo) using the booti command. It represents the |
| 276 | location in RAM where the compressed Image will be decompressed temporarily. |
| 277 | Once the decompression is complete, the decompressed data will be moved to |
| 278 | kernel_addr_r for booting. |
Atish Patra | 414c34e | 2020-03-05 16:24:23 -0800 | [diff] [blame] | 279 | |
| 280 | kernel_comp_size: |
| 281 | Optional. This is only required if user wants to boot Linux from a compressed |
| 282 | Image using booti command. It represents the size of the compressed file. The |
| 283 | size has to at least the size of loaded image for decompression to succeed. |
| 284 | |
Vagrant Cascadian | 7101c4c | 2016-02-08 19:55:31 -0800 | [diff] [blame] | 285 | pxefile_addr_r: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 286 | Mandatory. The location in RAM where extlinux.conf will be loaded to prior |
| 287 | to processing. |
| 288 | |
| 289 | A size of 1MB for extlinux.conf is more than adequate. |
| 290 | |
| 291 | scriptaddr: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 292 | Mandatory, if the boot script is boot.scr rather than extlinux.conf. The |
| 293 | location in RAM where boot.scr will be loaded to prior to execution. |
| 294 | |
| 295 | A size of 1MB for extlinux.conf is more than adequate. |
| 296 | |
| 297 | For suggestions on memory locations for ARM systems, you must follow the |
| 298 | guidelines specified in Documentation/arm/Booting in the Linux kernel tree. |
| 299 | |
| 300 | For a commented example of setting these values, please see the definition of |
| 301 | MEM_LAYOUT_ENV_SETTINGS in include/configs/tegra124-common.h. |
| 302 | |
| 303 | Boot Target Configuration |
| 304 | ------------------------- |
| 305 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 306 | The `config_distro_bootcmd.h` file defines $bootcmd and many helper command |
| 307 | variables that automatically search attached disks for boot configuration files |
| 308 | and execute them. Boards must provide configure <config_distro_bootcmd.h> so |
| 309 | that it supports the correct set of possible boot device types. To provide this |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 310 | configuration, simply define macro BOOT_TARGET_DEVICES prior to including |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 311 | <config_distro_bootcmd.h>. For example:: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 312 | |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 313 | #ifndef CONFIG_SPL_BUILD |
| 314 | #define BOOT_TARGET_DEVICES(func) \ |
| 315 | func(MMC, mmc, 1) \ |
| 316 | func(MMC, mmc, 0) \ |
| 317 | func(USB, usb, 0) \ |
| 318 | func(PXE, pxe, na) \ |
| 319 | func(DHCP, dhcp, na) |
| 320 | #include <config_distro_bootcmd.h> |
| 321 | #endif |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 322 | |
| 323 | Each entry in the macro defines a single boot device (e.g. a specific eMMC |
| 324 | device or SD card) or type of boot device (e.g. USB disk). The parameters to |
| 325 | the func macro (passed in by the internal implementation of the header) are: |
| 326 | |
Pali Rohár | 2f5c9ad | 2022-04-06 11:35:46 +0200 | [diff] [blame] | 327 | - Upper-case disk type (DHCP, HOST, IDE, MMC, NVME, PXE, SATA, SCSI, UBIFS, USB, |
| 328 | VIRTIO). |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 329 | - Lower-case disk type (same options as above). |
| 330 | - ID of the specific disk (MMC only) or ignored for other types. |
| 331 | |
| 332 | User Configuration |
| 333 | ================== |
| 334 | |
| 335 | Once the user has installed U-Boot, it is expected that the environment will |
| 336 | be reset to the default values in order to enable $bootcmd and friends, as set |
| 337 | up by <config_distro_bootcmd.h>. After this, various environment variables may |
| 338 | be altered to influence the boot process: |
| 339 | |
| 340 | boot_targets: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 341 | The list of boot locations searched. |
| 342 | |
| 343 | Example: mmc0, mmc1, usb, pxe |
| 344 | |
| 345 | Entries may be removed or re-ordered in this list to affect the boot order. |
| 346 | |
| 347 | boot_prefixes: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 348 | For disk-based booting, the list of directories within a partition that are |
| 349 | searched for boot configuration files (extlinux.conf, boot.scr). |
| 350 | |
| 351 | Example: / /boot/ |
| 352 | |
| 353 | Entries may be removed or re-ordered in this list to affect the set of |
| 354 | directories which are searched. |
| 355 | |
| 356 | boot_scripts: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 357 | The name of U-Boot style boot.scr files that $bootcmd searches for. |
| 358 | |
| 359 | Example: boot.scr.uimg boot.scr |
| 360 | |
| 361 | (Typically we expect extlinux.conf to be used, but execution of boot.scr is |
| 362 | maintained for backwards-compatibility.) |
| 363 | |
| 364 | Entries may be removed or re-ordered in this list to affect the set of |
| 365 | filenames which are supported. |
| 366 | |
| 367 | scan_dev_for_extlinux: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 368 | If you want to disable extlinux.conf on all disks, set the value to something |
| 369 | innocuous, e.g. setenv scan_dev_for_extlinux true. |
| 370 | |
| 371 | scan_dev_for_scripts: |
Dennis Gilmore | ffb4f6f | 2015-01-22 11:34:20 -0700 | [diff] [blame] | 372 | If you want to disable boot.scr on all disks, set the value to something |
| 373 | innocuous, e.g. setenv scan_dev_for_scripts true. |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 374 | |
Stephen Warren | 3483b75 | 2016-01-26 11:10:12 -0700 | [diff] [blame] | 375 | boot_net_usb_start: |
Stephen Warren | 3483b75 | 2016-01-26 11:10:12 -0700 | [diff] [blame] | 376 | If you want to prevent USB enumeration by distro boot commands which execute |
| 377 | network operations, set the value to something innocuous, e.g. setenv |
| 378 | boot_net_usb_start true. This would be useful if you know your Ethernet |
| 379 | device is not attached to USB, and you wish to increase boot speed by |
| 380 | avoiding unnecessary actions. |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 381 | |
Stephen Warren | 986691f | 2016-01-26 11:10:13 -0700 | [diff] [blame] | 382 | boot_net_pci_enum: |
Stephen Warren | 986691f | 2016-01-26 11:10:13 -0700 | [diff] [blame] | 383 | If you want to prevent PCI enumeration by distro boot commands which execute |
| 384 | network operations, set the value to something innocuous, e.g. setenv |
| 385 | boot_net_pci_enum true. This would be useful if you know your Ethernet |
| 386 | device is not attached to PCI, and you wish to increase boot speed by |
| 387 | avoiding unnecessary actions. |
| 388 | |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 389 | Interactively booting from a specific device at the u-boot prompt |
| 390 | ================================================================= |
| 391 | |
| 392 | For interactively booting from a user-selected device at the u-boot command |
| 393 | prompt, the environment provides predefined bootcmd_<target> variables for |
| 394 | every target defined in boot_targets, which can be run be the user. |
| 395 | |
| 396 | If the target is a storage device, the format of the target is always |
| 397 | <device type><device number>, e.g. mmc0. Specifying the device number is |
| 398 | mandatory for storage devices, even if only support for a single instance |
| 399 | of the storage device is actually implemented. |
| 400 | |
| 401 | For network targets (dhcp, pxe), only the device type gets specified; |
| 402 | they do not have a device number. |
| 403 | |
| 404 | Examples: |
| 405 | |
| 406 | - run bootcmd_usb0 |
| 407 | boots from the first USB mass storage device |
| 408 | |
| 409 | - run bootcmd_mmc1 |
| 410 | boots from the second MMC device |
| 411 | |
| 412 | - run bootcmd_pxe |
| 413 | boots by tftp using a pxelinux.cfg |
| 414 | |
| 415 | The list of possible targets consists of: |
| 416 | |
| 417 | - network targets |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 418 | |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 419 | * dhcp |
| 420 | * pxe |
| 421 | |
| 422 | - storage targets (to which a device number must be appended) |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 423 | |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 424 | * mmc |
| 425 | * sata |
| 426 | * scsi |
| 427 | * ide |
| 428 | * usb |
Lukas Auer | a8da9ff | 2018-11-22 11:26:33 +0100 | [diff] [blame] | 429 | * virtio |
Karsten Merker | 8c24929 | 2015-03-21 14:15:38 +0100 | [diff] [blame] | 430 | |
| 431 | Other *boot* variables than the ones defined above are only for internal use |
| 432 | of the boot environment and are not guaranteed to exist or work in the same |
| 433 | way in future u-boot versions. In particular the <device type>_boot |
| 434 | variables (e.g. mmc_boot, usb_boot) are a strictly internal implementation |
| 435 | detail and must not be used as a public interface. |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 436 | |
Edoardo Tomelleri | 35821a2 | 2022-09-21 15:26:33 +0200 | [diff] [blame] | 437 | .. _`Boot Loader Specification`: https://systemd.io/BOOT_LOADER_SPECIFICATION/ |
Simon Glass | 37c5195 | 2021-10-14 12:48:10 -0600 | [diff] [blame] | 438 | |
| 439 | .. sectionauthor:: (C) Copyright 2014 Red Hat Inc. |
| 440 | .. sectionauthor:: Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
| 441 | .. sectionauthor:: Copyright (C) 2015 K. Merker <merker@debian.org> |