From 6a6638f0939dca65c7d1cd0d766957d3d3adc519 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:47:15 -0700 Subject: bootstd: Remove special-case code for boot_targets Rather than implement this as its own case in build_order(), process the boot_targets environment variable in the bootstd_get_bootdev_order() function. This allows build_order() to be simplified. Signed-off-by: Simon Glass --- boot/bootstd-uclass.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'boot/bootstd-uclass.c') diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c index 7887acdc11..81555d341e 100644 --- a/boot/bootstd-uclass.c +++ b/boot/bootstd-uclass.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -72,9 +73,23 @@ static int bootstd_remove(struct udevice *dev) return 0; } -const char *const *const bootstd_get_bootdev_order(struct udevice *dev) +const char *const *const bootstd_get_bootdev_order(struct udevice *dev, + bool *okp) { struct bootstd_priv *std = dev_get_priv(dev); + const char *targets = env_get("boot_targets"); + + *okp = true; + log_debug("- targets %s %p\n", targets, std->bootdev_order); + if (targets && *targets) { + str_free_list(std->env_order); + std->env_order = str_to_list(targets); + if (!std->env_order) { + *okp = false; + return NULL; + } + return std->env_order; + } return std->bootdev_order; } -- cgit v1.2.3