1# Copyright (c) 2023, Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig RETENTION_BOOTLOADER_INFO
5	bool "Bootloader info"
6	help
7	  Adds a bootloader information sharing system which allows for
8	  retreiving data from the bootloader when data sharing is enabled.
9
10if RETENTION_BOOTLOADER_INFO
11
12# Workaround for not being able to have commas in macro arguments
13DT_CHOSEN_BOOTLOADER_INFO := zephyr,bootloader-info
14
15config RETENTION_BOOTLOADER_INFO_TYPE_MCUBOOT
16	bool "MCUboot"
17	depends on !MCUBOOT && BOOTLOADER_MCUBOOT
18	depends on $(dt_chosen_enabled,$(DT_CHOSEN_BOOTLOADER_INFO))
19	select MCUBOOT_BOOTUTIL_LIB
20	help
21	  Adds a bootloader information sharing system for MCUboot and
22	  applications which allows applications to read the configuration of
23	  MCUboot and the running image. This can be used by applications so
24	  that they know how to e.g. handle firmware updates and place them
25	  into the correct slot.
26
27	  In order to use this, a retention area must be created and set as
28	  the "zephyr,bootloader-info" chosen node via device tree, MCUboot
29	  must be built with the same "zephyr,bootloader-info" DTS node and
30	  have CONFIG_BOOT_SHARE_DATA, CONFIG_BOOT_SHARE_DATA_BOOTINFO and
31	  CONFIG_BOOT_SHARE_BACKEND_RETENTION enabled, or the shared
32	  information will not be accessible.
33
34config RETENTION_BOOTLOADER_INFO_INIT_PRIORITY
35	int "Bootloader info init priority"
36	default 87
37	help
38	  Bootloader info initialization priority (must be higher than init
39	  priorities for for retention subsystem).
40
41config RETENTION_BOOTLOADER_INFO_OUTPUT_FUNCTION
42	bool "Function"
43	default y
44	help
45	  Allows bootloader settings to be fetched by calling a function which
46	  will update a buffer with the requested data.
47
48config RETENTION_BOOTLOADER_INFO_OUTPUT_SETTINGS
49	bool "Settings"
50	depends on SETTINGS
51	help
52	  Allows bootloader settings to be fetched using settings with the
53	  "blinfo" prefix.
54
55endif
56