blob: dadd3473e5ccd2aa78f084e6376b4a9a935bb994 [file] [log] [blame]
Simon Glass83b9be62022-04-24 23:31:26 -06001.. SPDX-License-Identifier: GPL-2.0+:
2
3U-Boot Standard Boot
4====================
5
6Introduction
7------------
8
9Standard boot provides a built-in way for U-Boot to automatically boot
10an Operating System without custom scripting and other customisation. It
11introduces the following concepts:
12
13 - bootdev - a device which can hold or access a distro (e.g. MMC, Ethernet)
14 - bootmeth - a method to scan a bootdev to find bootflows (e.g. distro boot)
15 - bootflow - a description of how to boot (provided by the distro)
16
17For Linux, the distro (Linux distribution, e.g. Debian, Fedora) is responsible
18for creating a bootflow for each kernel combination that it wants to offer.
19These bootflows are stored on media so they can be discovered by U-Boot. This
20feature is typically called `distro boot` (see :doc:`distro`) because it is
21a way for distributions to boot on any hardware.
22
23Traditionally U-Boot has relied on scripts to implement this feature. See
24disto_boodcmd_ for details. This is done because U-Boot has no native support
25for scanning devices. While the scripts work remarkably well, they can be hard
26to understand and extend, and the feature does not include tests. They are also
27making it difficult to move away from ad-hoc CONFIGs, since they are implemented
28using the environment and a lot of #defines.
29
30Standard boot is a generalisation of distro boot. It provides a more built-in
31way to boot with U-Boot. The feature is extensible to different Operating
32Systems (such as Chromium OS) and devices (beyond just block and network
33devices). It supports EFI boot and EFI bootmgr too.
34
Simon Glassc08a9922022-07-30 15:52:03 -060035Finally, standard boot supports the operation of :doc:`vbe`.
Simon Glass83b9be62022-04-24 23:31:26 -060036
37Bootflow
38--------
39
40A bootflow is a file that describes how to boot a distro. Conceptually there can
41be different formats for that file but at present U-Boot only supports the
42BootLoaderSpec_ format. which looks something like this::
43
44 menu autoboot Welcome to Fedora-Workstation-armhfp-31-1.9. Automatic boot in # second{,s}. Press a key for options.
45 menu title Fedora-Workstation-armhfp-31-1.9 Boot Options.
46 menu hidden
47
48 label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
49 kernel /vmlinuz-5.3.7-301.fc31.armv7hl
50 append ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet LANG=en_US.UTF-8 cma=192MB cma=256MB
51 fdtdir /dtb-5.3.7-301.fc31.armv7hl/
52 initrd /initramfs-5.3.7-301.fc31.armv7hl.img
53
54As you can see it specifies a kernel, a ramdisk (initrd) and a directory from
55which to load devicetree files. The details are described in disto_boodcmd_.
56
57The bootflow is provided by the distro. It is not part of U-Boot. U-Boot's job
58is simply to interpret the file and carry out the instructions. This allows
59distros to boot on essentially any device supported by U-Boot.
60
61Typically the first available bootflow is selected and booted. If that fails,
62then the next one is tried.
63
64
65Bootdev
66-------
67
68Where does U-Boot find the media that holds the operating systems? That is the
69job of bootdev. A bootdev is simply a layer on top of a media device (such as
70MMC, NVMe). The bootdev accesses the device, including partitions and
71filesystems that might contain things related to an operating system.
72
73For example, an MMC bootdev provides access to the individual partitions on the
74MMC device. It scans through these to find filesystems, then provides a list of
75these for consideration.
76
77
78Bootmeth
79--------
80
81Once the list of filesystems is provided, how does U-Boot find the bootflow
82files in these filesystems. That is the job of bootmeth. Each boot method has
83its own way of doing this.
84
85For example, the distro bootmeth simply looks through the provided filesystem
86for a file called `extlinux/extlinux.conf`. This files constitutes a bootflow.
87If the distro bootmeth is used on multiple partitions it may produce multiple
88bootflows.
89
90Note: it is possible to have a bootmeth that uses a partition or a whole device
91directly, but it is more common to use a filesystem.
92
93
94Boot process
95------------
96
97U-Boot tries to use the 'lazy init' approach whereever possible and distro boot
98is no exception. The algorithm is::
99
100 while (get next bootdev)
101 while (get next bootmeth)
102 while (get next bootflow)
103 try to boot it
104
105So U-Boot works its way through the bootdevs, trying each bootmeth in turn to
106obtain bootflows, until it either boots or exhausts the available options.
107
108Instead of 500 lines of #defines and a 4KB boot script, all that is needed is
109the following command::
110
111 bootflow scan -lb
112
113which scans for available bootflows, optionally listing each find it finds (-l)
114and trying to boot it (-b).
115
116
117Controlling ordering
118--------------------
119
120Several options are available to control the ordering of boot scanning:
121
122
123boot_targets
124~~~~~~~~~~~~
125
126This environment variable can be used to control the list of bootdevs searched
127and their ordering, for example::
128
129 setenv boot_targets "mmc0 mmc1 usb pxe"
130
131Entries may be removed or re-ordered in this list to affect the boot order. If
132the variable is empty, the default ordering is used, based on the priority of
133bootdevs and their sequence numbers.
134
135
136bootmeths
137~~~~~~~~~
138
139This environment variable can be used to control the list of bootmeths used and
140their ordering for example::
141
142 setenv bootmeths "syslinux efi"
143
144Entries may be removed or re-ordered in this list to affect the order the
145bootmeths are tried on each bootdev. If the variable is empty, the default
146ordering is used, based on the bootmeth sequence numbers, which can be
147controlled by aliases.
148
149The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in
150the same way as setting this variable.
151
152
153Bootdev uclass
154--------------
155
156The bootdev uclass provides an simple API call to obtain a bootflows from a
157device::
158
159 int bootdev_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
160 struct bootflow *bflow);
161
162This takes a iterator which indicates the bootdev, partition and bootmeth to
163use. It returns a bootflow. This is the core of the bootdev implementation. The
164bootdev drivers that implement this differ depending on the media they are
165reading from, but each is responsible for returning a valid bootflow if
166available.
167
168A helper called `bootdev_find_in_blk()` makes it fairly easy to implement this
169function for each media device uclass, in a few lines of code.
170
171
172Bootdev drivers
173---------------
174
175A bootdev driver is typically fairly simple. Here is one for mmc::
176
177 static int mmc_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
178 struct bootflow *bflow)
179 {
180 struct udevice *mmc_dev = dev_get_parent(dev);
181 struct udevice *blk;
182 int ret;
183
184 ret = mmc_get_blk(mmc_dev, &blk);
185 /*
186 * If there is no media, indicate that no more partitions should be
187 * checked
188 */
189 if (ret == -EOPNOTSUPP)
190 ret = -ESHUTDOWN;
191 if (ret)
192 return log_msg_ret("blk", ret);
193 assert(blk);
194 ret = bootdev_find_in_blk(dev, blk, iter, bflow);
195 if (ret)
196 return log_msg_ret("find", ret);
197
198 return 0;
199 }
200
201 static int mmc_bootdev_bind(struct udevice *dev)
202 {
203 struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
204
205 ucp->prio = BOOTDEVP_0_INTERNAL_FAST;
206
207 return 0;
208 }
209
210 struct bootdev_ops mmc_bootdev_ops = {
211 .get_bootflow = mmc_get_bootflow,
212 };
213
214 static const struct udevice_id mmc_bootdev_ids[] = {
215 { .compatible = "u-boot,bootdev-mmc" },
216 { }
217 };
218
219 U_BOOT_DRIVER(mmc_bootdev) = {
220 .name = "mmc_bootdev",
221 .id = UCLASS_BOOTDEV,
222 .ops = &mmc_bootdev_ops,
223 .bind = mmc_bootdev_bind,
224 .of_match = mmc_bootdev_ids,
225 };
226
227The implementation of the `get_bootflow()` method is simply to obtain the
228block device and call a bootdev helper function to do the rest. The
229implementation of `bootdev_find_in_blk()` checks the partition table, and
230attempts to read a file from a filesystem on the partition number given by the
231`@iter->part` parameter.
232
233Each bootdev has a priority, which indicates the order in which it is used.
234Faster bootdevs are used first, since they are more likely to be able to boot
235the device quickly.
236
237
238Device hierarchy
239----------------
240
241A bootdev device is a child of the media device. In this example, you can see
242that the bootdev is a sibling of the block device and both are children of
243media device::
244
245 mmc 0 [ + ] bcm2835-sdhost | |-- mmc@7e202000
246 blk 0 [ + ] mmc_blk | | |-- mmc@7e202000.blk
247 bootdev 0 [ ] mmc_bootdev | | `-- mmc@7e202000.bootdev
248 mmc 1 [ + ] sdhci-bcm2835 | |-- sdhci@7e300000
249 blk 1 [ ] mmc_blk | | |-- sdhci@7e300000.blk
250 bootdev 1 [ ] mmc_bootdev | | `-- sdhci@7e300000.bootdev
251
252The bootdev device is typically created automatically in the media uclass'
253`post_bind()` method by calling `bootdev_setup_for_dev()`. The code typically
254something like this::
255
256 ret = bootdev_setup_for_dev(dev, "eth_bootdev");
257 if (ret)
258 return log_msg_ret("bootdev", ret);
259
260Here, `eth_bootdev` is the name of the Ethernet bootdev driver and `dev`
261is the ethernet device. This function is safe to call even if standard boot is
262not enabled, since it does nothing in that case. It can be added to all uclasses
263which implement suitable media.
264
265
266The bootstd device
267------------------
268
269Standard boot requires a single instance of the bootstd device to make things
270work. This includes global information about the state of standard boot. See
271`struct bootstd_priv` for this structure, accessed with `bootstd_get_priv()`.
272
273Within the devicetree, if you add bootmeth devices or a system bootdev, they
274should be children of the bootstd device. See `arch/sandbox/dts/test.dts` for
275an example of this.
276
277
278The system bootdev
279------------------
280
281Some bootmeths don't operate on individual bootdevs, but on the whole system.
282For example, the EFI boot manager does its own device scanning and does not
283make use of the bootdev devices. Such bootmeths can make use of the system
284bootdev, typically considered last, after everything else has been tried.
285
286
287.. _`Automatic Devices`:
288
289Automatic devices
290-----------------
291
292It is possible to define all the required devices in the devicetree manually,
293but it is not necessary. The bootstd uclass includes a `dm_scan_other()`
294function which creates the bootstd device if not found. If no bootmeth devices
295are found at all, it creates one for each available bootmeth driver as well as a
296system bootdev.
297
298If your devicetree has any bootmeth device it must have all of them that you
299want to use, as well as the system bootdev if needed, since no bootmeth devices
300will be created automatically in that case.
301
302
303Using devicetree
304----------------
305
306If a bootdev is complicated or needs configuration information, it can be
307added to the devicetree as a child of the media device. For example, imagine a
308bootdev which reads a bootflow from SPI flash. The devicetree fragment might
309look like this::
310
311 spi@0 {
312 flash@0 {
313 reg = <0>;
314 compatible = "spansion,m25p16", "jedec,spi-nor";
315 spi-max-frequency = <40000000>;
316
317 bootdev {
318 compatible = "u-boot,sf-bootdev";
319 offset = <0x2000>;
320 size = <0x1000>;
321 };
322 };
323 };
324
325The `sf-bootdev` driver can implement a way to read from the SPI flash, using
326the offset and size provided, and return that bootflow file back to the caller.
327When distro boot wants to read the kernel it calls disto_getfile() which must
328provide a way to read from the SPI flash. See `distro_boot()` at distro_boot_
329for more details.
330
331Of course this is all internal to U-Boot. All the distro sees is another way
332to boot.
333
334
335Configuration
336-------------
337
338Standard boot is enabled with `CONFIG_BOOTSTD`. Each bootmeth has its own CONFIG
339option also. For example, `CONFIG_BOOTMETH_DISTRO` enables support for distro
340boot from a disk.
341
342
343Available bootmeth drivers
344--------------------------
345
346Bootmeth drivers are provided for:
347
348 - distro boot from a disk (syslinux)
349 - distro boot from a network (PXE)
350 - EFI boot using bootefi
351 - EFI boot using boot manager
352
353
354Command interface
355-----------------
356
357Three commands are available:
358
359`bootdev`
360 Allows listing of available bootdevs, selecting a particular one and
361 getting information about it. See :doc:`../usage/cmd/bootdev`
362
363`bootflow`
364 Allows scanning one or more bootdevs for bootflows, listing available
365 bootflows, selecting one, obtaining information about it and booting it.
366 See :doc:`../usage/cmd/bootflow`
367
368`bootmeth`
369 Allow listing of available bootmethds and setting the order in which they
370 are tried. See :doc:`../usage/cmd/bootmeth`
371
372.. _BootflowStates:
373
374Bootflow states
375---------------
376
377Here is a list of states that a bootflow can be in:
378
379======= =======================================================================
380State Meaning
381======= =======================================================================
382base Starting-out state, indicates that no media/partition was found. For an
383 SD card socket it may indicate that the card is not inserted.
384media Media was found (e.g. SD card is inserted) but no partition information
385 was found. It might lack a partition table or have a read error.
386part Partition was found but a filesystem could not be read. This could be
387 because the partition does not hold a filesystem or the filesystem is
388 very corrupted.
389fs Filesystem was found but the file could not be read. It could be
390 missing or in the wrong subdirectory.
391file File was found and its size detected, but it could not be read. This
392 could indicate filesystem corruption.
393ready File was loaded and is ready for use. In this state the bootflow is
394 ready to be booted.
395======= =======================================================================
396
397
398Theory of operation
399-------------------
400
401This describes how standard boot progresses through to booting an operating
402system.
403
404To start. all the necessary devices must be bound, including bootstd, which
405provides the top-level `struct bootstd_priv` containing optional configuration
406information. The bootstd device is also holds the various lists used while
407scanning. This step is normally handled automatically by driver model, as
408described in `Automatic Devices`_.
409
410Bootdevs are also required, to provide access to the media to use. These are not
411useful by themselves: bootmeths are needed to provide the means of scanning
412those bootdevs. So, all up, we need a single bootstd device, one or more bootdev
413devices and one or more bootmeth devices.
414
415Once these are ready, typically a `bootflow scan` command is issued. This kicks
416of the iteration process, which involves looking through the bootdevs and their
417partitions one by one to find bootflows.
418
419Iteration is kicked off using `bootflow_scan_first()`, which calls
420`bootflow_scan_bootdev()`.
421
422The iterator is set up with `bootflow_iter_init()`. This simply creates an
423empty one with the given flags. Flags are used to control whether each
424iteration is displayed, whether to return iterations even if they did not result
425in a valid bootflow, whether to iterate through just a single bootdev, etc.
426
427Then the ordering of bootdevs is determined, by `bootdev_setup_iter_order()`. By
428default, the bootdevs are used in the order specified by the `boot_targets`
429environment variable (e.g. "mmc2 mmc0 usb"). If that is missing then their
430sequence order is used, as determined by the `/aliases` node, or failing that
431their order in the devicetree. For BOOTSTD_FULL, if there is a `bootdev-order`
432property in the bootstd node, then this is used as a final fallback. In any
433case, the iterator ends up with a `dev_order` array containing the bootdevs that
434are going to be used, with `num_devs` set to the number of bootdevs and
435`cur_dev` starting at 0.
436
437Next, the ordering of bootdevs is determined, by `bootmeth_setup_iter_order()`.
438By default the ordering is again by sequence number, i.e. the `/aliases` node,
439or failing that the order in the devicetree. But the `bootmeth order` command
440or `bootmeths` environment variable can be used to set up an ordering. If that
441has been done, the ordering is in `struct bootstd_priv`, so that ordering is
442simply copied into the iterator. Either way, the `method_order` array it set up,
443along with `num_methods`. Then `cur_method` is set to 0.
444
445At this point the iterator is ready to use, with the first bootdev and bootmeth
446selected. All the other fields are 0. This means that the current partition is
4470, which is taken to mean the whole device, since partition numbers start at 1.
448It also means that `max_part` is 0, i.e. the maximum partition number we know
449about is 0, meaning that, as far as we know, there is no partition table on this
450bootdev.
451
452With the iterator ready, `bootflow_scan_bootdev()` checks whether the current
453settings produce a valid bootflow. This is handled by `bootflow_check()`, which
454either returns 0 (if it got something) or an error if not (more on that later).
455If the `BOOTFLOWF_ALL` iterator flag is set, even errors are returned as
456incomplete bootflows, but normally an error results in moving onto the next
457iteration.
458
459The `bootflow_scan_next()` function handles moving onto the next iteration and
460checking it. In fact it sits in a loop doing that repeatedly until it finds
461something it wants to return.
462
463The actual 'moving on' part is implemented in `iter_incr()`. This is a very
464simple function. It increments the first counter. If that hits its maximum, it
465sets it to zero and increments the second counter. You can think of all the
466counters together as a number with three digits which increment in order, with
467the least-sigificant digit on the right, counting like this:
468
469 ======== ======= =======
470 bootdev part method
471 ======== ======= =======
472 0 0 0
473 0 0 1
474 0 0 2
475 0 1 0
476 0 1 1
477 0 1 1
478 1 0 0
479 1 0 1
480 ======== ======= =======
481
482The maximum value for `method` is `num_methods - 1` so when it exceeds that, it
483goes back to 0 and the next `part` is considered. The maximum value for that is
484`max_part`, which is initially zero for all bootdevs. If we find a partition
485table on that bootdev, `max_part` can be updated during the iteration to a
486higher value - see `bootdev_find_in_blk()` for that, described later. If that
487exceeds its maximum, then the next bootdev is used. In this way, iter_incr()
488works its way through all possibilities, moving forward one each time it is
489called.
490
491There is no expectation that iteration will actually finish. Quite often a
492valid bootflow is found early on. With `bootflow scan -b`, that causes the
493bootflow to be immediately booted. Assuming it is successful, the iteration never
494completes.
495
496Also note that the iterator hold the **current** combination being considered.
497So when `iter_incr()` is called, it increments to the next one and returns it,
498the new **current** combination.
499
500Note also the `err` field in `struct bootflow_iter`. This is normally 0 and has
501thus has no effect on `iter_inc()`. But if it is non-zero, signalling an error,
502it indicates to the iterator what it should do when called. It can force moving
503to the next partition, or bootdev, for example. The special values
504`BF_NO_MORE_PARTS` and `BF_NO_MORE_DEVICES` handle this. When `iter_incr` sees
505`BF_NO_MORE_PARTS` it knows that it should immediately move to the next bootdev.
506When it sees `BF_NO_MORE_DEVICES` it knows that there is nothing more it can do
507so it should immediately return. The caller of `iter_incr()` is responsible for
508updating the `err` field, based on the return value it sees.
509
510The above describes the iteration process at a high level. It is basically a
511very simple increment function with a checker called `bootflow_check()` that
512checks the result of each iteration generated, to determine whether it can
513produce a bootflow.
514
515So what happens inside of `bootflow_check()`? It simply calls the uclass
516method `bootdev_get_bootflow()` to ask the bootdev to return a bootflow. It
517passes the iterator to the bootdev method, so that function knows what we are
518talking about. At first, the bootflow is set up in the state `BOOTFLOWST_BASE`,
519with just the `method` and `dev` intiialised. But the bootdev may fill in more,
520e.g. updating the state, depending on what it finds.
521
522Based on what the bootdev responds with, `bootflow_check()` either
523returns a valid bootflow, or a partial one with an error. A partial bootflow
524is one that has some fields set up, but did not reach the `BOOTFLOWST_READY`
525state. As noted before, if the `BOOTFLOWF_ALL` iterator flag is set, then all
526bootflows are returned, even partial ones. This can help with debugging.
527
528So at this point you can see that total control over whether a bootflow can
529be generated from a particular iteration, or not, rests with the bootdev.
530Each one can adopt its own approach.
531
532Going down a level, what does the bootdev do in its `get_bootflow()` method?
533Let us consider the MMC bootdev. In that case the call to
534`bootdev_get_bootflow()` ends up in `mmc_get_bootflow()`. It locates the parent
535device of the bootdev, i.e. the `UCLASS_MMC` device itself, then finds the block
536device associated with it. It then calls the helper function
537`bootdev_find_in_blk()` to do all the work. This is common with just about any
538bootdev that is based on a media device.
539
540The `bootdev_find_in_blk()` helper is implemented in the bootdev uclass. It
541names the bootflow and copies the partition number in from the iterator. Then it
542calls the bootmeth device to check if it can support this device. This is
543important since some bootmeths only work with network devices, for example. If
544that check fails, it stops.
545
546Assuming the bootmeth is happy, or at least indicates that it is willing to try
547(by returning 0 from its `check()` method), the next step is to try the
548partition. If that works it tries to detect a file system. If that works then it
549calls the bootmeth device once more, this time to read the bootflow.
550
551Note: At present a filesystem is needed for the bootmeth to be called on block
552devices, simply because we don't have any examples where this is not the case.
553This feature can be added as needed.
554
555If we take the example of the `bootmeth_distro` driver, this call ends up at
556`distro_read_bootflow()`. It has the filesystem ready, so tries various
557filenames to try to find the `extlinux.conf` file, reading it if possible. If
558all goes well the bootflow ends up in the `BOOTFLOWST_READY` state.
559
560At this point, we fall back from the bootmeth driver, to
561`bootdev_find_in_blk()`, then back to `mmc_get_bootflow()`, then to
562`bootdev_get_bootflow()`, then to `bootflow_check()` and finally to its caller,
563either `bootflow_scan_bootdev()` or `bootflow_scan_next()`. In either case,
564the bootflow is returned as the result of this iteration, assuming it made it to
565the `BOOTFLOWST_READY` state.
566
567That is the basic operation of scanning for bootflows. The process of booting a
568bootflow is handled by the bootmeth driver for that bootflow. In the case of
569distro boot, this parses and processes the `extlinux.conf` file that was read.
570See `distro_boot()` for how that works. The processing may involve reading
571additional files, which is handled by the `read_file()` method, which is
572`distro_read_file()` in this case. All bootmethds should support reading files,
573since the bootflow is typically only the basic instructions and does not include
574the operating system itself, ramdisk, device tree, etc.
575
576The vast majority of the bootstd code is concerned with iterating through
577partitions on bootdevs and using bootmethds to find bootflows.
578
579How about bootdevs which are not block devices? They are handled by the same
580methods as above, but with a different implementation. For example, the bootmeth
581for PXE boot (over a network) uses `tftp` to read files rather than `fs_read()`.
582But other than that it is very similar.
583
584
585Tests
586-----
587
588Tests are located in `test/boot` and cover the core functionality as well as
589the commands. All tests use sandbox so can be run on a standard Linux computer
590and in U-Boot's CI.
591
592For testing, a DOS-formatted disk image is used with a single FAT partition on
593it. This is created in `setup_bootflow_image()`, with a canned one from the
594source tree used if it cannot be created (e.g. in CI).
595
596
597Bootflow internals
598------------------
599
600The bootstd device holds a linked list of scanned bootflows as well as the
601currently selected bootdev and bootflow (for use by commands). This is in
602`struct bootstd_priv`.
603
604Each bootdev device has its own `struct bootdev_uc_plat` which holds a
605list of scanned bootflows just for that device.
606
607The bootflow itself is documented in bootflow_h_. It includes various bits of
608information about the bootflow and a buffer to hold the file.
609
610
611Future
612------
613
614Apart from the to-do items below, different types of bootflow files may be
615implemented in future, e.g. Chromium OS support which is currently only
616available as a script in chromebook_coral.
617
618
619To do
620-----
621
622Some things that need to be done to completely replace the distro-boot scripts:
623
624- add bootdev drivers for dhcp, sata, scsi, ide, virtio
625- PXE boot for EFI
626- support for loading U-Boot scripts
627
628Other ideas:
629
630- `bootflow prep` to load everything preparing for boot, so that `bootflow boot`
631 can just do the boot.
632- automatically load kernel, FDT, etc. to suitable addresses so the board does
633 not need to specify things like `pxefile_addr_r`
634
635
636.. _disto_boodcmd: https://github.com/u-boot/u-boot/blob/master/include/config_distro_bootcmd.h
637.. _BootLoaderSpec: http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
638.. _distro_boot: https://github.com/u-boot/u-boot/blob/master/boot/distro.c
639.. _bootflow_h: https://github.com/u-boot/u-boot/blob/master/include/bootflow.h