Skip to content

Commit 1a7962e

Browse files
authored
Add option to skip image verification after OTA (espressif#6779)
Fixes: espressif#5871
1 parent 2b67a4e commit 1a7962e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Diff for: cores/esp32/esp32-hal-misc.c

+16-9
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ void initVariant() {}
200200
void init() __attribute__((weak));
201201
void init() {}
202202

203+
#ifdef CONFIG_APP_ROLLBACK_ENABLE
203204
bool verifyOta() __attribute__((weak));
204205
bool verifyOta() { return true; }
205206

207+
bool verifyRollbackLater() __attribute__((weak));
208+
bool verifyRollbackLater() { return false; }
209+
#endif
210+
206211
#ifdef CONFIG_BT_ENABLED
207212
//overwritten in esp32-hal-bt.c
208213
bool btInUse() __attribute__((weak));
@@ -212,15 +217,17 @@ bool btInUse(){ return false; }
212217
void initArduino()
213218
{
214219
#ifdef CONFIG_APP_ROLLBACK_ENABLE
215-
const esp_partition_t *running = esp_ota_get_running_partition();
216-
esp_ota_img_states_t ota_state;
217-
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
218-
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
219-
if (verifyOta()) {
220-
esp_ota_mark_app_valid_cancel_rollback();
221-
} else {
222-
log_e("OTA verification failed! Start rollback to the previous version ...");
223-
esp_ota_mark_app_invalid_rollback_and_reboot();
220+
if(!verifyRollbackLater()){
221+
const esp_partition_t *running = esp_ota_get_running_partition();
222+
esp_ota_img_states_t ota_state;
223+
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
224+
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
225+
if (verifyOta()) {
226+
esp_ota_mark_app_valid_cancel_rollback();
227+
} else {
228+
log_e("OTA verification failed! Start rollback to the previous version ...");
229+
esp_ota_mark_app_invalid_rollback_and_reboot();
230+
}
224231
}
225232
}
226233
}

0 commit comments

Comments
 (0)