nihalpasham / rustBoot

rustBoot is a standalone bootloader written entirely in `Rust`, designed to run on anything from a microcontroller to a system on chip. It can be used to boot into bare-metal firmware or Linux.
MIT License
214 stars 21 forks source link

Ignore broken update partition content when in UpdateInUpdatingState (closes #80) #82

Open lionelains opened 2 days ago

lionelains commented 2 days ago

panic() occurs when the update partition contains invalid (or damaged) content. This prevents the whole boot process to complete, even when the previous (boot) partition, containing a previous firmware, would be able to start properly. I changed the panic() to errors that can be parsed by calling functions, thus taking appropriate actions. More specifically, when the update partition is in UpdateInUpdatingState(), if the rustboot update cannot be performed successfully, we continue booting the firmware in the boot partition instead of panicking.

[!Note]
We should also mark the update partition so that subsequent boot attempts do not go again through the whole partition verification. Indeed, the first attempt failed, thus subsequent attempts should fail as well. This would required to change the state of the upgrade partition but the state machine currently does not allow to do so.