Skip to content

Commit d07da21

Browse files
tomchyrlubos
authored andcommitted
Revert "[nrf noup] bootloader: Add bootloader requests"
This reverts commit e1f2ab3. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent f5b35fc commit d07da21

File tree

9 files changed

+5
-613
lines changed

9 files changed

+5
-613
lines changed

boot/bootutil/include/bootutil/boot_request.h

Lines changed: 0 additions & 105 deletions
This file was deleted.

boot/bootutil/src/bootutil_public.c

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
#include "bootutil_priv.h"
5252
#include "bootutil_misc.h"
5353

54-
#if defined(CONFIG_NRF_MCUBOOT_BOOT_REQUEST) && !defined(CONFIG_MCUBOOT)
55-
#include <bootutil/boot_request.h>
56-
#define SEND_BOOT_REQUEST
57-
#endif /* CONFIG_NRF_MCUBOOT_BOOT_REQUEST && !CONFIG_MCUBOOT */
58-
5954
#ifdef CONFIG_MCUBOOT
6055
BOOT_LOG_MODULE_DECLARE(mcuboot);
6156
#else
@@ -508,79 +503,32 @@ boot_write_copy_done(const struct flash_area *fap)
508503
return boot_write_trailer_flag(fap, off, BOOT_FLAG_SET);
509504
}
510505

511-
#ifdef SEND_BOOT_REQUEST
512-
static int
513-
send_boot_request(uint8_t magic, bool confirm, int image_id, uint32_t slot_id)
514-
{
515-
int rc = BOOT_EBADIMAGE;
516-
517-
/* Handle write-protected active image. */
518-
if ((magic == BOOT_MAGIC_GOOD) || (magic == BOOT_MAGIC_UNSET)) {
519-
if (confirm) {
520-
BOOT_LOG_DBG("Confirm image: %d, %d", image_id, slot_id);
521-
rc = boot_request_confirm_slot(image_id, slot_id);
522-
} else {
523-
BOOT_LOG_DBG("Set image preference: %d, %d", image_id, slot_id);
524-
rc = boot_request_set_preferred_slot(image_id, slot_id);
525-
}
526-
if (rc != 0) {
527-
rc = BOOT_EBADIMAGE;
528-
}
529-
}
530-
531-
return rc;
532-
}
533-
#endif /* SEND_BOOT_REQUEST */
506+
#ifndef MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP
534507

535-
#if defined(SEND_BOOT_REQUEST) || (!defined(MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP))
536-
static int flash_area_to_image_slot(const struct flash_area *fa, uint32_t *slot)
508+
static int flash_area_to_image(const struct flash_area *fa)
537509
{
538-
int id = flash_area_get_id(fa);
539510
#if BOOT_IMAGE_NUMBER > 1
540511
uint8_t i = 0;
512+
int id = flash_area_get_id(fa);
541513

542514
while (i < BOOT_IMAGE_NUMBER) {
543-
if (FLASH_AREA_IMAGE_PRIMARY(i) == id) {
544-
if (slot != NULL) {
545-
*slot = 0;
546-
}
547-
return i;
548-
} else if (FLASH_AREA_IMAGE_SECONDARY(i) == id) {
549-
if (slot != NULL) {
550-
*slot = 1;
551-
}
515+
if (FLASH_AREA_IMAGE_PRIMARY(i) == id || (FLASH_AREA_IMAGE_SECONDARY(i) == id)) {
552516
return i;
553517
}
554518

555519
++i;
556520
}
557521
#else
558522
(void)fa;
559-
if (slot != NULL) {
560-
if (FLASH_AREA_IMAGE_PRIMARY(0) == id) {
561-
*slot = 0;
562-
} else if (FLASH_AREA_IMAGE_SECONDARY(0) == id) {
563-
*slot = 1;
564-
} else {
565-
*slot = UINT32_MAX;
566-
}
567-
}
568523
#endif
569524
return 0;
570525
}
571-
#endif /* defined(SEND_BOOT_REQUEST) || (!defined(MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP)) */
572526

573-
#ifndef MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP
574527
int
575528
boot_set_next(const struct flash_area *fa, bool active, bool confirm)
576529
{
577530
struct boot_swap_state slot_state;
578531
int rc;
579-
int image_id;
580-
uint32_t slot_id;
581-
582-
BOOT_LOG_DBG("boot_set_next: fa %p active == %d, confirm == %d",
583-
fa, (int)active, (int)confirm);
584532

585533
if (active) {
586534
confirm = true;
@@ -591,15 +539,6 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
591539
return rc;
592540
}
593541

594-
image_id = flash_area_to_image_slot(fa, &slot_id);
595-
596-
#ifdef SEND_BOOT_REQUEST
597-
rc = send_boot_request(slot_state.magic, confirm, image_id, slot_id);
598-
if ((rc != 0) || active) {
599-
return rc;
600-
}
601-
#endif
602-
603542
switch (slot_state.magic) {
604543
case BOOT_MAGIC_GOOD:
605544
/* If non-active then swap already scheduled, else confirm needed.*/
@@ -630,7 +569,7 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
630569
} else {
631570
swap_type = BOOT_SWAP_TYPE_TEST;
632571
}
633-
rc = boot_write_swap_info(fa, swap_type, image_id);
572+
rc = boot_write_swap_info(fa, swap_type, flash_area_to_image(fa));
634573
}
635574
}
636575
break;
@@ -661,10 +600,6 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
661600
{
662601
struct boot_swap_state slot_state;
663602
int rc;
664-
#ifdef SEND_BOOT_REQUEST
665-
int image_id;
666-
uint32_t slot_id;
667-
#endif
668603

669604
BOOT_LOG_DBG("boot_set_next: fa %p active == %d, confirm == %d",
670605
fa, (int)active, (int)confirm);
@@ -683,15 +618,6 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
683618
return rc;
684619
}
685620

686-
#ifdef SEND_BOOT_REQUEST
687-
image_id = flash_area_to_image_slot(fa, &slot_id);
688-
689-
rc = send_boot_request(slot_state.magic, confirm, image_id, slot_id);
690-
if ((rc != 0) || active) {
691-
return rc;
692-
}
693-
#endif
694-
695621
switch (slot_state.magic) {
696622
case BOOT_MAGIC_UNSET:
697623
/* Magic is needed for MCUboot to even consider booting an image */

boot/bootutil/zephyr/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ zephyr_library_named(mcuboot_util)
1616
zephyr_library_sources(
1717
../src/bootutil_public.c
1818
)
19-
if(CONFIG_NRF_MCUBOOT_BOOT_REQUEST)
20-
zephyr_library_sources_ifdef(CONFIG_NRF_MCUBOOT_BOOT_REQUEST_IMPL_RETENTION
21-
src/boot_request_retention.c
22-
)
23-
endif()
2419

2520
# Sensitivity to the TEST_BOOT_IMAGE_ACCESS_HOOKS define is implemented for
2621
# allowing the test-build with the hooks feature enabled.

0 commit comments

Comments
 (0)