1# Copyright (c) 2020 Linumiz
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig HAWKBIT
5	bool "Eclipse hawkBit Firmware Over-the-Air support"
6	depends on SETTINGS
7	depends on FLASH
8	depends on REBOOT
9	depends on NET_TCP
10	depends on NET_SOCKETS
11	depends on IMG_MANAGER
12	depends on NETWORKING
13	depends on HTTP_CLIENT
14	depends on JSON_LIBRARY
15	depends on BOOTLOADER_MCUBOOT
16	depends on SMF
17	depends on SMF_ANCESTOR_SUPPORT
18	select MPU_ALLOW_FLASH_WRITE
19	select IMG_ENABLE_IMAGE_CHECK
20	select IMG_ERASE_PROGRESSIVELY
21	help
22	  hawkBit is a domain independent back-end framework for polling out
23	  software updates to constrained edge devices as well as more powerful
24	  controllers and gateways connected to IP based networking infrastructure.
25
26if HAWKBIT
27config HAWKBIT_POLL_INTERVAL
28	int "Time to poll interval (in minutes)"
29	default 5
30	range 1 43200
31	help
32	  Set the interval that the hawkbit update server will be polled.
33	  This time interval is zero and 43200 minutes(30 days). This will be overridden
34	  by the value configured in the settings of the hawkBit server.
35
36config HAWKBIT_AUTOHANDLER
37	bool "hawkBit autohandler"
38	select EVENTS
39	default y
40	help
41	  Activate autohandler to handle the update process automatically.
42
43config HAWKBIT_SHELL
44	bool "hawkBit shell utilities"
45	depends on SHELL
46	depends on HAWKBIT_AUTOHANDLER
47	help
48	  Activate shell module that provides hawkBit commands.
49
50config HAWKBIT_SHELL_AUTOHANDLER_TIMEOUT
51	int "hawkBit shell autohandler timeout"
52	default 200
53	depends on HAWKBIT_SHELL
54	help
55	  Set the timeout in milliseconds for the hawkBit shell autohandler. During
56	  the timeout, the hawkBit shell autohandler blocks the shell and waits for
57	  the hawkBit autohandler to finish. During this time, log messages for the
58	  shell logger are not printed, so this timeout should be set to a value that
59	  is not too long, to not drop the logs.
60
61config HAWKBIT_TENANT
62	string "Tenant name for the hawkbit server"
63	default "default"
64	help
65	  Configure the tenant name for the hawkbit server.
66
67config HAWKBIT_SERVER
68	string "User address for the hawkbit server"
69	help
70	  Configure the hawkbit server address. If the address is not an IP address,
71	  CONFIG_DNS_RESOLVER must be enabled to resolve the hostname.
72
73config HAWKBIT_PORT
74	int "Port number for the hawkbit server"
75	default 8080
76	help
77	  Configure the hawkbit port number.
78
79config HAWKBIT_SET_SETTINGS_RUNTIME
80	bool "Set hawkbit settings at runtime"
81	help
82	  Enable to set hawkbit settings at runtime.
83
84config HAWKBIT_USE_DOMAIN_NAME
85	bool "Use server_domain for domain name instead of server_addr"
86	depends on HAWKBIT_SET_SETTINGS_RUNTIME
87	help
88	  Enable to use the server_domain field for TLS and HTTP. If enabled,
89	  server_addr can accept an already resolved IP address, and the domain name
90	  can be provided via server_domain.
91
92config HAWKBIT_DOMAIN_NAME_MAX_LEN
93	int "The buffer size for storing the domain name string"
94	default DNS_RESOLVER_MAX_QUERY_LEN if DNS_RESOLVER
95	default 255
96	depends on HAWKBIT_USE_DOMAIN_NAME
97	help
98	  The size for the internal buffer used to hold the domain name string.
99
100choice HAWKBIT_DDI_SECURITY
101	prompt "hawkBit DDI API authentication modes"
102	default HAWKBIT_DDI_NO_SECURITY
103
104config HAWKBIT_DDI_NO_SECURITY
105	bool "No authentication security"
106	select DEPRECATED
107	help
108	  No authentication security for the hawkBit DDI API. Support for this
109	  had been removed from the hawkBit server in version 0.8.0. Use gateway
110	  security token authentication instead, if you want something similar.
111
112config HAWKBIT_DDI_TARGET_SECURITY
113	bool "Use target security token authentication"
114	help
115	  Use target security token authentication for the hawkBit DDI API.
116	  Here the security token is unique for each device and is generated
117	  during the device registration process. The device has to be registered
118	  in the hawkBit server before using this authentication mode.
119
120config HAWKBIT_DDI_GATEWAY_SECURITY
121	bool "Use gateway security token authentication"
122	help
123	  Use gateway security token authentication for the hawkBit DDI API.
124	  Here the security token is shared between all devices in the same
125	  tenant. The device can register itself in the hawkBit server on
126	  first connection to the server. The device does not need to be registered
127	  in the hawkBit server before using this authentication mode.
128
129endchoice
130
131config HAWKBIT_DDI_SECURITY_TOKEN
132	string "Authentication security token"
133	depends on HAWKBIT_DDI_TARGET_SECURITY || HAWKBIT_DDI_GATEWAY_SECURITY
134	default ""
135	help
136	  Authentication security token for the configured hawkBit DDI
137	  authentication mode.
138
139config HAWKBIT_CUSTOM_ATTRIBUTES
140	bool "Custom device attributes"
141	help
142	  Use custom definition of device attributes.
143
144config HAWKBIT_STATUS_BUFFER_SIZE
145	int "hawkBit status buffer size"
146	default 200
147	help
148	  Set the size of the buffer, which is used to store the
149	  json strings, that are sent to the hawkBit server. It might
150	  be increased if the custom attributes are used extensively.
151
152choice HAWKBIT_DEVICE_ID_SOURCE
153	prompt "Source of the Hawkbit device ID"
154
155config HAWKBIT_HWINFO_DEVICE_ID
156	bool "Device ID through HWINFO module"
157	depends on HWINFO
158
159config HAWKBIT_CUSTOM_DEVICE_ID
160	bool "Custom device id through callback function"
161	help
162	  Be able to customize the device id during runtime to a custom value,
163	  by configuring the callback function. See `hawkbit_set_device_identity_cb`
164
165endchoice
166
167config HAWKBIT_DEVICE_ID_MAX_LENGTH
168	int "Maximum length of the device id"
169	depends on HAWKBIT_CUSTOM_DEVICE_ID
170	range 1 128
171	default 32
172	help
173	  Maximum length of the device id.
174
175config HAWKBIT_USE_TLS
176	bool "Use TLS for hawkBit server connection"
177	depends on NET_SOCKETS_SOCKOPT_TLS
178	help
179	  Use TLS for hawkBit connection.
180
181if HAWKBIT_USE_TLS
182
183choice HAWKBIT_CERT_TAG
184	prompt "hawkBit certificate tag"
185	default HAWKBIT_USE_STATIC_CERT_TAG
186
187config HAWKBIT_USE_STATIC_CERT_TAG
188	bool "Use static certificate tag"
189	help
190	  Use static certificate tag for TLS connection to the hawkBit server.
191
192config HAWKBIT_USE_DYNAMIC_CERT_TAG
193	bool "Use dynamic certificate tag"
194	depends on HAWKBIT_SET_SETTINGS_RUNTIME
195	help
196	  Use dynamic certificate tag for TLS connection to the hawkBit server.
197
198endchoice
199
200config HAWKBIT_STATIC_CERT_TAG
201	int "Static certificate tag"
202	depends on HAWKBIT_USE_STATIC_CERT_TAG
203	default 1
204	help
205	  Static certificate tag for TLS connection to the hawkBit server.
206
207endif
208
209choice HAWKBIT_REBOOT_MODE
210	prompt "Reboot mode after update"
211	default HAWKBIT_REBOOT_WARM
212
213config HAWKBIT_REBOOT_WARM
214	bool "Warm reboot after update"
215	help
216	  Do a warm reboot after the update.
217
218config HAWKBIT_REBOOT_COLD
219	bool "Cold reboot after update"
220	help
221	  Do a cold reboot after the update.
222
223endchoice
224
225config HEAP_MEM_POOL_ADD_SIZE_HAWKBIT
226	int "Heap memory pool size for hawkBit"
227	default 4096
228	help
229	  Set the size of the heap memory pool for hawkBit.
230
231config HAWKBIT_EVENT_CALLBACKS
232	bool "Set hawkBit event callbacks"
233	help
234	  Be able to set event callbacks for hawkBit.
235
236config HAWKBIT_SAVE_PROGRESS
237	bool "Save the hawkBit update download progress"
238	depends on STREAM_FLASH_PROGRESS
239	help
240	  Regularly save progress of hawkBit update download operation.
241	  When enabled, the download progress is periodically saved to
242	  non-volatile storage. If a download is interrupted, it can be resumed from
243	  the last saved point rather than starting over, saving bandwidth and time.
244	  This is especially useful for large updates over unreliable networks or in
245	  resource-constrained environments.
246
247config HAWKBIT_SAVE_PROGRESS_INTERVAL
248	int "Save the hawkBit update download progress interval"
249	default 5
250	range 0 100
251	depends on HAWKBIT_SAVE_PROGRESS
252	help
253	  Set the interval (in percent) that the hawkBit update download progress will be saved.
254	  0 means that the progress will be saved every time a new chunk is downloaded.
255
256module = HAWKBIT
257module-str = Log Level for hawkbit
258module-help = Enables logging for hawkBit code.
259source "subsys/logging/Kconfig.template.log_config"
260
261endif
262