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 <sjg@chromium.org>
diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c
index 7887acd..81555d3 100644
--- a/boot/bootstd-uclass.c
+++ b/boot/bootstd-uclass.c
@@ -10,6 +10,7 @@
#include <bootflow.h>
#include <bootstd.h>
#include <dm.h>
+#include <env.h>
#include <log.h>
#include <malloc.h>
#include <dm/device-internal.h>
@@ -72,9 +73,23 @@
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;
}