Skip to content

Commit f5b35fc

Browse files
tomchyrlubos
authored andcommitted
Revert "[nrf noup] boot: Improve bootloader request handling"
This reverts commit 4292905. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 744c2b1 commit f5b35fc

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

boot/bootutil/src/bootutil_public.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,25 +510,18 @@ boot_write_copy_done(const struct flash_area *fap)
510510

511511
#ifdef SEND_BOOT_REQUEST
512512
static int
513-
send_boot_request(uint8_t magic, uint8_t image_ok, bool confirm, int image_id,
514-
uint32_t slot_id)
513+
send_boot_request(uint8_t magic, bool confirm, int image_id, uint32_t slot_id)
515514
{
516515
int rc = BOOT_EBADIMAGE;
517516

518517
/* Handle write-protected active image. */
519518
if ((magic == BOOT_MAGIC_GOOD) || (magic == BOOT_MAGIC_UNSET)) {
520519
if (confirm) {
521520
BOOT_LOG_DBG("Confirm image: %d, %d", image_id, slot_id);
522-
if ((image_ok != BOOT_FLAG_SET) || (magic != BOOT_MAGIC_GOOD)) {
523-
rc = boot_request_confirm_slot(image_id, slot_id);
524-
} else {
525-
rc = 0;
526-
}
527-
#ifdef CONFIG_NCS_MCUBOOT_BOOT_REQUEST_TEST_SETS_BOOT_PREFERENCE
521+
rc = boot_request_confirm_slot(image_id, slot_id);
528522
} else {
529523
BOOT_LOG_DBG("Set image preference: %d, %d", image_id, slot_id);
530524
rc = boot_request_set_preferred_slot(image_id, slot_id);
531-
#endif /* CONFIG_NCS_MCUBOOT_BOOT_REQUEST_TEST_SETS_BOOT_PREFERENCE */
532525
}
533526
if (rc != 0) {
534527
rc = BOOT_EBADIMAGE;
@@ -601,8 +594,7 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
601594
image_id = flash_area_to_image_slot(fa, &slot_id);
602595

603596
#ifdef SEND_BOOT_REQUEST
604-
rc = send_boot_request(slot_state.magic, slot_state.image_ok, confirm,
605-
image_id, slot_id);
597+
rc = send_boot_request(slot_state.magic, confirm, image_id, slot_id);
606598
if ((rc != 0) || active) {
607599
return rc;
608600
}
@@ -694,8 +686,7 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
694686
#ifdef SEND_BOOT_REQUEST
695687
image_id = flash_area_to_image_slot(fa, &slot_id);
696688

697-
rc = send_boot_request(slot_state.magic, slot_state.image_ok, confirm,
698-
image_id, slot_id);
689+
rc = send_boot_request(slot_state.magic, confirm, image_id, slot_id);
699690
if ((rc != 0) || active) {
700691
return rc;
701692
}

boot/zephyr/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,15 +1309,4 @@ config NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS
13091309
Time between image validation attempts, in milliseconds.
13101310
Allows for recovery from transient bit flips or similar situations.
13111311

1312-
config NCS_MCUBOOT_BOOT_REQUEST_TEST_SETS_BOOT_PREFERENCE
1313-
bool "Set boot preference if a slot is marked for test"
1314-
help
1315-
This option allows to verify boot preference requests through issuing
1316-
the image test.
1317-
Using this option is not recommended in production systems, because
1318-
it will boot any newly transferred image, even if it has a lower
1319-
version than the current one.
1320-
The rollback protection (using security counters) will still be
1321-
effective.
1322-
13231312
source "Kconfig.zephyr"

0 commit comments

Comments
 (0)