1.. SPDX-License-Identifier: GPL-2.0+:
2
3bootdev command
4===============
5
6Synopis
7-------
8
9::
10
11    bootdev list [-p]        - list all available bootdevs (-p to probe)
12    bootdev hunt [-l|<spec>] - use hunt drivers to find bootdevs
13    bootdev select <bm>      - select a bootdev by name
14    bootdev info [-p]        - show information about a bootdev
15
16Description
17-----------
18
19The `bootdev` command is used to manage bootdevs. It can list available
20bootdevs, select one and obtain information about it.
21
22See :doc:`../../develop/bootstd` for more information about bootdevs in general.
23
24
25bootdev list
26~~~~~~~~~~~~
27
28This lists available bootdevs
29
30Scanning with `-p` causes the bootdevs to be probed. This happens automatically
31when they are used.
32
33The list looks something like this:
34
35===  ======  ======  ========  =========================
36Seq  Probed  Status  Uclass    Name
37===  ======  ======  ========  =========================
38  0   [ + ]      OK  mmc       mmc@7e202000.bootdev
39  1   [   ]      OK  mmc       sdhci@7e300000.bootdev
40  2   [   ]      OK  ethernet  smsc95xx_eth.bootdev
41===  ======  ======  ========  =========================
42
43
44The fields are as follows:
45
46Seq:
47    Sequence number in the scan, used to reference the bootflow later
48
49Probed:
50    Shows a plus (+) if the device is probed, empty if not.
51
52Status:
53    Shows the status of the device. Typically this is `OK` meaning that there is
54    no error. If you use -p and an error occurs when probing, then this shows
55    the error number. You can look up Linux error codes to find the meaning of
56    the number.
57
58Uclass:
59    Name of the media device's Uclass. This indicates the type of the parent
60    device (e.g. MMC, Ethernet).
61
62Name:
63    Name of the bootdev. This is generated from the media device appended
64    with `.bootdev`
65
66
67bootdev hunt
68~~~~~~~~~~~~
69
70This hunts for new bootdevs, or shows a list of hunters.
71
72Use `-l` to list the available bootdev hunters.
73
74To run hunters, specify the name of the hunter to run, e.g. "mmc". If no
75name is provided, all hunters are run.
76
77
78bootdev select
79~~~~~~~~~~~~~~~~~
80
81Use this to select a particular bootdev. You can select it by the sequence
82number or name, as shown in `bootdev list`.
83
84Once a bootdev is selected, you can use `bootdev info` to look at it or
85`bootflow scan` to scan it.
86
87If no bootdev name or number is provided, then any existing bootdev is
88unselected.
89
90
91bootdev info
92~~~~~~~~~~~~~~~
93
94This shows information on the current bootdev, with the format looking like
95this:
96
97=========  =======================
98Name       `mmc@7e202000.bootdev`
99Sequence   0
100Status     Probed
101Uclass     mmc
102Bootflows  1 (1 valid)
103=========  =======================
104
105Most of the information is the same as `bootdev list` above. The new fields
106are:
107
108Device
109    Name of the bootdev
110
111Status
112    Shows `Probed` if the device is probed, `OK` if not. If `-p` is used and the
113    device fails to probe, an error code is shown.
114
115Bootflows
116    Indicates the number of bootflows attached to the bootdev. This is 0
117    unless you have used 'bootflow scan' on the bootflow, or on all bootflows.
118
119
120Example
121-------
122
123This example shows listing available bootdev and getting information about
124one of them::
125
126   U-Boot> bootdev list
127   Seq  Probed  Status  Uclass    Name
128   ---  ------  ------  --------  ------------------
129     0   [ + ]      OK  mmc       mmc@7e202000.bootdev
130     1   [   ]      OK  mmc       sdhci@7e300000.bootdev
131     2   [   ]      OK  ethernet  smsc95xx_eth.bootdev
132   ---  ------  ------  --------  ------------------
133   (3 devices)
134   U-Boot> bootdev sel 0
135   U-Boot> bootflow scan
136   U-Boot> bootdev info
137   Name:      mmc@7e202000.bootdev
138   Sequence:  0
139   Status:    Probed
140   Uclass:    mmc
141   Bootflows: 1 (1 valid)
142
143This shows using one of the available hunters, then listing them::
144
145    => bootdev hunt usb
146    Hunting with: usb
147    Bus usb@1: scanning bus usb@1 for devices...
148    3 USB Device(s) found
149    => bootdev hunt -l
150    Prio  Used  Uclass           Hunter
151    ----  ----  ---------------  ---------------
152    6        ethernet         eth_bootdev
153    1        simple_bus       (none)
154    5        ide              ide_bootdev
155    2        mmc              mmc_bootdev
156    4        nvme             nvme_bootdev
157    4        scsi             scsi_bootdev
158    4        spi_flash        sf_bootdev
159    5     *  usb              usb_bootdev
160    4        virtio           virtio_bootdev
161    (total hunters: 9)
162    => usb stor
163    Device 0: Vendor: sandbox Rev: 1.0 Prod: flash
164                Type: Hard Disk
165                Capacity: 4.0 MB = 0.0 GB (8192 x 512)
166    Device 1: Vendor: sandbox Rev: 1.0 Prod: flash
167                Type: Hard Disk
168                Capacity: 0.0 MB = 0.0 GB (1 x 512)
169    =>
170
171
172Return value
173------------
174
175The return value $? is always 0 (true).
176