Fix logic in emergency update

fix-lastresort-update
Daniele Lacamera 2020-07-06 14:04:15 +02:00
parent 533fa9b4a2
commit 5915d40904
1 changed files with 11 additions and 1 deletions

View File

@ -266,8 +266,18 @@ void RAMFUNCTION wolfBoot_start(void)
(wolfBoot_verify_integrity(&boot) < 0) || (wolfBoot_verify_integrity(&boot) < 0) ||
(wolfBoot_verify_authenticity(&boot) < 0)) { (wolfBoot_verify_authenticity(&boot) < 0)) {
if (wolfBoot_update(1) < 0) { if (wolfBoot_update(1) < 0) {
/* panic: no boot option available. */
while(1) while(1)
/* panic */; ;
} else {
/* Emergency update successful, try to re-open boot image */
if ((wolfBoot_open_image(&boot, PART_BOOT) < 0) ||
(wolfBoot_verify_integrity(&boot) < 0) ||
(wolfBoot_verify_authenticity(&boot) < 0)) {
/* panic: something went wrong after the emergency update */
while(1)
;
}
} }
} }
hal_prepare_boot(); hal_prepare_boot();