summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/bootflow.rst
blob: 8590efca218205048bfd962b3e519be755697d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
.. SPDX-License-Identifier: GPL-2.0+:

bootflow command
================

Synopis
-------

::

    bootflow scan [-abelGH] [bootdev]
    bootflow list [-e]
    bootflow select [<num|name>]
    bootflow info [-d]
    bootflow boot


Description
-----------

The `bootflow` command is used to manage bootflows. It can scan bootdevs to
locate bootflows, list them and boot them.

See :doc:`../../develop/bootstd` for more information.


bootflow scan
~~~~~~~~~~~~~

Scans for available bootflows, optionally booting the first valid one it finds.
This operates in two modes:

- If no bootdev is selected (see `bootdev select`) it scans bootflows one
  by one, extracting all the bootdevs from each
- If a bootdev is selected, it just scans that one bootflow

Flags are:

-a
    Collect all bootflows, even those that cannot be loaded. Normally if a file
    is not where it is expected, then the bootflow fails and so is dropped
    during the scan. With this option you can see why each bootflow would be
    dropped.

-b
    Boot each valid bootflow as it is scanned. Typically only the first bootflow
    matters, since by then the system boots in the OS and U-Boot is no-longer
    running. `bootflow scan -b` is a quick way to boot the first available OS.
    A valid bootflow is one that made it all the way to the `loaded` state.

-e
    Used with -l to also show errors for each bootflow. The shows detailed error
    information for each bootflow that failed to make it to the `loaded` state.

-l
    List bootflows while scanning. This is helpful when you want to see what
    is happening during scanning. Use it with the `-b` flag to see which
    bootdev and bootflows are being tried.

-G
    Skip global bootmeths when scanning. By default these are tried first, but
    this flag disables them.

-H
    Don't use bootdev hunters. By default these are used before each boot
    priority or label is tried, to see if more bootdevs can be discovered, but
    this flag disables that process.


The optional argument specifies a particular bootdev to scan. This can either be
the name of a bootdev or its sequence number (both shown with `bootdev list`).
Alternatively a convenience label can be used, like `mmc0`, which is the type of
device and an optional sequence number. Specifically, the label is the uclass of
the bootdev's parent followed by the sequence number of that parent. Sequence
numbers are typically set by aliases, so if you have 'mmc0' in your devicetree
alias section, then `mmc0` refers to the bootdev attached to that device.


bootflow list
~~~~~~~~~~~~~

Lists the previously scanned bootflows. You must use `bootflow scan` before this
to see anything.

If you scanned with -a and have bootflows with errors, -e can be used to show
those errors.

The list looks something like this:

===  ======  ======  ========  ====  ===============================   ================
Seq  Method  State   Uclass    Part  Name                              Filename
===  ======  ======  ========  ====  ===============================   ================
  0  distro  ready   mmc          2  mmc\@7e202000.bootdev.part_2      /boot/extlinux/extlinux.conf
  1  pxe     ready   ethernet     0  smsc95xx_eth.bootdev.0            rpi.pxe/extlinux/extlinux.conf
===  ======  ======  ========  ====  ===============================   ================

The fields are as follows:

Seq:
    Sequence number in the scan, used to reference the bootflow later

Method:
    The boot method (bootmeth) used to find the bootflow. Several methods are
    included in U-Boot.

State:
    Current state of the bootflow, indicating how far the bootdev got in
    obtaining a valid one. See :ref:`BootflowStates` for a list of states.

Uclass:
    Name of the media device's Uclass. This indicates the type of the parent
    device (e.g. MMC, Ethernet).

Part:
    Partition number being accesseed, numbered from 1. Normally a device will
    have a partition table with a small number of partitions. For devices
    without partition tables (e.g. network) this field is 0.

Name:
    Name of the bootflow. This is generated from the bootdev appended with
    the partition information

Filename:
    Name of the bootflow file. This indicates where the file is on the
    filesystem or network device.


bootflow select
~~~~~~~~~~~~~~~

Use this to select a particular bootflow. You can select it by the sequence
number or name, as shown in `bootflow list`.

Once a bootflow is selected, you can use `bootflow info` and `bootflow boot`.

If no bootflow name or number is provided, then any existing bootflow is
unselected.


bootflow info
~~~~~~~~~~~~~

This shows information on the current bootflow, with the format looking like
this:

=========  ===============================
Name       mmc\@7e202000.bootdev.part_2
Device     mmc\@7e202000.bootdev
Block dev  mmc\@7e202000.blk
Type       distro
Method:    extlinux
State      ready
Partition  2
Subdir     (none)
Filename   /extlinux/extlinux.conf
Buffer     3db7ad48
Size       232 (562 bytes)
FDT:       <NULL>
Error      0
=========  ===============================

