mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
bootloader: Anti-rollback mode doesn't run test_app
- Cmake shows an error if the partition table has a test app. - BOOTLOADER_APP_TEST depends on !BOOTLOADER_APP_ANTI_ROLLBACK. - Bootloader does not boot the test app if secure version is low. Closes: https://www.esp32.com/viewtopic.php?f=13&t=19164&p=71302#p71302
This commit is contained in:
parent
68916df92c
commit
25ac1d4d28
@ -153,6 +153,7 @@ menu "Bootloader config"
|
|||||||
config BOOTLOADER_APP_TEST
|
config BOOTLOADER_APP_TEST
|
||||||
bool "GPIO triggers boot from test app partition"
|
bool "GPIO triggers boot from test app partition"
|
||||||
default N
|
default N
|
||||||
|
depends on !BOOTLOADER_APP_ANTI_ROLLBACK
|
||||||
help
|
help
|
||||||
Allows to run the test app from "TEST" partition.
|
Allows to run the test app from "TEST" partition.
|
||||||
A boot from "test" partition will occur if there is a GPIO input pulled low while device starts up.
|
A boot from "test" partition will occur if there is a GPIO input pulled low while device starts up.
|
||||||
|
@ -477,7 +477,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
|
|||||||
esp_image_metadata_t image_data;
|
esp_image_metadata_t image_data;
|
||||||
|
|
||||||
if (start_index == TEST_APP_INDEX) {
|
if (start_index == TEST_APP_INDEX) {
|
||||||
if (try_load_partition(&bs->test, &image_data)) {
|
if (check_anti_rollback(&bs->test) && try_load_partition(&bs->test, &image_data)) {
|
||||||
load_image(&image_data);
|
load_image(&image_data);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "No bootable test partition in the partition table");
|
ESP_LOGE(TAG, "No bootable test partition in the partition table");
|
||||||
@ -513,7 +513,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
|
|||||||
log_invalid_app_partition(index);
|
log_invalid_app_partition(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (try_load_partition(&bs->test, &image_data)) {
|
if (check_anti_rollback(&bs->test) && try_load_partition(&bs->test, &image_data)) {
|
||||||
ESP_LOGW(TAG, "Falling back to test app as only bootable partition");
|
ESP_LOGW(TAG, "Falling back to test app as only bootable partition");
|
||||||
load_image(&image_data);
|
load_image(&image_data);
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,11 @@ if(NOT BOOTLOADER_BUILD)
|
|||||||
# If anti-rollback option is set then factory partition should not be in Partition Table.
|
# If anti-rollback option is set then factory partition should not be in Partition Table.
|
||||||
# In this case, should be used the partition table with two ota app without the factory.
|
# In this case, should be used the partition table with two ota app without the factory.
|
||||||
partition_table_get_partition_info(factory_offset "--partition-type app --partition-subtype factory" "offset")
|
partition_table_get_partition_info(factory_offset "--partition-type app --partition-subtype factory" "offset")
|
||||||
if(CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK AND factory_offset)
|
partition_table_get_partition_info(test_offset "--partition-type app --partition-subtype test" "offset")
|
||||||
|
if(CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK AND (factory_offset OR test_offset))
|
||||||
fail_at_build_time(check_table_contents "\
|
fail_at_build_time(check_table_contents "\
|
||||||
ERROR: Anti-rollback option is enabled. Partition table should \
|
ERROR: Anti-rollback option is enabled. Partition table should \
|
||||||
consist of two ota app without factory partition.")
|
consist of two ota app without factory or test partitions.")
|
||||||
add_dependencies(app check_table_contents)
|
add_dependencies(app check_table_contents)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user