All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/31] Initial implementation of standard boot
@ 2022-01-19  1:42 Simon Glass
  2022-01-19  1:42 ` [PATCH v3 01/31] str: Move string tests to the string module Simon Glass
                   ` (31 more replies)
  0 siblings, 32 replies; 106+ messages in thread
From: Simon Glass @ 2022-01-19  1:42 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Ilias Apalodimas, Daniel Schwierzeck, Dennis Gilmore,
	Steffen Jaeckel, Lukas Auer, Michal Simek, Tom Rini,
	Heinrich Schuchardt, Simon Glass, Jaehoon Chung, Marek Vasut,
	Pavel Herrmann, Peng Fan


The bootflow feature provide a built-in way for U-Boot to automatically
boot an Operating System without custom scripting and other customisation.
This is called 'standard boot' since it provides a standard way for
U-Boot to boot a distro, without scripting.

It introduces the following concepts:

   - bootdev - a device which can hold a distro
   - bootmeth - a method to scan a bootdev to find bootflows (owned by
                U-Boot)
   - bootflow - a description of how to boot (owned by the distro)

This series provides an implementation of these, enabled to scan for
bootflows from MMC, USB and Ethernet. It supports the existing distro
boot as well as the EFI loader flow (bootefi/bootmgr). It works
similiarly to the existing script-based approach, but is native to
U-Boot.

With this we can boot on a Raspberry Pi 3 with just one command:

   bootflow scan -lb

which means to scan, listing (-l) each bootflow and trying to boot each
one (-b). The final patch shows this.

With a standard way to identify boot devices, booting become easier. It
also should be possible to support U-Boot scripts, for backwards
compatibility only.

This series relies on the PXE clean-up series, posted here:

   https://patchwork.ozlabs.org/project/uboot/list/?series=267078

For documentation, see the 'doc' patch.

For version 2, a new naming scheme is used as above:

   - bootdev is used instead of bootdevice, because 'device' is overused,
       is everywhere in U-Boot, can be confused with udevice
   - bootmeth - because 'method' is too vanilla, appears 1300 times in
       U-Boot

Also in version 2, drivers are introduced for the boot methods, to make
it more extensible. Booting a custom OS is simply a matter of creating a
bootmeth for it and implementing the read_file() and boot() methods.

The design is described in these two documents:

https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing

https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing

Overall size increment on rpi_3_32b is 6.75KB.

The series is available at u-boot-dm/bme-working

Sample log on rpi_3_32b:

U-Boot 2021.10-rc2-00043-gccd453aa918-dirty (Aug 28 2021 - 13:58:46 -0600)

DRAM:  992 MiB
RPI 3 Model B (0xa22082)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... usb_kbd usb_kbd: Timeout poll on interrupt endpoint
Failed to get keyboard state from device 0c40:8000
4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
Scanning for bootflows in all bootmethods
Seq  Type         State   Uclass    Part  Name                      Filename

---  -----------  ------  --------  ----  ------------------------  ----------------
Scanning bootmethod 'mmc@7e202000.bootmethod':
  0  efi-loader   loaded  mmc          1  mmc@7e202000.bootmethod.p efi/boot/bootarm.efi
** Booting bootflow 'mmc@7e202000.bootmethod.part_1'
Scanning disk mmc@7e202000.blk...
** Unrecognized filesystem type **
Card did not respond to voltage select! : -110
Scanning disk sdhci@7e300000.blk...
Disk sdhci@7e300000.blk not ready
Found 4 disks
No EFI system partition
Booting /efi\boot
Waiting for Ethernet connection... done.

      Fedora (5.11.12-300.fc34.armv7hl) 34 (Workstation Edition)
      UEFI Firmware Settings

      Use the ▲ and ▼ keys to change the selection.
      Press 'e' to edit the selected item, or 'c' for a command prompt. Press Escape to return to the previous menu.
   The selected entry will be started automatically in 0s.

