summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwan <m.schwan@phytec.de>2025-07-14 15:30:10 +0200
committerTom Rini <trini@konsulko.com>2025-07-22 13:53:17 -0600
commitf271b0627001b444e00b8379a069ce8d8860490e (patch)
treeb528d93168ee740669828635fb9f8d760c175b81
parent84cef694e73cc820fbc7131b1a25b79e17bec609 (diff)
bootstd: rauc: Only scan all partitions instead of boot files
Only scan for the existence of all required partitions of a RAUC system, instead of searching for boot script files in all of them. Previously, it might have occurred, that a slot did not contain required files and RAUC already marked the corresponding slot as bad (not suitable for booting). In that case, scanning for a non-existence boot script would result in an error (and thus not booting anything), which was different behavior compared to the legacy RAUC boot. Signed-off-by: Martin Schwan <m.schwan@phytec.de>
-rw-r--r--boot/bootmeth_rauc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/boot/bootmeth_rauc.c b/boot/bootmeth_rauc.c
index 72075c04de1..cc6180221ed 100644
--- a/boot/bootmeth_rauc.c
+++ b/boot/bootmeth_rauc.c
@@ -79,18 +79,17 @@ static int distro_rauc_check(struct udevice *dev, struct bootflow_iter *iter)
return 0;
}
-static int distro_rauc_scan_boot_part(struct bootflow *bflow)
+static int distro_rauc_scan_parts(struct bootflow *bflow)
{
struct blk_desc *desc;
struct distro_rauc_priv *priv;
char *boot_order;
const char **boot_order_list;
- bool exists;
int ret;
int i;
- int j;
- desc = dev_get_uclass_plat(bflow->blk);
+ if (bflow->blk)
+ desc = dev_get_uclass_plat(bflow->blk);
priv = bflow->bootmeth_priv;
if (!priv || !priv->slots)
@@ -99,20 +98,21 @@ static int distro_rauc_scan_boot_part(struct bootflow *bflow)
boot_order = env_get("BOOT_ORDER");
boot_order_list = str_to_list(boot_order);
for (i = 0; boot_order_list[i]; i++) {
- exists = false;
- for (j = 0; script_names[j]; j++) {
- const struct distro_rauc_slot *slot;
+ const struct distro_rauc_slot *slot;
- slot = get_slot(priv, boot_order_list[i]);
- if (!slot)
- return log_msg_ret("env", -ENOENT);
+ slot = get_slot(priv, boot_order_list[i]);
+ if (!slot)
+ return log_msg_ret("slot", -EINVAL);
+ if (desc) {
ret = fs_set_blk_dev_with_part(desc, slot->boot_part);
if (ret)
- return log_msg_ret("blk", ret);
- exists |= fs_exists(script_names[j]);
+ return log_msg_ret("part", ret);
+ fs_close();
+ ret = fs_set_blk_dev_with_part(desc, slot->root_part);
+ if (ret)
+ return log_msg_ret("part", ret);
+ fs_close();
}
- if (!exists)
- return log_msg_ret("fs", -ENOENT);
}
str_free_list(boot_order_list);
@@ -185,7 +185,7 @@ static int distro_rauc_read_bootflow(struct udevice *dev, struct bootflow *bflow
bflow->bootmeth_priv = priv;
- ret = distro_rauc_scan_boot_part(bflow);
+ ret = distro_rauc_scan_parts(bflow);
if (ret < 0) {
for (i = 0; priv->slots[i]->name; i++) {
free(priv->slots[i]->name);