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>
This commit is contained in:
Martyn Welch
2024-10-09 14:15:40 +01:00
committed by Tom Rini
parent 8ba82a91b3
commit 3809fd35a5
6 changed files with 196 additions and 6 deletions

View File

@@ -146,6 +146,22 @@ struct bootmeth_ops {
* something changes, other -ve on other error
*/
int (*boot)(struct udevice *dev, struct bootflow *bflow);
/**
* set_property() - set the bootmeth property
*
* This allows the setting of boot method specific properties to enable
* automated finer grain control of the boot process
*
* @name: String containing the name of the relevant boot method
* @property: String containing the name of the property to set
* @value: String containing the value to be set for the specified
* property
* Return: 0 if OK, -ENODEV if an unknown bootmeth or property is
* provided, -ENOENT if there are no bootmeth devices
*/
int (*set_property)(struct udevice *dev, const char *property,
const char *value);
};
#define bootmeth_get_ops(dev) ((struct bootmeth_ops *)(dev)->driver->ops)
@@ -290,6 +306,21 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global);
*/
int bootmeth_set_order(const char *order_str);
/**
* bootmeth_set_property() - Set the bootmeth property
*
* This allows the setting of boot method specific properties to enable
* automated finer grain control of the boot process
*
* @name: String containing the name of the relevant boot method
* @property: String containing the name of the property to set
* @value: String containing the value to be set for the specified property
* Return: 0 if OK, -ENODEV if an unknown bootmeth or property is provided,
* -ENOENT if there are no bootmeth devices
*/
int bootmeth_set_property(const char *name, const char *property,
const char *value);
/**
* bootmeth_setup_fs() - Set up read to read a file
*