Most of the information is the same as `bootflow list` above. The new fields
are:

Device
    Name of the bootdev

Block dev
    Name of the block device, if any. Network devices don't have a block device.

Subdir
    Subdirectory used for retrieving files. For network bootdevs this is the
    directory of the 'bootfile' parameter passed from DHCP. All file retrievals
    when booting are relative to this.

Buffer
    Buffer containing the bootflow file. You can use the :doc:`md` to look at
    it, or dump it with `bootflow info -d`.

Size
    Size of the bootflow file

FDT:
    Filename of the device tree, if supported. The EFI bootmeth uses this to
    remember the filename to load. If `<NULL>` then there is none.

Error
    Error number returned from scanning for the bootflow. This is 0 if the
    bootflow is in the 'loaded' state, or a negative error value on error. You
    can look up Linux error codes to find the meaning of the number.

Use the `-d` flag to dump out the contents of the bootfile file.


bootflow boot
~~~~~~~~~~~~~

This boots the current bootflow.


Example
-------

Here is an example of scanning for bootflows, then listing them::

    U-Boot> bootflow scan -l
    Scanning for bootflows in all bootdevs
    Seq  Type         State   Uclass    Part  Name                      Filename
    ---  -----------  ------  --------  ----  ------------------------  ----------------
    Scanning bootdev 'mmc@7e202000.bootdev':
      0  distro       ready   mmc          2  mmc@7e202000.bootdev.p    /extlinux/extlinux.conf
    Scanning bootdev 'sdhci@7e300000.bootdev':
    Card did not respond to voltage select! : -110
    Scanning bootdev 'smsc95xx_eth.bootdev':
    Waiting for Ethernet connection... done.
    BOOTP broadcast 1
    DHCP client bound to address 192.168.4.30 (4 ms)
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe/'.
    Load address: 0x200000
    Loading: *
    TFTP error: 'Is a directory' (0)
    Starting again

    missing environment variable: pxeuuid
    Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1
    Waiting for Ethernet connection... done.
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'.
    Load address: 0x2500000
    Loading: ##################################################  566 Bytes
    	 45.9 KiB/s
    done
    Bytes transferred = 566 (236 hex)
      1  distro       ready   ethernet     0  smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf
    No more bootdevs
    ---  -----------  ------  --------  ----  ------------------------  ----------------
    (2 bootflows, 2 valid)
    U-Boot> bootflow l
    Showing all bootflows
    Seq  Type         State   Uclass    Part  Name                      Filename
    ---  -----------  ------  --------  ----  ------------------------  ----------------
      0  distro       ready   mmc          2  mmc@7e202000.bootdev.p    /extlinux/extlinux.conf
      1  pxe          ready   ethernet     0  smsc95xx_eth.bootdev.0     rpi.pxe/extlinux/extlinux.conf
    ---  -----------  ------  --------  ----  ------------------------  ----------------
    (2 bootflows, 2 valid)


The second one is then selected by name (we could instead use `bootflow sel 0`),
displayed and booted::

    U-Boot> bootflow info
    No bootflow selected
    U-Boot> bootflow sel mmc@7e202000.bootdev.part_2
    U-Boot> bootflow info
    Name:      mmc@7e202000.bootdev.part_2
    Device:    mmc@7e202000.bootdev
    Block dev: mmc@7e202000.blk
    Sequence:  1
    Method:    distro
    State:     ready
    Partition: 2
    Subdir:    (none)
    Filename:  extlinux/extlinux.conf
    Buffer:    3db7ae88
    Size:      232 (562 bytes)
    Error:     0
    U-Boot> bootflow boot
    ** Booting bootflow 'smsc95xx_eth.bootdev.0'
    Ignoring unknown command: ui
    Ignoring malformed menu command:  autoboot
    Ignoring malformed menu command:  hidden
    Ignoring unknown command: totaltimeout
    1:	Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
    Retrieving file: rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img
    get 2700000 rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img
    Waiting for Ethernet connection... done.
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe/initramfs-5.3.7-301.fc31.armv7hl.img'.
    Load address: 0x2700000
    Loading: ###################################T ###############  57.7 MiB
    	 1.9 MiB/s
    done
    Bytes transferred = 60498594 (39b22a2 hex)
    Retrieving file: rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl
    get 80000 rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl
    Waiting for Ethernet connection... done.
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe//vmlinuz-5.3.7-301.fc31.armv7hl'.
    Load address: 0x80000
    Loading: ##################################################  7.2 MiB
    	 2.3 MiB/s
    done
    Bytes transferred = 7508480 (729200 hex)
    append: ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet LANG=en_US.UTF-8 cma=192MB cma=256MB
    Retrieving file: rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
    get 2600000 rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
    Waiting for Ethernet connection... done.
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe//dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb'.
    Load address: 0x2600000
    Loading: ##################################################  13.8 KiB
    	 764.6 KiB/s
    done
    Bytes transferred = 14102 (3716 hex)
    Kernel image @ 0x080000 [ 0x000000 - 0x729200 ]
    ## Flattened Device Tree blob at 02600000
       Booting using the fdt blob at 0x2600000
       Using Device Tree in place at 02600000, end 02606715

    Starting kernel ...

    [  OK  ] Started Show Plymouth Boot Screen.
    [  OK  ] Started Forward Password R…s to Plymouth Directory Watch.
    [  OK  ] Reached target Local Encrypted Volumes.
    [  OK  ] Reached target Paths.
    ....