Changes in v3:
- Change the function to return a pointer to the first digit
- Add some tests, including one for 'abc123def456'
- Add new patch to rename uclass_get_by_name_len()
- Add new patch to support finding a uclass device by partial name
- Mention bootflow_state[] in enum bootflow_state_t
- Add CONFIG_BOOTSTD_FULL to enable the full feature set
- Support bootdev-order and filename-prefixes only with CONFIG_BOOTSTD_FULL
- Update for the new trailing_strtoln_end()
- Add bootdev_get_from_blk() function
- Use blk_find_device() to find the block device for a media device
- Move bootdev ordering into the uclass
- Move bootmeth ordering into the uclass
- Support "bootmeths" env var
- Add some more common functions
- Point to the header file for bootflow_state[] docs
- Explain why it is OK to use "?" as an unknown bootflow state
- Move bootmeth/bootdev ordering into the uclass
- Use separate Kconfig options for each command
- Use separate Kconfig options for each command
- Put some features behind CONFIG_BOOTFLOW_FULL
- Move bootmeth ordering into the uclass
- Use new bootmeth_try_file() function
- Use a short name when BOOTSTD_FULL is not enabled
- Use common bootmeth functions
- Adjust for new blk_find_device() function
- Add a log category
- Use a short name when BOOTSTD_FULL is not enabled
- Add a log category
- Use a short name when BOOTSTD_FULL is not enabled
- Align the EFI load address
- Use common bootmeth functions
- Add a log category
- Add a log category
- Add a log category
- Add support for script boot
- Update bootdev_test_order() for boot_targets env var
- Add tests for the "bootmeths" env var
- Update tests for the new 'bootmeth order' syntax
- Update test condition to use CMD_BOOTFLOW
- Update docs for "bootmeths" and "boot_targets" env vars

