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 @@ -2898,7 +2898,8 @@ print_loaded_images(struct boot_loader_state *state)
2898
2898
}
2899
2899
#endif
2900
2900
2901
- #if defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )
2901
+ #if (defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )) || \
2902
+ (defined(MCUBOOT_RAM_LOAD ) && defined(MCUBOOT_RAM_LOAD_REVERT ))
2902
2903
/**
2903
2904
* Checks whether the active slot of the current image was previously selected
2904
2905
* to run. Erases the image if it was selected but its execution failed,
@@ -3018,17 +3019,17 @@ boot_load_and_validate_images(struct boot_loader_state *state)
3018
3019
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
3019
3020
continue ;
3020
3021
}
3022
+ #endif /* MCUBOOT_DIRECT_XIP */
3021
3023
3022
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
3024
+ #if defined( MCUBOOT_DIRECT_XIP_REVERT ) || defined( MCUBOOT_RAM_LOAD_REVERT )
3023
3025
rc = boot_select_or_erase (state );
3024
3026
if (rc != 0 ) {
3025
3027
/* The selected image slot has been erased. */
3026
3028
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
3027
3029
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
3028
3030
continue ;
3029
3031
}
3030
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
3031
- #endif /* MCUBOOT_DIRECT_XIP */
3032
+ #endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
3032
3033
3033
3034
#ifdef MCUBOOT_RAM_LOAD
3034
3035
/* Image is first loaded to RAM and authenticated there in order to
Original file line number Diff line number Diff line change @@ -500,6 +500,17 @@ config BOOT_DIRECT_XIP_REVERT
500
500
attempt to boot the previous image. The images can also be made permanent
501
501
(marked as confirmed in advance) just like in swap mode.
502
502
503
+ config BOOT_RAM_LOAD_REVERT
504
+ bool "Enable the revert mechanism in ram-load mode"
505
+ depends on BOOT_RAM_LOAD
506
+ help
507
+ If y, enables the revert mechanism in ram-load similar to the one in
508
+ swap mode. It requires the trailer magic to be added to the signed image.
509
+ When a reboot happens without the image being confirmed at runtime, the
510
+ bootloader considers the image faulty and erases it. After this it will
511
+ attempt to boot the previous image. The images can also be made permanent
512
+ (marked as confirmed in advance) just like in swap mode.
513
+
503
514
config BOOT_BOOTSTRAP
504
515
bool "Bootstrap erased the primary slot from the secondary slot"
505
516
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