File tree 4 files changed +22
-5
lines changed
4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,8 @@ struct boot_loader_state {
275
275
/* Image destination and size for the active slot */
276
276
uint32_t img_dst ;
277
277
uint32_t img_sz ;
278
- #elif defined(MCUBOOT_DIRECT_XIP_REVERT )
278
+ #endif
279
+ #if defined(MCUBOOT_DIRECT_XIP_REVERT ) || defined(MCUBOOT_RAM_LOAD_REVERT )
279
280
/* Swap status for the active slot */
280
281
struct boot_swap_state swap_state ;
281
282
#endif
Original file line number Diff line number Diff line change @@ -2721,7 +2721,8 @@ print_loaded_images(struct boot_loader_state *state)
2721
2721
}
2722
2722
#endif
2723
2723
2724
- #if defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )
2724
+ #if (defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )) || \
2725
+ (defined(MCUBOOT_RAM_LOAD ) && defined(MCUBOOT_RAM_LOAD_REVERT ))
2725
2726
/**
2726
2727
* Checks whether the active slot of the current image was previously selected
2727
2728
* to run. Erases the image if it was selected but its execution failed,
@@ -2841,17 +2842,17 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2841
2842
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2842
2843
continue ;
2843
2844
}
2845
+ #endif /* MCUBOOT_DIRECT_XIP */
2844
2846
2845
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2847
+ #if defined( MCUBOOT_DIRECT_XIP_REVERT ) || defined( MCUBOOT_RAM_LOAD_REVERT )
2846
2848
rc = boot_select_or_erase (state );
2847
2849
if (rc != 0 ) {
2848
2850
/* The selected image slot has been erased. */
2849
2851
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2850
2852
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2851
2853
continue ;
2852
2854
}
2853
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
2854
- #endif /* MCUBOOT_DIRECT_XIP */
2855
+ #endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
2855
2856
2856
2857
#ifdef MCUBOOT_RAM_LOAD
2857
2858
/* Image is first loaded to RAM and authenticated there in order to
Original file line number Diff line number Diff line change @@ -503,6 +503,17 @@ config BOOT_DIRECT_XIP_REVERT
503
503
attempt to boot the previous image. The images can also be made permanent
504
504
(marked as confirmed in advance) just like in swap mode.
505
505
506
+ config BOOT_RAM_LOAD_REVERT
507
+ bool "Enable the revert mechanism in ram-load mode"
508
+ depends on BOOT_RAM_LOAD
509
+ help
510
+ If y, enables the revert mechanism in ram-load similar to the one in
511
+ swap mode. It requires the trailer magic to be added to the signed image.
512
+ When a reboot happens without the image being confirmed at runtime, the
513
+ bootloader considers the image faulty and erases it. After this it will
514
+ attempt to boot the previous image. The images can also be made permanent
515
+ (marked as confirmed in advance) just like in swap mode.
516
+
506
517
config BOOT_BOOTSTRAP
507
518
bool "Bootstrap erased the primary slot from the secondary slot"
508
519
default n
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