Here we scan for bootflows and boot the first one found::

    U-Boot> bootflow scan -bl
    Scanning for bootflows in all bootdevs
    Seq  Method       State   Uclass    Part  Name                    Filename
    ---  -----------  ------  --------  ----  ----------------------  ----------------
    Scanning bootdev 'mmc@7e202000.bootdev':
      0  distro       ready   mmc          2  mmc@7e202000.bootdev.p  /extlinux/extlinux.conf
    ** Booting bootflow 'mmc@7e202000.bootdev.part_2'
    Ignoring unknown command: ui
    Ignoring malformed menu command:  autoboot
    Ignoring malformed menu command:  hidden
    Ignoring unknown command: totaltimeout
    1:	Fedora-KDE-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
    Retrieving file: /initramfs-5.3.7-301.fc31.armv7hl.img
    getfile 2700000 /initramfs-5.3.7-301.fc31.armv7hl.img
    Retrieving file: /vmlinuz-5.3.7-301.fc31.armv7hl
    getfile 80000 /vmlinuz-5.3.7-301.fc31.armv7hl
    append: ro root=UUID=b8781f09-e2dd-4cb8-979b-7df5eeaaabea rhgb LANG=en_US.UTF-8 cma=192MB console=tty0 console=ttyS1,115200
    Retrieving file: /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
    getfile 2600000 /dtb-5.3.7-301.fc31.armv7hl/bcm2837-rpi-3-b.dtb
    Kernel image @ 0x080000 [ 0x000000 - 0x729200 ]
    ## Flattened Device Tree blob at 02600000
       Booting using the fdt blob at 0x2600000
       Using Device Tree in place at 02600000, end 02606715

    Starting kernel ...

    [    0.000000] Booting Linux on physical CPU 0x0


Here is am example using the -e flag to see all errors::

    U-Boot> bootflow scan -a
    Card did not respond to voltage select! : -110
    Waiting for Ethernet connection... done.
    BOOTP broadcast 1
    DHCP client bound to address 192.168.4.30 (4 ms)
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe/'.
    Load address: 0x200000
    Loading: *
    TFTP error: 'Is a directory' (0)
    Starting again

    missing environment variable: pxeuuid
    Retrieving file: rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1
    Waiting for Ethernet connection... done.
    Using smsc95xx_eth device
    TFTP from server 192.168.4.1; our IP address is 192.168.4.30
    Filename 'rpi.pxe/pxelinux.cfg/01-b8-27-eb-a6-61-e1'.
    Load address: 0x2500000
    Loading: ##################################################  566 Bytes
    	 49.8 KiB/s
    done
    Bytes transferred = 566 (236 hex)
    U-Boot> bootflow l -e
    Showing all bootflows
    Seq  Type         State   Uclass    Part  Name                   Filename
    ---  -----------  ------  --------  ----  ---------------------  ----------------
      0  distro       fs      mmc          1  mmc@7e202000.bootdev.p /extlinux/extlinux.conf
         ** File not found, err=-2
      1  distro       ready   mmc          2  mmc@7e202000.bootdev.p /extlinux/extlinux.conf
      2  distro       fs      mmc          3  mmc@7e202000.bootdev.p /extlinux/extlinux.conf
         ** File not found, err=-1
      3  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      4  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      5  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      6  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      7  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      8  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      9  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      a  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      b  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      c  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      d  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      e  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
      f  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
     10  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
     11  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
     12  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
     13  distro       media   mmc          0  mmc@7e202000.bootdev.p <NULL>
         ** No partition found, err=-2
     14  distro       ready   ethernet     0  smsc95xx_eth.bootdev.0 rpi.pxe/extlinux/extlinux.conf
    ---  -----------  ------  --------  ----  ---------------------  ----------------
    (21 bootflows, 2 valid)
    U-Boot>


Return value
------------

On success `bootflow boot` normally boots into the Operating System and does not
return to U-Boot. If something about the U-Boot processing fails, then the
return value $? is 1. If the boot succeeds but for some reason the Operating
System returns, then $? is 0, indicating success.

For other subcommands, the return value $? is always 0 (true).


.. BootflowStates_: