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 @@ -259,7 +259,8 @@ struct boot_loader_state {
259
259
/* Image destination and size for the active slot */
260
260
uint32_t img_dst ;
261
261
uint32_t img_sz ;
262
- #elif defined(MCUBOOT_DIRECT_XIP_REVERT )
262
+ #endif
263
+ #if defined(MCUBOOT_DIRECT_XIP_REVERT ) || defined(MCUBOOT_RAM_LOAD_REVERT )
263
264
/* Swap status for the active slot */
264
265
struct boot_swap_state swap_state ;
265
266
#endif
Original file line number Diff line number Diff line change @@ -2634,7 +2634,8 @@ print_loaded_images(struct boot_loader_state *state)
2634
2634
}
2635
2635
#endif
2636
2636
2637
- #if defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )
2637
+ #if (defined(MCUBOOT_DIRECT_XIP ) && defined(MCUBOOT_DIRECT_XIP_REVERT )) || \
2638
+ (defined(MCUBOOT_RAM_LOAD ) && defined(MCUBOOT_RAM_LOAD_REVERT ))
2638
2639
/**
2639
2640
* Checks whether the active slot of the current image was previously selected
2640
2641
* to run. Erases the image if it was selected but its execution failed,
@@ -2758,17 +2759,17 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2758
2759
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2759
2760
continue ;
2760
2761
}
2762
+ #endif /* MCUBOOT_DIRECT_XIP */
2761
2763
2762
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2764
+ #if defined( MCUBOOT_DIRECT_XIP_REVERT ) || defined( MCUBOOT_RAM_LOAD_REVERT )
2763
2765
rc = boot_select_or_erase (state );
2764
2766
if (rc != 0 ) {
2765
2767
/* The selected image slot has been erased. */
2766
2768
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2767
2769
state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2768
2770
continue ;
2769
2771
}
2770
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
2771
- #endif /* MCUBOOT_DIRECT_XIP */
2772
+ #endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
2772
2773
2773
2774
#ifdef MCUBOOT_RAM_LOAD
2774
2775
/* Image is first loaded to RAM and authenticated there in order to
Original file line number Diff line number Diff line change @@ -344,6 +344,17 @@ config BOOT_DIRECT_XIP_REVERT
344
344
attempt to boot the previous image. The images can also be made permanent
345
345
(marked as confirmed in advance) just like in swap mode.
346
346
347
+ config BOOT_RAM_LOAD_REVERT
348
+ bool "Enable the revert mechanism in ramload mode"
349
+ depends on BOOT_RAM_LOAD
350
+ help
351
+ If y, enables the revert mechanism in ramload similar to the one in
352
+ swap mode. It requires the trailer magic to be added to the signed image.
353
+ When a reboot happens without the image being confirmed at runtime, the
354
+ bootloader considers the image faulty and erases it. After this it will
355
+ attempt to boot the previous image. The images can also be made permanent
356
+ (marked as confirmed in advance) just like in swap mode.
357
+
347
358
config BOOT_BOOTSTRAP
348
359
bool "Bootstrap erased the primary slot from the secondary slot"
349
360
default n
Original file line number Diff line number Diff line change 92
92
#define MCUBOOT_DIRECT_XIP_REVERT
93
93
#endif
94
94
95
+ #ifdef CONFIG_BOOT_RAM_LOAD_REVERT
96
+ #define MCUBOOT_RAM_LOAD_REVERT
97
+ #endif
98
+
95
99
#ifdef CONFIG_BOOT_RAM_LOAD
96
100
#define MCUBOOT_RAM_LOAD 1
97
101
#define IMAGE_EXECUTABLE_RAM_START CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
You can’t perform that action at this time.
0 commit comments