]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
bootstd: rauc: Only scan all partitions instead of boot files
authorMartin Schwan <m.schwan@phytec.de>
Mon, 14 Jul 2025 13:30:10 +0000 (15:30 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 22 Jul 2025 19:53:17 +0000 (13:53 -0600)
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>
boot/bootmeth_rauc.c

index 72075c04de1c609da21b0277acae413d97875fd0..cc6180221ed90934801ebd801a7bd1b3fc889aec 100644 (file)
@@ -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);