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