bootstd: Add command to enable setting of bootmeth specific properties
We have previously added logic to allow a "fallback" option to be
specified in the extlinux configuration. Provide a command that allows
us to set this as the preferred default option when booting.
Combined with the bootcount functionality, this allows the "altbootcmd"
to provide a means of falling back to a previously known good state
after a failed update. For example, if "bootcmd" is set to:
bootflow scan -lb
We would set "altbootcmd" to:
bootmeth set extlinux fallback 1; bootflow scan -lb
Causing the boot process to boot from the fallback option.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst
index c6f0038..a2913cd 100644
--- a/doc/develop/bootstd/overview.rst
+++ b/doc/develop/bootstd/overview.rst
@@ -103,6 +103,12 @@
returns the bootflow, if found. Some of these bootmeths may be very slow, if
they scan a lot of devices.
+The extlinux bootmeth also allows for bootmeth specific configuration to be
+set. A bootmeth that wishes to support this provides the `set_property()`
+method. This allows string properties and values to be passed to the bootmeth.
+It is up to the bootmeth to determine what action to take when this method is
+called.
+
Boot process
------------
@@ -459,8 +465,8 @@
See :doc:`/usage/cmd/bootflow`
`bootmeth`
- Allow listing of available bootmethds and setting the order in which they
- are tried. See :doc:`/usage/cmd/bootmeth`
+ Allow listing of available bootmethds, setting the order in which they are
+ tried and bootmeth specific configuration. See :doc:`/usage/cmd/bootmeth`
.. _BootflowStates:
diff --git a/doc/usage/cmd/bootmeth.rst b/doc/usage/cmd/bootmeth.rst
index c3d2ec1..4f899d9 100644
--- a/doc/usage/cmd/bootmeth.rst
+++ b/doc/usage/cmd/bootmeth.rst
@@ -12,7 +12,8 @@
::
bootmeth list [-a] - list selected bootmeths (-a for all)
- bootmeth order "[<bm> ...]" - select the order of bootmeths\n"
+ bootmeth order "[<bm> ...]" - select the order of bootmeths
+ bootmeth set <bootmeth> <property> <value> - set optional property
Description
@@ -112,3 +113,38 @@
- 4 efi_mgr EFI bootmgr flow
----- --- ------------------ ------------------
(5 bootmeths)
+
+
+bootmeth set
+~~~~~~~~~~~~
+
+Allows setting of bootmeth specific configuration. This allows finer grain
+control over the boot process in specific instances.
+
+
+Supported Configuration Options
+-------------------------------
+
+The following configuration options are currently supported:
+
+======== =================== ====== ===============================
+Property Supported Bootmeths Values Description
+======== =================== ====== ===============================
+fallback extlinux 0 | 1 Enable or disable fallback path
+======== =================== ====== ===============================
+
+
+Bootmeth set Example
+--------------------
+
+With the bootcount functionality enabled, when the bootlimit is reached, the
+`altbootcmd` environment variable lists the command used for booting rather
+than `bootcmd`. We can set the fallback configuration to cause the fallback
+boot option to be preferred, to revert to a previous known working boot option
+after a failed update for example. So if `bootcmd` is set to::
+
+ bootflow scan -lb
+
+We would set "altbootcmd" to::
+
+ bootmeth set extlinux fallback 1; bootflow scan -lb