Simon Glass | 83b9be6 | 2022-04-24 23:31:26 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | bootflow command |
| 4 | ================ |
| 5 | |
| 6 | Synopis |
| 7 | ------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | bootflow scan [-abel] [bootdev] |
| 12 | bootflow list [-e] |
| 13 | bootflow select [<num|name>] |
| 14 | bootflow info [-d] |
| 15 | bootflow boot |
| 16 | |
| 17 | |
| 18 | Description |
| 19 | ----------- |
| 20 | |
| 21 | The `bootflow` command is used to manage bootflows. It can scan bootdevs to |
| 22 | locate bootflows, list them and boot them. |
| 23 | |
| 24 | See :doc:`../../develop/bootstd` for more information. |
| 25 | |
| 26 | |
| 27 | bootflow scan |
| 28 | ~~~~~~~~~~~~~ |
| 29 | |
| 30 | Scans for available bootflows, optionally booting the first valid one it finds. |
| 31 | This operates in two modes: |
| 32 | |
| 33 | - If no bootdev is selected (see `bootdev select`) it scans bootflows one |
| 34 | by one, extracting all the bootdevs from each |
| 35 | - If a bootdev is selected, it just scans that one bootflow |
| 36 | |
| 37 | Flags are: |
| 38 | |
| 39 | -a |
| 40 | Collect all bootflows, even those that cannot be loaded. Normally if a file |
| 41 | is not where it is expected, then the bootflow fails and so is dropped |
| 42 | during the scan. With this option you can see why each bootflow would be |
| 43 | dropped. |
| 44 | |
| 45 | -b |
| 46 | Boot each valid bootflow as it is scanned. Typically only the first bootflow |
| 47 | matters, since by then the system boots in the OS and U-Boot is no-longer |
| 48 | running. `bootflow scan -b` is a quick way to boot the first available OS. |
| 49 | A valid bootflow is one that made it all the way to the `loaded` state. |
| 50 | |
| 51 | -e |
| 52 | Used with -l to also show errors for each bootflow. The shows detailed error |
| 53 | information for each bootflow that failed to make it to the `loaded` state. |
| 54 | |
| 55 | -l |
| 56 | List bootflows while scanning. This is helpful when you want to see what |
| 57 | is happening during scanning. Use it with the `-b` flag to see which |
| 58 | bootdev and bootflows are being tried. |
| 59 | |
| 60 | The optional argument specifies a particular bootdev to scan. This can either be |
| 61 | the name of a bootdev or its sequence number (both shown with `bootdev list`). |
| 62 | Alternatively a convenience label can be used, like `mmc0`, which is the type of |
| 63 | device and an optional sequence number. Specifically, the label is the uclass of |
| 64 | the bootdev's parent followed by the sequence number of that parent. Sequence |
| 65 | numbers are typically set by aliases, so if you have 'mmc0' in your devicetree |
| 66 | alias section, then `mmc0` refers to the bootdev attached to that device. |
| 67 | |
| 68 | |
| 69 | bootflow list |
| 70 | ~~~~~~~~~~~~~ |
| 71 | |
| 72 | Lists the previously scanned bootflows. You must use `bootflow scan` before this |
| 73 | to see anything. |
| 74 | |
| 75 | If you scanned with -a and have bootflows with errors, -e can be used to show |
| 76 | those errors. |
| 77 | |
| 78 | The list looks something like this: |
| 79 | |
| 80 | === ====== ====== ======== ==== =============================== ================ |
| 81 | Seq Method State Uclass Part Name Filename |
| 82 | === ====== ====== ======== ==== =============================== ================ |
| 83 | 0 distro ready mmc 2 mmc\@7e202000.bootdev.part_2 /boot/extlinux/extlinux.conf |
| 84 | 1 pxe ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf |
| 85 | === ====== ====== ======== ==== =============================== ================ |
| 86 | |
| 87 | The fields are as follows: |
| 88 | |
| 89 | Seq: |
| 90 | Sequence number in the scan, used to reference the bootflow later |
| 91 | |
| 92 | Method: |
| 93 | The boot method (bootmeth) used to find the bootflow. Several methods are |
| 94 | included in U-Boot. |
| 95 | |
| 96 | State: |
| 97 | Current state of the bootflow, indicating how far the bootdev got in |
| 98 | obtaining a valid one. See :ref:`BootflowStates` for a list of states. |
| 99 | |
| 100 | Uclass: |
| 101 | Name of the media device's Uclass. This indicates the type of the parent |
| 102 | device (e.g. MMC, Ethernet). |
| 103 | |
| 104 | Part: |
| 105 | Partition number being accesseed, numbered from 1. Normally a device will |
| 106 | have a partition table with a small number of partitions. For devices |
| 107 | without partition tables (e.g. network) this field is 0. |
| 108 | |
| 109 | Name: |
| 110 | Name of the bootflow. This is generated from the bootdev appended with |
| 111 | the partition information |
| 112 | |
| 113 | Filename: |
| 114 | Name of the bootflow file. This indicates where the file is on the |
| 115 | filesystem or network device. |
| 116 | |
| 117 | |
| 118 | bootflow select |
| 119 | ~~~~~~~~~~~~~~~ |
| 120 | |
| 121 | Use this to select a particular bootflow. You can select it by the sequence |
| 122 | number or name, as shown in `bootflow list`. |
| 123 | |
| 124 | Once a bootflow is selected, you can use `bootflow info` and `bootflow boot`. |
| 125 | |
| 126 | If no bootflow name or number is provided, then any existing bootflow is |
| 127 | unselected. |
| 128 | |
| 129 | |
| 130 | bootflow info |
| 131 | ~~~~~~~~~~~~~ |
| 132 | |
| 133 | This shows information on the current bootflow, with the format looking like |
| 134 | this: |
| 135 | |
| 136 | ========= =============================== |
| 137 | Name mmc\@7e202000.bootdev.part_2 |
| 138 | Device mmc\@7e202000.bootdev |
| 139 | Block dev mmc\@7e202000.blk |
| 140 | Type distro |
| 141 | Method: syslinux |
| 142 | State ready |
| 143 | Partition 2 |
| 144 | Subdir (none) |
| 145 | Filename /extlinux/extlinux.conf |
| 146 | Buffer 3db7ad48 |
| 147 | Size 232 (562 bytes) |
| 148 | Error 0 |
| 149 | ========= =============================== |
| 150 | |
| 151 | Most of the information is the same as `bootflow list` above. The new fields |
| 152 | are: |
| 153 | |
| 154 | Device |
| 155 | Name of the bootdev |
| 156 | |
| 157 | Block dev |
| 158 | Name of the block device, if any. Network devices don't have a block device. |
| 159 | |
| 160 | Subdir |
| 161 | Subdirectory used for retrieving files. For network bootdevs this is the |
| 162 | directory of the 'bootfile' parameter passed from DHCP. All file retrievals |
| 163 | when booting are relative to this. |
| 164 | |
| 165 | Buffer |
| 166 | Buffer containing the bootflow file. You can use the :doc:`md` to look at |
| 167 | it, or dump it with `bootflow info -d`. |
| 168 | |
| 169 | Size |
| 170 | Size of the bootflow file |
| 171 | |
| 172 | Error |
| 173 | Error number returned from scanning for the bootflow. This is 0 if the |
| 174 | bootflow is in the 'loaded' state, or a negative error value on error. You |
| 175 | can look up Linux error codes to find the meaning of the number. |
| 176 | |
| 177 | Use the `-d` flag to dump out the contents of the bootfile file. |
| 178 | |
| 179 | |
| 180 | bootflow boot |
| 181 | ~~~~~~~~~~~~~ |
| 182 | |
| 183 | This boots the current bootflow. |
| 184 | |
| 185 | |
| 186 | Example |
| 187 | ------- |
| 188 | |
| 189 | Here is an example of scanning for bootflows, then listing them:: |
| 190 | |
| 191 | U-Boot> bootflow scan -l |
| 192 | Scanning for bootflows in all bootdevs |
| 193 | Seq Type State Uclass Part Name Filename |
| 194 | --- ----------- ------ -------- ---- ------------------------ ---------------- |
| 195 | Scanning bootdev 'mmc@7e202000.bootdev': |
| 196 | 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 197 | Scanning bootdev 'sdhci@7e300000.bootdev': |
| 198 | Card did not respond to voltage select! : -110 |
| 199 | Scanning bootdev 'smsc95xx_eth.bootdev': |
| 200 | Waiting for Ethernet connection... done. |
| 201 | BOOTP broadcast 1 |
| 202 | DHCP client bound to address 192.168.4.30 (4 ms) |
| 203 | Using smsc95xx_eth device |
| 204 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 205 | Filename 'rpi.pxe/'. |
| 206 | Load address: 0x200000 |
| 207 | Loading: * |
| 208 | TFTP error: 'Is a directory' (0) |
| 209 | Starting again |
| 210 | |
| 211 | missing environment variable: pxeuuid |
| 212 | Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1 |
| 213 | Waiting for Ethernet connection... done. |
| 214 | Using smsc95xx_eth device |
| 215 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 216 | Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'. |
| 217 | Load address: 0x2500000 |
| 218 | Loading: ################################################## 566 Bytes |
| 219 | 45.9 KiB/s |
| 220 | done |
| 221 | Bytes transferred = 566 (236 hex) |
| 222 | 1 distro ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf |
| 223 | No more bootdevs |
| 224 | --- ----------- ------ -------- ---- ------------------------ ---------------- |
| 225 | (2 bootflows, 2 valid) |
| 226 | U-Boot> bootflow l |
| 227 | Showing all bootflows |
| 228 | Seq Type State Uclass Part Name Filename |
| 229 | --- ----------- ------ -------- ---- ------------------------ ---------------- |
| 230 | 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 231 | 1 pxe ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf |
| 232 | --- ----------- ------ -------- ---- ------------------------ ---------------- |
| 233 | (2 bootflows, 2 valid) |
| 234 | |
| 235 | |
| 236 | The second one is then selected by name (we could instead use `bootflow sel 0`), |
| 237 | displayed and booted:: |
| 238 | |
| 239 | U-Boot> bootflow info |
| 240 | No bootflow selected |
| 241 | U-Boot> bootflow sel mmc@7e202000.bootdev.part_2 |
| 242 | U-Boot> bootflow info |
| 243 | Name: mmc@7e202000.bootdev.part_2 |
| 244 | Device: mmc@7e202000.bootdev |
| 245 | Block dev: mmc@7e202000.blk |
| 246 | Sequence: 1 |
| 247 | Method: distro |
| 248 | State: ready |
| 249 | Partition: 2 |
| 250 | Subdir: (none) |
| 251 | Filename: extlinux/extlinux.conf |
| 252 | Buffer: 3db7ae88 |
| 253 | Size: 232 (562 bytes) |
| 254 | Error: 0 |
| 255 | U-Boot> bootflow boot |
| 256 | ** Booting bootflow 'smsc95xx_eth.bootdev.0' |
| 257 | Ignoring unknown command: ui |
| 258 | Ignoring malformed menu command: autoboot |
| 259 | Ignoring malformed menu command: hidden |
| 260 | Ignoring unknown command: totaltimeout |
| 261 | 1: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) |
| 262 | Retrieving file: rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img |
| 263 | get 2700000 rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img |
| 264 | Waiting for Ethernet connection... done. |
| 265 | Using smsc95xx_eth device |
| 266 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 267 | Filename 'rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img'. |
| 268 | Load address: 0x2700000 |
| 269 | Loading: ###################################T ############### 57.7 MiB |
| 270 | 1.9 MiB/s |
| 271 | done |
| 272 | Bytes transferred = 60498594 (39b22a2 hex) |
| 273 | Retrieving file: rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl |
| 274 | get 80000 rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl |
| 275 | Waiting for Ethernet connection... done. |
| 276 | Using smsc95xx_eth device |
| 277 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 278 | Filename 'rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl'. |
| 279 | Load address: 0x80000 |
| 280 | Loading: ################################################## 7.2 MiB |
| 281 | 2.3 MiB/s |
| 282 | done |
| 283 | Bytes transferred = 7508480 (729200 hex) |
| 284 | append: ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet LANG=en_US.UTF-8 cma=192MB cma=256MB |
| 285 | Retrieving file: rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb |
| 286 | get 2600000 rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb |
| 287 | Waiting for Ethernet connection... done. |
| 288 | Using smsc95xx_eth device |
| 289 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 290 | Filename 'rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb'. |
| 291 | Load address: 0x2600000 |
| 292 | Loading: ################################################## 13.8 KiB |
| 293 | 764.6 KiB/s |
| 294 | done |
| 295 | Bytes transferred = 14102 (3716 hex) |
| 296 | Kernel image @ 0x080000 [ 0x000000 - 0x729200 ] |
| 297 | ## Flattened Device Tree blob at 02600000 |
| 298 | Booting using the fdt blob at 0x2600000 |
| 299 | Using Device Tree in place at 02600000, end 02606715 |
| 300 | |
| 301 | Starting kernel ... |
| 302 | |
| 303 | [ OK ] Started Show Plymouth Boot Screen. |
| 304 | [ OK ] Started Forward Password R…s to Plymouth Directory Watch. |
| 305 | [ OK ] Reached target Local Encrypted Volumes. |
| 306 | [ OK ] Reached target Paths. |
| 307 | .... |
| 308 | |
| 309 | |
| 310 | Here we scan for bootflows and boot the first one found:: |
| 311 | |
| 312 | U-Boot> bootflow scan -bl |
| 313 | Scanning for bootflows in all bootdevs |
| 314 | Seq Method State Uclass Part Name Filename |
| 315 | --- ----------- ------ -------- ---- ---------------------- ---------------- |
| 316 | Scanning bootdev 'mmc@7e202000.bootdev': |
| 317 | 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 318 | ** Booting bootflow 'mmc@7e202000.bootdev.part_2' |
| 319 | Ignoring unknown command: ui |
| 320 | Ignoring malformed menu command: autoboot |
| 321 | Ignoring malformed menu command: hidden |
| 322 | Ignoring unknown command: totaltimeout |
| 323 | 1: Fedora-KDE-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) |
| 324 | Retrieving file: /initramfs-5.3.7-301.fc31.armv7hl.img |
| 325 | getfile 2700000 /initramfs-5.3.7-301.fc31.armv7hl.img |
| 326 | Retrieving file: /vmlinuz-5.3.7-301.fc31.armv7hl |
| 327 | getfile 80000 /vmlinuz-5.3.7-301.fc31.armv7hl |
| 328 | append: ro root=UUID=b8781f09-e2dd-4cb8-979b-7df5eeaaabea rhgb LANG=en_US.UTF-8 cma=192MB console=tty0 console=ttyS1,115200 |
| 329 | Retrieving file: /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb |
| 330 | getfile 2600000 /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb |
| 331 | Kernel image @ 0x080000 [ 0x000000 - 0x729200 ] |
| 332 | ## Flattened Device Tree blob at 02600000 |
| 333 | Booting using the fdt blob at 0x2600000 |
| 334 | Using Device Tree in place at 02600000, end 02606715 |
| 335 | |
| 336 | Starting kernel ... |
| 337 | |
| 338 | [ 0.000000] Booting Linux on physical CPU 0x0 |
| 339 | |
| 340 | |
| 341 | Here is am example using the -e flag to see all errors:: |
| 342 | |
| 343 | U-Boot> bootflow scan -a |
| 344 | Card did not respond to voltage select! : -110 |
| 345 | Waiting for Ethernet connection... done. |
| 346 | BOOTP broadcast 1 |
| 347 | DHCP client bound to address 192.168.4.30 (4 ms) |
| 348 | Using smsc95xx_eth device |
| 349 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 350 | Filename 'rpi.pxe/'. |
| 351 | Load address: 0x200000 |
| 352 | Loading: * |
| 353 | TFTP error: 'Is a directory' (0) |
| 354 | Starting again |
| 355 | |
| 356 | missing environment variable: pxeuuid |
| 357 | Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1 |
| 358 | Waiting for Ethernet connection... done. |
| 359 | Using smsc95xx_eth device |
| 360 | TFTP from server 192.168.4.1; our IP address is 192.168.4.30 |
| 361 | Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'. |
| 362 | Load address: 0x2500000 |
| 363 | Loading: ################################################## 566 Bytes |
| 364 | 49.8 KiB/s |
| 365 | done |
| 366 | Bytes transferred = 566 (236 hex) |
| 367 | U-Boot> bootflow l -e |
| 368 | Showing all bootflows |
| 369 | Seq Type State Uclass Part Name Filename |
| 370 | --- ----------- ------ -------- ---- --------------------- ---------------- |
| 371 | 0 distro fs mmc 1 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 372 | ** File not found, err=-2 |
| 373 | 1 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 374 | 2 distro fs mmc 3 mmc@7e202000.bootdev.p /extlinux/extlinux.conf |
| 375 | ** File not found, err=-1 |
| 376 | 3 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 377 | ** No partition found, err=-2 |
| 378 | 4 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 379 | ** No partition found, err=-2 |
| 380 | 5 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 381 | ** No partition found, err=-2 |
| 382 | 6 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 383 | ** No partition found, err=-2 |
| 384 | 7 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 385 | ** No partition found, err=-2 |
| 386 | 8 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 387 | ** No partition found, err=-2 |
| 388 | 9 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 389 | ** No partition found, err=-2 |
| 390 | a distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 391 | ** No partition found, err=-2 |
| 392 | b distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 393 | ** No partition found, err=-2 |
| 394 | c distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 395 | ** No partition found, err=-2 |
| 396 | d distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 397 | ** No partition found, err=-2 |
| 398 | e distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 399 | ** No partition found, err=-2 |
| 400 | f distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 401 | ** No partition found, err=-2 |
| 402 | 10 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 403 | ** No partition found, err=-2 |
| 404 | 11 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 405 | ** No partition found, err=-2 |
| 406 | 12 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 407 | ** No partition found, err=-2 |
| 408 | 13 distro media mmc 0 mmc@7e202000.bootdev.p <NULL> |
| 409 | ** No partition found, err=-2 |
| 410 | 14 distro ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf |
| 411 | --- ----------- ------ -------- ---- --------------------- ---------------- |
| 412 | (21 bootflows, 2 valid) |
| 413 | U-Boot> |
| 414 | |
| 415 | |
| 416 | Return value |
| 417 | ------------ |
| 418 | |
| 419 | On success `bootflow boot` normally boots into the Operating System and does not |
| 420 | return to U-Boot. If something about the U-Boot processing fails, then the |
| 421 | return value $? is 1. If the boot succeeds but for some reason the Operating |
| 422 | System returns, then $? is 0, indicating success. |
| 423 | |
| 424 | For other subcommands, the return value $? is always 0 (true). |
| 425 | |
| 426 | |
| 427 | .. BootflowStates_: |