File tree Expand file tree Collapse file tree 4 files changed +22
-5
lines changed Expand file tree Collapse file tree 4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,8 @@ struct boot_loader_state {
285
285
/* Image destination and size for the active slot */
286
286
uint32_t img_dst ;
287
287
uint32_t img_sz ;
288
- #elif defined(MCUBOOT_DIRECT_XIP_REVERT )
288
+ #endif
289
+ #if defined(MCUBOOT_DIRECT_XIP_REVERT ) || defined(MCUBOOT_RAM_LOAD_REVERT )
289
290
/* Swap status for the active slot */
290
291
struct boot_swap_state swap_state ;
291
292
#endif
Original file line number Diff line number Diff line change @@ -2605,7 +2605,8 @@ print_loaded_images(struct boot_loader_state *state)
2605
2605
}
2606
2606
#endif
2607
2607
2608
- #if defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )
2608
+ #if (defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )) || \
2609
+ (defined(MCUBOOT_RAM_LOAD ) && defined(MCUBOOT_RAM_LOAD_REVERT ))
2609
2610
/**
2610
2611
* Checks whether the active slot of the current image was previously selected
2611
2612
* to run. Erases the image if it was selected but its execution failed,
@@ -2724,17 +2725,17 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2724
2725
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2725
2726
continue ;
2726
2727
}
2728
+ #endif /* MCUBOOT_DIRECT_XIP */
2727
2729
2728
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2730
+ #if defined( MCUBOOT_DIRECT_XIP_REVERT ) || defined( MCUBOOT_RAM_LOAD_REVERT )
2729
2731
rc = boot_select_or_erase (state );
2730
2732
if (rc != 0 ) {
2731
2733
/* The selected image slot has been erased. */
2732
2734
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2733
2735
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2734
2736
continue ;
2735
2737
}
2736
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
2737
- #endif /* MCUBOOT_DIRECT_XIP */
2738
+ #endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
2738
2739
2739
2740
#ifdef MCUBOOT_RAM_LOAD
2740
2741
/* Image is first loaded to RAM and authenticated there in order to
Original file line number Diff line number Diff line change @@ -504,6 +504,17 @@ config BOOT_DIRECT_XIP_REVERT
504
504
attempt to boot the previous image. The images can also be made permanent
505
505
(marked as confirmed in advance) just like in swap mode.
506
506
507
+ config BOOT_RAM_LOAD_REVERT
508
+ bool "Enable the revert mechanism in ram-load mode"
509
+ depends on BOOT_RAM_LOAD
510
+ help
511
+ If y, enables the revert mechanism in ram-load similar to the one in
512
+ swap mode. It requires the trailer magic to be added to the signed image.
513
+ When a reboot happens without the image being confirmed at runtime, the
514
+ bootloader considers the image faulty and erases it. After this it will
515
+ attempt to boot the previous image. The images can also be made permanent
516
+ (marked as confirmed in advance) just like in swap mode.
517
+
507
518
config BOOT_BOOTSTRAP
508
519
bool "Bootstrap erased the primary slot from the secondary slot"
509
520
help
Original file line number Diff line number Diff line change 100
100
#define MCUBOOT_DIRECT_XIP_REVERT
101
101
#endif
102
102
103
+ #ifdef CONFIG_BOOT_RAM_LOAD_REVERT
104
+ #define MCUBOOT_RAM_LOAD_REVERT
105
+ #endif
106
+
103
107
#ifdef CONFIG_BOOT_RAM_LOAD
104
108
#define MCUBOOT_RAM_LOAD 1
105
109
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
You can’t perform that action at this time.
0 commit comments