mirror of
https://xff.cz/git/u-boot/
synced 2025-11-01 19:05:51 +01:00
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:
@@ -251,6 +251,31 @@ int bootmeth_set_order(const char *order_str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bootmeth_set_property(const char *name, const char *property, const char *value)
|
||||
{
|
||||
int ret;
|
||||
int len;
|
||||
struct udevice *dev;
|
||||
const struct bootmeth_ops *ops;
|
||||
|
||||
len = strlen(name);
|
||||
|
||||
ret = uclass_find_device_by_namelen(UCLASS_BOOTMETH, name, len,
|
||||
&dev);
|
||||
if (ret) {
|
||||
printf("Unknown bootmeth '%s'\n", name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ops = bootmeth_get_ops(dev);
|
||||
if (!ops->set_property) {
|
||||
printf("set_property not found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return ops->set_property(dev, property, value);
|
||||
}
|
||||
|
||||
int bootmeth_setup_fs(struct bootflow *bflow, struct blk_desc *desc)
|
||||
{
|
||||
int ret;
|
||||
|
||||
Reference in New Issue
Block a user