blob: 907d44ad9f9baacd3f716841ff4bf1531d4869c3 [file] [log] [blame]
Simon Glasse7b2ce12022-04-24 23:31:26 -06001.. SPDX-License-Identifier: GPL-2.0+:
2
3bootflow command
4================
5
6Synopis
7-------
8
9::
10
Simon Glass1bdda5f2023-01-17 10:48:19 -070011 bootflow scan [-abelGH] [bootdev]
Simon Glasse7b2ce12022-04-24 23:31:26 -060012 bootflow list [-e]
13 bootflow select [<num|name>]
14 bootflow info [-d]
15 bootflow boot
16
17
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 Glass1bdda5f2023-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 Glasse7b2ce12022-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 Glass79f66352023-05-10 16:34:46 -0600151Method: extlinux
Simon Glasse7b2ce12022-04-24 23:31:26 -0600152State ready
153Partition 2
154Subdir (none)
155Filename /extlinux/extlinux.conf
156Buffer 3db7ad48
157Size 232 (562 bytes)
Simon Glass1bdda5f2023-01-17 10:48:19 -0700158FDT: <NULL>
Simon Glasse7b2ce12022-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 Glass1bdda5f2023-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 Glasse7b2ce12022-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
200
201Example
202-------
203
204Here is an example of scanning for bootflows, then listing them::
205
206 U-Boot> bootflow scan -l
207 Scanning for bootflows in all bootdevs
208 Seq Type State Uclass Part Name Filename
209 --- ----------- ------ -------- ---- ------------------------ ----------------
210 Scanning bootdev 'mmc@7e202000.bootdev':
211 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
212 Scanning bootdev 'sdhci@7e300000.bootdev':
213 Card did not respond to voltage select! : -110
214 Scanning bootdev 'smsc95xx_eth.bootdev':
215 Waiting for Ethernet connection... done.
216 BOOTP broadcast 1
217 DHCP client bound to address 192.168.4.30 (4 ms)
218 Using smsc95xx_eth device
219 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
220 Filename 'rpi.pxe/'.
221 Load address: 0x200000
222 Loading: *
223 TFTP error: 'Is a directory' (0)
224 Starting again
225
226 missing environment variable: pxeuuid
227 Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1
228 Waiting for Ethernet connection... done.
229 Using smsc95xx_eth device
230 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
231 Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'.
232 Load address: 0x2500000
233 Loading: ################################################## 566 Bytes
234 45.9 KiB/s
235 done
236 Bytes transferred = 566 (236 hex)
237 1 distro ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf
238 No more bootdevs
239 --- ----------- ------ -------- ---- ------------------------ ----------------
240 (2 bootflows, 2 valid)
241 U-Boot> bootflow l
242 Showing all bootflows
243 Seq Type State Uclass Part Name Filename
244 --- ----------- ------ -------- ---- ------------------------ ----------------
245 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
246 1 pxe ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf
247 --- ----------- ------ -------- ---- ------------------------ ----------------
248 (2 bootflows, 2 valid)
249
250
251The second one is then selected by name (we could instead use `bootflow sel 0`),
252displayed and booted::
253
254 U-Boot> bootflow info
255 No bootflow selected
256 U-Boot> bootflow sel mmc@7e202000.bootdev.part_2
257 U-Boot> bootflow info
258 Name: mmc@7e202000.bootdev.part_2
259 Device: mmc@7e202000.bootdev
260 Block dev: mmc@7e202000.blk
Simon Glasse7b2ce12022-04-24 23:31:26 -0600261 Method: distro
262 State: ready
263 Partition: 2
264 Subdir: (none)
265 Filename: extlinux/extlinux.conf
266 Buffer: 3db7ae88
267 Size: 232 (562 bytes)
Simon Glassf4a91652023-07-12 09:04:34 -0600268 OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
269 Cmdline: (none)
270 Logo: (none)
271 FDT: <NULL>
Simon Glasse7b2ce12022-04-24 23:31:26 -0600272 Error: 0
273 U-Boot> bootflow boot
274 ** Booting bootflow 'smsc95xx_eth.bootdev.0'
275 Ignoring unknown command: ui
276 Ignoring malformed menu command: autoboot
277 Ignoring malformed menu command: hidden
278 Ignoring unknown command: totaltimeout
279 1: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
280 Retrieving file: rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img
281 get 2700000 rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img
282 Waiting for Ethernet connection... done.
283 Using smsc95xx_eth device
284 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
285 Filename 'rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img'.
286 Load address: 0x2700000
287 Loading: ###################################T ############### 57.7 MiB
288 1.9 MiB/s
289 done
290 Bytes transferred = 60498594 (39b22a2 hex)
291 Retrieving file: rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl
292 get 80000 rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl
293 Waiting for Ethernet connection... done.
294 Using smsc95xx_eth device
295 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
296 Filename 'rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl'.
297 Load address: 0x80000
298 Loading: ################################################## 7.2 MiB
299 2.3 MiB/s
300 done
301 Bytes transferred = 7508480 (729200 hex)
302 append: ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet LANG=en_US.UTF-8 cma=192MB cma=256MB
303 Retrieving file: rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
304 get 2600000 rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
305 Waiting for Ethernet connection... done.
306 Using smsc95xx_eth device
307 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
308 Filename 'rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb'.
309 Load address: 0x2600000
310 Loading: ################################################## 13.8 KiB
311 764.6 KiB/s
312 done
313 Bytes transferred = 14102 (3716 hex)
314 Kernel image @ 0x080000 [ 0x000000 - 0x729200 ]
315 ## Flattened Device Tree blob at 02600000
316 Booting using the fdt blob at 0x2600000
317 Using Device Tree in place at 02600000, end 02606715
318
319 Starting kernel ...
320
321 [ OK ] Started Show Plymouth Boot Screen.
322 [ OK ] Started Forward Password Rs to Plymouth Directory Watch.
323 [ OK ] Reached target Local Encrypted Volumes.
324 [ OK ] Reached target Paths.
325 ....
326
327
328Here we scan for bootflows and boot the first one found::
329
330 U-Boot> bootflow scan -bl
331 Scanning for bootflows in all bootdevs
332 Seq Method State Uclass Part Name Filename
333 --- ----------- ------ -------- ---- ---------------------- ----------------
334 Scanning bootdev 'mmc@7e202000.bootdev':
335 0 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
336 ** Booting bootflow 'mmc@7e202000.bootdev.part_2'
337 Ignoring unknown command: ui
338 Ignoring malformed menu command: autoboot
339 Ignoring malformed menu command: hidden
340 Ignoring unknown command: totaltimeout
341 1: Fedora-KDE-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
342 Retrieving file: /initramfs-5.3.7-301.fc31.armv7hl.img
343 getfile 2700000 /initramfs-5.3.7-301.fc31.armv7hl.img
344 Retrieving file: /vmlinuz-5.3.7-301.fc31.armv7hl
345 getfile 80000 /vmlinuz-5.3.7-301.fc31.armv7hl
346 append: ro root=UUID=b8781f09-e2dd-4cb8-979b-7df5eeaaabea rhgb LANG=en_US.UTF-8 cma=192MB console=tty0 console=ttyS1,115200
347 Retrieving file: /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
348 getfile 2600000 /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
349 Kernel image @ 0x080000 [ 0x000000 - 0x729200 ]
350 ## Flattened Device Tree blob at 02600000
351 Booting using the fdt blob at 0x2600000
352 Using Device Tree in place at 02600000, end 02606715
353
354 Starting kernel ...
355
356 [ 0.000000] Booting Linux on physical CPU 0x0
357
358
359Here is am example using the -e flag to see all errors::
360
361 U-Boot> bootflow scan -a
362 Card did not respond to voltage select! : -110
363 Waiting for Ethernet connection... done.
364 BOOTP broadcast 1
365 DHCP client bound to address 192.168.4.30 (4 ms)
366 Using smsc95xx_eth device
367 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
368 Filename 'rpi.pxe/'.
369 Load address: 0x200000
370 Loading: *
371 TFTP error: 'Is a directory' (0)
372 Starting again
373
374 missing environment variable: pxeuuid
375 Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1
376 Waiting for Ethernet connection... done.
377 Using smsc95xx_eth device
378 TFTP from server 192.168.4.1; our IP address is 192.168.4.30
379 Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'.
380 Load address: 0x2500000
381 Loading: ################################################## 566 Bytes
382 49.8 KiB/s
383 done
384 Bytes transferred = 566 (236 hex)
385 U-Boot> bootflow l -e
386 Showing all bootflows
387 Seq Type State Uclass Part Name Filename
388 --- ----------- ------ -------- ---- --------------------- ----------------
389 0 distro fs mmc 1 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
390 ** File not found, err=-2
391 1 distro ready mmc 2 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
392 2 distro fs mmc 3 mmc@7e202000.bootdev.p /extlinux/extlinux.conf
393 ** File not found, err=-1
394 3 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
395 ** No partition found, err=-2
396 4 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
397 ** No partition found, err=-2
398 5 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
399 ** No partition found, err=-2
400 6 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
401 ** No partition found, err=-2
402 7 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
403 ** No partition found, err=-2
404 8 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
405 ** No partition found, err=-2
406 9 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
407 ** No partition found, err=-2
408 a distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
409 ** No partition found, err=-2
410 b distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
411 ** No partition found, err=-2
412 c distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
413 ** No partition found, err=-2
414 d distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
415 ** No partition found, err=-2
416 e distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
417 ** No partition found, err=-2
418 f distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
419 ** No partition found, err=-2
420 10 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
421 ** No partition found, err=-2
422 11 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
423 ** No partition found, err=-2
424 12 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
425 ** No partition found, err=-2
426 13 distro media mmc 0 mmc@7e202000.bootdev.p <NULL>
427 ** No partition found, err=-2
428 14 distro ready ethernet 0 smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf
429 --- ----------- ------ -------- ---- --------------------- ----------------
430 (21 bootflows, 2 valid)
431 U-Boot>
432
433
434Return value
435------------
436
437On success `bootflow boot` normally boots into the Operating System and does not
438return to U-Boot. If something about the U-Boot processing fails, then the
439return value $? is 1. If the boot succeeds but for some reason the Operating
440System returns, then $? is 0, indicating success.
441
442For other subcommands, the return value $? is always 0 (true).
443
444
445.. BootflowStates_: