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 @@ -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 @@ -2897,7 +2897,8 @@ print_loaded_images(struct boot_loader_state *state)
2897
2897
}
2898
2898
#endif
2899
2899
2900
- #if defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )
2900
+ #if (defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )) || \
2901
+ (defined(MCUBOOT_RAM_LOAD ) && defined(MCUBOOT_RAM_LOAD_REVERT ))
2901
2902
/**
2902
2903
* Checks whether the active slot of the current image was previously selected
2903
2904
* to run. Erases the image if it was selected but its execution failed,
@@ -3017,17 +3018,17 @@ boot_load_and_validate_images(struct boot_loader_state *state)
3017
3018
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
3018
3019
continue ;
3019
3020
}
3021
+ #endif /* MCUBOOT_DIRECT_XIP */
3020
3022
3021
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
3023
+ #if defined( MCUBOOT_DIRECT_XIP_REVERT ) || defined( MCUBOOT_RAM_LOAD_REVERT )
3022
3024
rc = boot_select_or_erase (state );
3023
3025
if (rc != 0 ) {
3024
3026
/* The selected image slot has been erased. */
3025
3027
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
3026
3028
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
3027
3029
continue ;
3028
3030
}
3029
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
3030
- #endif /* MCUBOOT_DIRECT_XIP */
3031
+ #endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
3031
3032
3032
3033
#ifdef MCUBOOT_RAM_LOAD
3033
3034
/* 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