From 3809fd35a5dbdbd62043ba0a72c3f37f58e69f9d Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Wed, 9 Oct 2024 14:15:40 +0100 Subject: 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 Signed-off-by: Martyn Welch --- include/bootmeth.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'include') diff --git a/include/bootmeth.h b/include/bootmeth.h index 4d8ca48efd4..a08ebf005ad 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -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 * -- cgit v1.3.1