Simon Glass (31):
  str: Move string tests to the string module
  test: Add tests for trailing_strtol()
  str: Fix a few bugs in trailing_strtoln()
  lib: Add a way to find the postiion of a trailing number
  dm: core: Rename uclass_get_by_name_len()
  dm: core: Allow finding a uclass device by partial name
  test: fastboot: Avoid using mmc1
  test: dm: Restart USB before assuming it is stopped
  dm: blk: Add a function to return the device type
  bootstd: Add the concept of a bootflow
  bootstd: Add the bootstd uclass and core implementation
  bootstd: Add the bootdev uclass
  bootstd: Add the bootmeth uclass and helpers
  bootstd: Add support for bootflows
  bootstd: Add a bootdev command
  bootstd: Add a bootflow command
  bootstd: Add a bootmeth command
  bootstd: Add an implementation of distro boot
  bootstd: mmc: Add a bootdev driver
  bootstd: ethernet: Add a bootdev driver
  bootstd: Add an implementation of distro PXE boot
  bootstd: Add an implementation of EFI boot
  bootstd: Add a system bootdev for strange boot methods
  bootstd: Add an implementation of EFI bootmgr
  bootstd: Add a sandbox bootmeth driver
  bootstd: Add an implementation of script boot
  bootstd: usb: Add a bootdev driver
  bootstd: Add tests for bootstd including all uclasses
  bootstd: Add setup for the bootflow tests
  bootstd: doc: Add documentation
  RFC: Switch rpi over to use bootstd

 MAINTAINERS                           |  21 +
 arch/sandbox/dts/test.dts             |  18 +
 boot/Kconfig                          | 101 +++-
 boot/Makefile                         |  15 +
 boot/bootdev-uclass.c                 | 649 ++++++++++++++++++++++++++
 boot/bootflow.c                       | 410 ++++++++++++++++
 boot/bootmeth-uclass.c                | 298 ++++++++++++
 boot/bootmeth_distro.c                | 142 ++++++
 boot/bootmeth_efi.c                   | 183 ++++++++
 boot/bootmeth_efi_mgr.c               |  86 ++++
 boot/bootmeth_pxe.c                   | 186 ++++++++
 boot/bootmeth_sandbox.c               |  69 +++
 boot/bootmeth_script.c                | 137 ++++++
 boot/bootstd-uclass.c                 | 183 ++++++++
 boot/system_bootdev.c                 |  66 +++
 cmd/Kconfig                           |  39 ++
 cmd/Makefile                          |   3 +
 cmd/bootdev.c                         | 120 +++++
 cmd/bootflow.c                        | 399 ++++++++++++++++
 cmd/bootmeth.c                        | 113 +++++
 common/usb_storage.c                  |  12 +
 configs/amcore_defconfig              |   1 +
 configs/rcar3_salvator-x_defconfig    |   1 +
 configs/sandbox_defconfig             |   3 +-
 configs/sandbox_flattree_defconfig    |   3 +-
 configs/tbs2910_defconfig             |   1 +
 doc/develop/bootstd.rst               | 638 +++++++++++++++++++++++++
 doc/develop/distro.rst                |   3 +
 doc/develop/index.rst                 |   1 +
 doc/device-tree-bindings/bootdev.txt  |  26 ++
 doc/device-tree-bindings/bootmeth.txt |  31 ++
 doc/device-tree-bindings/bootstd.txt  |  36 ++
 doc/usage/bootdev.rst                 | 135 ++++++
 doc/usage/bootflow.rst                | 427 +++++++++++++++++
 doc/usage/bootmeth.rst                | 108 +++++
 doc/usage/index.rst                   |   3 +
 drivers/block/blk-uclass.c            |   8 +
 drivers/core/uclass.c                 |  20 +-
 drivers/mmc/Makefile                  |   5 +
 drivers/mmc/mmc-uclass.c              |  23 +
 drivers/mmc/mmc_bootdev.c             |  62 +++
 drivers/usb/host/Makefile             |   4 +
 drivers/usb/host/usb_bootdev.c        |  61 +++
 include/blk.h                         |   8 +
 include/bootdev.h                     | 275 +++++++++++
 include/bootflow.h                    | 306 ++++++++++++
 include/bootmeth.h                    | 234 ++++++++++
 include/bootstd.h                     |  80 ++++
 include/configs/rpi.h                 |  39 +-
 include/distro.h                      |  24 +
 include/dm/device.h                   |   2 +-
 include/dm/uclass-id.h                |   3 +
 include/dm/uclass-internal.h          |  16 +
 include/dm/uclass.h                   |   8 +-
 include/env_callback.h                |   7 +
 include/mmc.h                         |  12 +-
 include/test/suites.h                 |   2 +
 include/vsprintf.h                    |  22 +-
 lib/strto.c                           |  23 +-
 net/Kconfig                           |   9 +
 net/Makefile                          |   1 +
 net/eth-uclass.c                      |   8 +
 net/eth_bootdev.c                     | 101 ++++
 test/Makefile                         |   1 +
 test/boot/Makefile                    |   5 +
 test/boot/bootdev.c                   | 223 +++++++++
 test/boot/bootflow.c                  | 398 ++++++++++++++++
 test/boot/bootmeth.c                  | 122 +++++
 test/boot/bootstd_common.c            |  35 ++
 test/boot/bootstd_common.h            |  27 ++
 test/cmd_ut.c                         |   7 +
 test/dm/blk.c                         |   6 +
 test/dm/fastboot.c                    |   4 +-
 test/print_ut.c                       |  40 --
 test/py/tests/bootstd/mmc1.img.xz     | Bin 0 -> 4448 bytes
 test/py/tests/test_ut.py              | 103 ++++
 test/str_ut.c                         |  72 +++
 77 files changed, 6971 insertions(+), 102 deletions(-)
 create mode 100644 boot/bootdev-uclass.c
 create mode 100644 boot/bootflow.c
 create mode 100644 boot/bootmeth-uclass.c
 create mode 100644 boot/bootmeth_distro.c
 create mode 100644 boot/bootmeth_efi.c
 create mode 100644 boot/bootmeth_efi_mgr.c
 create mode 100644 boot/bootmeth_pxe.c
 create mode 100644 boot/bootmeth_sandbox.c
 create mode 100644 boot/bootmeth_script.c
 create mode 100644 boot/bootstd-uclass.c
 create mode 100644 boot/system_bootdev.c
 create mode 100644 cmd/bootdev.c
 create mode 100644 cmd/bootflow.c
 create mode 100644 cmd/bootmeth.c
 create mode 100644 doc/develop/bootstd.rst
 create mode 100644 doc/device-tree-bindings/bootdev.txt
 create mode 100644 doc/device-tree-bindings/bootmeth.txt
 create mode 100644 doc/device-tree-bindings/bootstd.txt
 create mode 100644 doc/usage/bootdev.rst
 create mode 100644 doc/usage/bootflow.rst
 create mode 100644 doc/usage/bootmeth.rst
 create mode 100644 drivers/mmc/mmc_bootdev.c
 create mode 100644 drivers/usb/host/usb_bootdev.c
 create mode 100644 include/bootdev.h
 create mode 100644 include/bootflow.h
 create mode 100644 include/bootmeth.h
 create mode 100644 include/bootstd.h
 create mode 100644 include/distro.h
 create mode 100644 net/eth_bootdev.c
 create mode 100644 test/boot/Makefile
 create mode 100644 test/boot/bootdev.c
 create mode 100644 test/boot/bootflow.c
 create mode 100644 test/boot/bootmeth.c
 create mode 100644 test/boot/bootstd_common.c
 create mode 100644 test/boot/bootstd_common.h
 create mode 100644 test/py/tests/bootstd/mmc1.img.xz

