Merge branch 'contrib/github_pr_18025' into 'master'

feat(app_update): esp_ota_set_boot_partition_without_validate() (GitHub PR)

Closes IDFGH-16972

See merge request espressif/esp-idf!45555
This commit is contained in:
Mahavir Jain
2026-02-03 10:51:17 +05:30
2 changed files with 41 additions and 10 deletions
+24 -10
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -672,16 +672,8 @@ static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
return rewrite_ota_seq(otadata, new_seq, next_otadata, otadata_partition);
}
esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)
static esp_err_t esp_ota_set_boot_partition_internal(const esp_partition_t* partition)
{
if (partition == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (image_validate(partition, ESP_IMAGE_VERIFY) != ESP_OK) {
return ESP_ERR_OTA_VALIDATE_FAILED;
}
// if set boot partition to factory bin ,just format ota info partition
if (partition->type == ESP_PARTITION_TYPE_APP) {
if (partition->subtype == ESP_PARTITION_SUBTYPE_APP_FACTORY) {
@@ -715,6 +707,28 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)
}
}
esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)
{
if (partition == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (image_validate(partition, ESP_IMAGE_VERIFY) != ESP_OK) {
return ESP_ERR_OTA_VALIDATE_FAILED;
}
return esp_ota_set_boot_partition_internal(partition);
}
esp_err_t esp_ota_set_boot_partition_skip_validate(const esp_partition_t *partition)
{
if (partition == NULL) {
return ESP_ERR_INVALID_ARG;
}
return esp_ota_set_boot_partition_internal(partition);
}
static const esp_partition_t *find_default_boot_partition(void)
{
// This logic matches the logic of bootloader get_selected_boot_partition() & load_boot_image().