Partitions can be become unusable due to power cuts or failed updates.
Use the bootmeth RAUC if partitions for at least one slot exist. The
bootmeth can then select the working slot.

Signed-off-by: Leonard Anderweit <[email protected]>
Tested-by: Martin Schwan <[email protected]>
---
 boot/bootmeth_rauc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/boot/bootmeth_rauc.c b/boot/bootmeth_rauc.c
index 1096daedb5a8..833715e13952 100644
--- a/boot/bootmeth_rauc.c
+++ b/boot/bootmeth_rauc.c
@@ -99,6 +99,7 @@ static int distro_rauc_scan_parts(struct bootflow *bflow)
        struct distro_rauc_priv *priv;
        char *boot_order;
        const char **boot_order_list;
+       bool slot_found = false;
        int ret;
        int i;
 
@@ -120,16 +121,20 @@ static int distro_rauc_scan_parts(struct bootflow *bflow)
                if (desc) {
                        ret = fs_set_blk_dev_with_part(desc, slot->boot_part);
                        if (ret)
-                               return log_msg_ret("part", ret);
+                               continue;
                        fs_close();
                        ret = part_get_info(desc, slot->root_part, NULL);
                        if (ret)
-                               return log_msg_ret("part", ret);
+                               continue;
+                       slot_found = true;
                }
        }
        str_free_list(boot_order_list);
 
-       return 0;
+       if (slot_found)
+               return 0;
+
+       return -1;
 }
 
 static int distro_rauc_read_bootflow(struct udevice *dev, struct bootflow 
*bflow)
-- 
2.43.0

Reply via email to