-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply	[flat|nested] 106+ messages in thread

end of thread, other threads:[~2022-03-12 17:59 UTC | newest]

Thread overview: 106+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  1:42 [PATCH v3 00/31] Initial implementation of standard boot Simon Glass
2022-01-19  1:42 ` [PATCH v3 01/31] str: Move string tests to the string module Simon Glass
2022-01-19 11:15   ` Heinrich Schuchardt
2022-03-06  3:08     ` Simon Glass
2022-01-19  1:42 ` [PATCH v3 02/31] test: Add tests for trailing_strtol() Simon Glass
2022-01-19 11:26   ` Heinrich Schuchardt
2022-01-19  1:42 ` [PATCH v3 03/31] str: Fix a few bugs in trailing_strtoln() Simon Glass
2022-01-31  9:44   ` Rasmus Villemoes
2022-01-31 16:13     ` Simon Glass
2022-01-19  1:42 ` [PATCH v3 04/31] lib: Add a way to find the postiion of a trailing number Simon Glass
2022-01-19 11:27   ` Heinrich Schuchardt
2022-01-19 14:37     ` Simon Glass
2022-01-19 15:11       ` Tom Rini
2022-01-19 17:23         ` Heinrich Schuchardt
2022-01-20  3:16     ` AKASHI Takahiro
2022-03-06  3:08       ` Simon Glass
2022-01-19  1:42 ` [PATCH v3 05/31] dm: core: Rename uclass_get_by_name_len() Simon Glass
2022-01-19 11:28   ` Heinrich Schuchardt
2022-01-19  1:42 ` [PATCH v3 06/31] dm: core: Allow finding a uclass device by partial name Simon Glass
2022-01-19 11:28   ` Heinrich Schuchardt
2022-01-19  1:42 ` [PATCH v3 07/31] test: fastboot: Avoid using mmc1 Simon Glass
2022-01-19  1:42 ` [PATCH v3 08/31] test: dm: Restart USB before assuming it is stopped Simon Glass
2022-01-19  1:42 ` [PATCH v3 09/31] dm: blk: Add a function to return the device type Simon Glass
2022-01-19 11:30   ` Heinrich Schuchardt
2022-01-19  1:42 ` [PATCH v3 10/31] bootstd: Add the concept of a bootflow Simon Glass
2022-01-19  1:42 ` [PATCH v3 11/31] bootstd: Add the bootstd uclass and core implementation Simon Glass
2022-01-19  1:42 ` [PATCH v3 12/31] bootstd: Add the bootdev uclass Simon Glass
2022-01-19  1:42 ` [PATCH v3 13/31] bootstd: Add the bootmeth uclass and helpers Simon Glass
2022-01-19  1:42 ` [PATCH v3 14/31] bootstd: Add support for bootflows Simon Glass
2022-01-19  1:42 ` [PATCH v3 15/31] bootstd: Add a bootdev command Simon Glass
2022-01-19  1:43 ` [PATCH v3 16/31] bootstd: Add a bootflow command Simon Glass
2022-01-19  1:43 ` [PATCH v3 17/31] bootstd: Add a bootmeth command Simon Glass
2022-01-19  1:43 ` [PATCH v3 18/31] bootstd: Add an implementation of distro boot Simon Glass
2022-01-19  1:43 ` [PATCH v3 19/31] bootstd: mmc: Add a bootdev driver Simon Glass
2022-01-19  1:43 ` [PATCH v3 20/31] bootstd: ethernet: " Simon Glass
2022-01-19  1:43 ` [PATCH v3 21/31] bootstd: Add an implementation of distro PXE boot Simon Glass
2022-01-19  1:43 ` [PATCH v3 22/31] bootstd: Add an implementation of EFI boot Simon Glass
2022-01-19  8:08   ` Michael Walle
2022-01-19 11:45   ` Heinrich Schuchardt
2022-03-06  3:08     ` Simon Glass
2022-03-07  9:03       ` Michael Walle
2022-01-19  1:43 ` [PATCH v3 23/31] bootstd: Add a system bootdev for strange boot methods Simon Glass
2022-01-19  1:43 ` [PATCH v3 24/31] bootstd: Add an implementation of EFI bootmgr Simon Glass
2022-01-19 11:47   ` Heinrich Schuchardt
2022-03-06  3:08     ` Simon Glass
2022-03-12  9:36       ` Ilias Apalodimas
2022-03-12 17:58         ` Simon Glass
2022-01-19  1:43 ` [PATCH v3 25/31] bootstd: Add a sandbox bootmeth driver Simon Glass
2022-01-19  1:43 ` [PATCH v3 26/31] bootstd: Add an implementation of script boot Simon Glass
2022-01-19  1:43 ` [PATCH v3 27/31] bootstd: usb: Add a bootdev driver Simon Glass
2022-01-19  1:43 ` [PATCH v3 28/31] bootstd: Add tests for bootstd including all uclasses Simon Glass
2022-01-19  1:43 ` [PATCH v3 29/31] bootstd: Add setup for the bootflow tests Simon Glass
2022-01-19  1:43 ` [PATCH v3 30/31] bootstd: doc: Add documentation Simon Glass
2022-01-19 11:39   ` Heinrich Schuchardt
2022-01-21 15:08     ` Tom Rini
2022-01-21 15:20       ` Simon Glass
2022-01-21 15:31         ` Tom Rini
2022-01-21 16:02           ` Simon Glass
2022-01-21 18:09             ` Tom Rini
2022-01-21 19:14               ` Simon Glass
2022-01-21 19:23                 ` Tom Rini
2022-01-21 21:15                   ` Simon Glass
2022-01-21 21:46                     ` Tom Rini
2022-01-21 22:18                       ` Simon Glass
2022-01-30  0:48           ` Ilias Apalodimas
2022-01-21 16:03         ` Mark Kettenis
2022-01-21 16:53           ` Simon Glass
2022-01-21 18:22             ` Mark Kettenis
2022-01-21 18:41               ` Tom Rini
2022-01-21 19:17               ` Simon Glass
2022-01-21 22:05                 ` Heinrich Schuchardt
2022-01-21 22:13                   ` Simon Glass
2022-01-22 11:44                   ` Mark Kettenis
2022-01-19  1:43 ` [PATCH v3 31/31] RFC: Switch rpi over to use bootstd Simon Glass
2022-01-19 14:04   ` Tom Rini
2022-01-19 14:37     ` Simon Glass
2022-01-19 15:01       ` Tom Rini
2022-01-19 16:09         ` Simon Glass
2022-01-19 16:21           ` Tom Rini
2022-01-19 16:38             ` Mark Kettenis
2022-01-19 23:26               ` Simon Glass
2022-01-20  8:35                 ` Michael Walle
2022-01-20 10:28                   ` Mark Kettenis
2022-01-20 18:16                     ` Simon Glass
2022-01-20 18:30                       ` Tom Rini
2022-01-20 18:56                         ` Mark Kettenis
2022-01-20 19:56                           ` Simon Glass
2022-01-20 19:56                         ` Simon Glass
2022-01-20 20:08                           ` Tom Rini
2022-01-20 20:47                             ` Simon Glass
2022-01-20 23:23                               ` Tom Rini
2022-01-21  0:59                                 ` Simon Glass
2022-01-21  1:08                                   ` Tom Rini
2022-01-21  3:12                                     ` Simon Glass
2022-01-21  9:36                                       ` Mark Kettenis
2022-01-21 15:25                                         ` Simon Glass
2022-01-21 15:05                                       ` Tom Rini
2022-01-21 15:23                                         ` Simon Glass
2022-01-19 23:23             ` Simon Glass
2022-01-19  8:09 ` [PATCH v3 00/31] Initial implementation of standard boot Michael Walle
2022-01-19 14:56   ` Simon Glass
2022-01-20  8:38     ` Michael Walle
2022-01-20 18:16       ` Simon Glass
2022-03-06  3:08         ` Simon Glass
2022-03-06 11:03           ` Michael Walle
2022-03-06 13:24             ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.