Skip to content

Commit e88c285

Browse files
ahasztagtomchy
authored andcommitted
suit: Allow for local manifests installation from recovery
This commit allows the APP_RECOVERY manifest to orchestrate the installation of the APP_LOCAL/RAD_LOCAL manifests. This is needed for cases where there is a "companion image" in the system, which can be invoked by both the root and recovery manifests. In this case, such images should only be installed from recovery mode. Signed-off-by: Artur Hadasz <[email protected]>
1 parent 4f31284 commit e88c285

File tree

4 files changed

+206
-65
lines changed

4 files changed

+206
-65
lines changed
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
{%- set component_index = 0 %}
2+
{%- set component_list = [] %}
3+
{%- set dependencies_list = [] %}
4+
{%- set mpi_app_recovery_vendor_name = application['config']['CONFIG_SUIT_MPI_APP_RECOVERY_VENDOR_NAME']|default('nordicsemi.com') %}
5+
{%- set mpi_app_recovery_class_name = application['config']['CONFIG_SUIT_MPI_APP_RECOVERY_CLASS_NAME']|default('nRF54H20_app_recovery') %}
6+
{%- set mpi_rad_recovery_vendor_name = application['config']['CONFIG_SUIT_MPI_RAD_RECOVERY_VENDOR_NAME']|default('nordicsemi.com') %}
7+
{%- set mpi_rad_recovery_class_name = application['config']['CONFIG_SUIT_MPI_RAD_RECOVERY_CLASS_NAME']|default('nRF54H20_rad_recovery') %}
8+
{%- set mpi_app_recovery_local_vendor_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_VENDOR_NAME']|default('nordicsemi.com') %}
9+
{%- set mpi_app_recovery_local_class_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_CLASS_NAME']|default('nRF54H20_sample_app_2') %}
10+
SUIT_Envelope_Tagged:
11+
suit-authentication-wrapper:
12+
SuitDigest:
13+
suit-digest-algorithm-id: cose-alg-sha-256
14+
suit-manifest:
15+
suit-manifest-version: 1
16+
{%- if APP_RECOVERY_SEQ_NUM is defined %}
17+
suit-manifest-sequence-number: {{ APP_RECOVERY_SEQ_NUM }}
18+
{%- elif DEFAULT_SEQ_NUM is defined %}
19+
suit-manifest-sequence-number: {{ DEFAULT_SEQ_NUM }}
20+
{%- else %}
21+
suit-manifest-sequence-number: 1
22+
{%- endif %}
23+
suit-common:
24+
suit-components:
25+
{%- set component_index = 0 %}
26+
- - CAND_MFST
27+
- 0
28+
{%- set component_index = component_index + 1 %}
29+
{%- if app_recovery_img is defined %}
30+
{%- set app_recovery_local_instld_mfst_component_index = component_index %}
31+
{{- component_list.append( app_recovery_local_instld_mfst_component_index ) or ""}}
32+
{{- dependencies_list.append( app_recovery_local_instld_mfst_component_index ) or ""}}
33+
- - INSTLD_MFST
34+
- RFC4122_UUID:
35+
namespace: {{ mpi_app_recovery_local_vendor_name }}
36+
name: {{ mpi_app_recovery_local_class_name }}
37+
{%- set component_index = component_index + 1 %}
38+
{%- endif %}
39+
{%- if rad_recovery is defined %}
40+
{%- set rad_instld_mfst_component_index = component_index %}
41+
{{- component_list.append( rad_instld_mfst_component_index ) or ""}}
42+
{{- dependencies_list.append( rad_instld_mfst_component_index ) or ""}}
43+
- - INSTLD_MFST
44+
- RFC4122_UUID:
45+
namespace: {{ mpi_rad_recovery_vendor_name }}
46+
name: {{ mpi_rad_recovery_class_name }}
47+
{%- set component_index = component_index + 1 %}
48+
{%- endif %}
49+
50+
suit-shared-sequence:
51+
{%- if rad_recovery is defined %}
52+
- suit-directive-set-component-index: {{ rad_instld_mfst_component_index }}
53+
- suit-directive-override-parameters:
54+
suit-parameter-vendor-identifier:
55+
RFC4122_UUID: {{ mpi_app_recovery_vendor_name }}
56+
suit-parameter-class-identifier:
57+
RFC4122_UUID:
58+
namespace: {{ mpi_app_recovery_vendor_name }}
59+
name: {{ mpi_app_recovery_class_name }}
60+
{%- endif %}
61+
{%- if app_recovery_img is defined %}
62+
- suit-directive-set-component-index: {{ app_recovery_local_instld_mfst_component_index }}
63+
- suit-directive-override-parameters:
64+
suit-parameter-vendor-identifier:
65+
RFC4122_UUID: {{ mpi_app_recovery_local_vendor_name }}
66+
suit-parameter-class-identifier:
67+
RFC4122_UUID:
68+
namespace: {{ mpi_app_recovery_local_vendor_name }}
69+
name: {{ mpi_app_recovery_class_name }}
70+
{%- endif %}
71+
- suit-directive-set-component-index: [{{ component_list|join(',') }}]
72+
- suit-condition-vendor-identifier:
73+
- suit-send-record-success
74+
- suit-send-record-failure
75+
- suit-send-sysinfo-success
76+
- suit-send-sysinfo-failure
77+
- suit-condition-class-identifier:
78+
- suit-send-record-success
79+
- suit-send-record-failure
80+
- suit-send-sysinfo-success
81+
- suit-send-sysinfo-failure
82+
suit-dependencies:
83+
# Key is the index of suit-components that describe the dependency manifest
84+
"0": {}
85+
{%- for component_element in dependencies_list %}
86+
"{{ component_element }}": {}
87+
{%- endfor %}
88+
89+
suit-validate:
90+
{% if dependencies_list|length > 0 %}
91+
- suit-directive-set-component-index: [{{ dependencies_list|join(',') }}]
92+
- suit-condition-dependency-integrity:
93+
- suit-send-record-success
94+
- suit-send-record-failure
95+
- suit-send-sysinfo-success
96+
- suit-send-sysinfo-failure
97+
- suit-directive-process-dependency:
98+
- suit-send-record-success
99+
- suit-send-record-failure
100+
- suit-send-sysinfo-success
101+
- suit-send-sysinfo-failure
102+
{% endif %}
103+
104+
suit-invoke:
105+
{% if dependencies_list|length > 0 %}
106+
- suit-directive-set-component-index: [{{ dependencies_list|join(',') }}]
107+
- suit-condition-dependency-integrity:
108+
- suit-send-record-success
109+
- suit-send-record-failure
110+
- suit-send-sysinfo-success
111+
- suit-send-sysinfo-failure
112+
- suit-directive-process-dependency:
113+
- suit-send-record-success
114+
- suit-send-record-failure
115+
- suit-send-sysinfo-success
116+
- suit-send-sysinfo-failure
117+
{% endif %}
118+
119+
{%- if APP_RECOVERY_VERSION is defined %}
120+
suit-current-version: {{ APP_RECOVERY_VERSION }}
121+
{%- elif DEFAULT_VERSION is defined %}
122+
suit-current-version: {{ DEFAULT_VERSION }}
123+
{%- endif %}
124+
125+
{%- if application['dt'].label2node['suit_storage_partition'].regs[0].size == 24576 %}
126+
# Application DTS contains larger SUIT storage - use legacy encoding
127+
suit-install-legacy:
128+
{%- else %}
129+
suit-install:
130+
{%- endif %}
131+
{%- if rad_recovery is defined %}
132+
- suit-directive-set-component-index: 0
133+
- suit-directive-override-parameters:
134+
suit-parameter-uri: '#{{ rad_recovery['name'] }}'
135+
suit-parameter-image-digest:
136+
suit-digest-algorithm-id: cose-alg-sha-256
137+
suit-digest-bytes:
138+
envelope: {{ artifacts_folder ~ rad_recovery['name'] }}.suit
139+
- suit-directive-fetch:
140+
- suit-send-record-failure
141+
- suit-condition-image-match:
142+
- suit-send-record-success
143+
- suit-send-record-failure
144+
- suit-send-sysinfo-success
145+
- suit-send-sysinfo-failure
146+
- suit-condition-dependency-integrity:
147+
- suit-send-record-success
148+
- suit-send-record-failure
149+
- suit-send-sysinfo-success
150+
- suit-send-sysinfo-failure
151+
- suit-directive-process-dependency:
152+
- suit-send-record-success
153+
- suit-send-record-failure
154+
- suit-send-sysinfo-success
155+
- suit-send-sysinfo-failure
156+
{%- endif %}
157+
{%- if app_recovery_img is defined %}
158+
- suit-directive-set-component-index: 0
159+
- suit-directive-override-parameters:
160+
suit-parameter-uri: '#{{ app_recovery_img['name'] }}'
161+
suit-parameter-image-digest:
162+
suit-digest-algorithm-id: cose-alg-sha-256
163+
suit-digest-bytes:
164+
envelope: {{ artifacts_folder ~ app_recovery_img['name'] }}.suit
165+
- suit-directive-fetch:
166+
- suit-send-record-failure
167+
- suit-condition-image-match:
168+
- suit-send-record-success
169+
- suit-send-record-failure
170+
- suit-send-sysinfo-success
171+
- suit-send-sysinfo-failure
172+
- suit-condition-dependency-integrity:
173+
- suit-send-record-success
174+
- suit-send-record-failure
175+
- suit-send-sysinfo-success
176+
- suit-send-sysinfo-failure
177+
- suit-directive-process-dependency:
178+
- suit-send-record-success
179+
- suit-send-record-failure
180+
- suit-send-sysinfo-success
181+
- suit-send-sysinfo-failure
182+
{%- endif %}
183+
suit-manifest-component-id:
184+
- INSTLD_MFST
185+
- RFC4122_UUID:
186+
namespace: {{ mpi_app_recovery_vendor_name }}
187+
name: {{ mpi_app_recovery_class_name }}
188+
suit-integrated-dependencies:
189+
{%- if rad_recovery is defined %}
190+
'#{{ rad_recovery['name'] }}': {{ artifacts_folder ~ rad_recovery['name'] }}.suit
191+
{%- endif %}
192+
{%- if app_recovery_img is defined %}
193+
'#{{ app_recovery_img['name'] }}': {{ artifacts_folder ~ app_recovery_img['name'] }}.suit
194+
{%- endif %}

config/suit/templates/nrf54h20/default/v1/app_recovery_envelope.yaml.jinja2 renamed to config/suit/templates/nrf54h20/default/v1/app_recovery_envelope_direct.yaml.jinja2

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
{%- set mpi_app_recovery_class_name = application['config']['CONFIG_SUIT_MPI_APP_RECOVERY_CLASS_NAME']|default('nRF54H20_app_recovery') %}
66
{%- set mpi_rad_recovery_vendor_name = application['config']['CONFIG_SUIT_MPI_RAD_RECOVERY_VENDOR_NAME']|default('nordicsemi.com') %}
77
{%- set mpi_rad_recovery_class_name = application['config']['CONFIG_SUIT_MPI_RAD_RECOVERY_CLASS_NAME']|default('nRF54H20_rad_recovery') %}
8-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3']%}
9-
{%- set mpi_app_recovery_local_vendor_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_VENDOR_NAME']|default('nordicsemi.com') %}
10-
{%- set mpi_app_recovery_local_class_name = application['config']['CONFIG_SUIT_MPI_APP_LOCAL_3_CLASS_NAME']|default('nRF54H20_sample_app_2') %}
11-
{%- endif %}
128
SUIT_Envelope_Tagged:
139
suit-authentication-wrapper:
1410
SuitDigest:
@@ -25,32 +21,19 @@ SUIT_Envelope_Tagged:
2521
suit-common:
2622
suit-components:
2723
{%- set component_index = 0 %}
28-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY']%}
2924
- - CAND_IMG
3025
- 0
3126
{%- set component_index = component_index + 1 %}
32-
{%- endif %}
3327
- - CAND_MFST
3428
- 0
35-
{%- set cand_mfst_component_index = component_index %}
3629
{%- set component_index = component_index + 1 %}
3730
{%- if app_recovery_img is defined %}
38-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY']%}
3931
{%- set app_img_component_index = component_index %}
4032
{{- component_list.append( app_img_component_index ) or ""}}
4133
- - MEM
4234
- {{ app_recovery_img['dt'].label2node['cpu'].unit_addr }}
4335
- {{ get_absolute_address(app_recovery_img['dt'].chosen_nodes['zephyr,code-partition']) }}
4436
- {{ app_recovery_img['dt'].chosen_nodes['zephyr,code-partition'].regs[0].size }}
45-
{%- elif sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3'] %}
46-
{%- set app_recovery_local_instld_mfst_component_index = component_index %}
47-
{{- component_list.append( app_recovery_local_instld_mfst_component_index ) or ""}}
48-
{{- dependencies_list.append( app_recovery_local_instld_mfst_component_index ) or ""}}
49-
- - INSTLD_MFST
50-
- RFC4122_UUID:
51-
namespace: {{ mpi_app_recovery_local_vendor_name }}
52-
name: {{ mpi_app_recovery_local_class_name }}
53-
{%- endif %}
5437
{%- set component_index = component_index + 1 %}
5538
{%- endif %}
5639
{%- if rad_recovery is defined %}
@@ -76,7 +59,6 @@ SUIT_Envelope_Tagged:
7659
name: {{ mpi_app_recovery_class_name }}
7760
{%- endif %}
7861
{%- if app_recovery_img is defined %}
79-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY']%}
8062
- suit-directive-set-component-index: {{ app_img_component_index }}
8163
- suit-directive-override-parameters:
8264
suit-parameter-vendor-identifier:
@@ -91,16 +73,6 @@ SUIT_Envelope_Tagged:
9173
file: {{ app_recovery_img['binary'] }}
9274
suit-parameter-image-size:
9375
file: {{ app_recovery_img['binary'] }}
94-
{%- elif sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3'] %}
95-
- suit-directive-set-component-index: {{ app_recovery_local_instld_mfst_component_index }}
96-
- suit-directive-override-parameters:
97-
suit-parameter-vendor-identifier:
98-
RFC4122_UUID: {{ mpi_app_recovery_local_vendor_name }}
99-
suit-parameter-class-identifier:
100-
RFC4122_UUID:
101-
namespace: {{ mpi_app_recovery_local_vendor_name }}
102-
name: {{ mpi_app_recovery_class_name }}
103-
{%- endif %}
10476
{%- endif %}
10577
- suit-directive-set-component-index: [{{ component_list|join(',') }}]
10678
- suit-condition-vendor-identifier:
@@ -115,7 +87,7 @@ SUIT_Envelope_Tagged:
11587
- suit-send-sysinfo-failure
11688
suit-dependencies:
11789
# Key is the index of suit-components that describe the dependency manifest
118-
"{{ cand_mfst_component_index }}": {}
90+
"1": {}
11991
{%- for component_element in dependencies_list %}
12092
"{{ component_element }}": {}
12193
{%- endfor %}
@@ -134,7 +106,7 @@ SUIT_Envelope_Tagged:
134106
- suit-send-sysinfo-success
135107
- suit-send-sysinfo-failure
136108
{% endif %}
137-
{%- if app_recovery_img is defined and sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY'] %}
109+
{%- if app_recovery_img is defined %}
138110
- suit-directive-set-component-index: {{ app_img_component_index }}
139111
- suit-condition-image-match:
140112
- suit-send-record-success
@@ -157,7 +129,7 @@ SUIT_Envelope_Tagged:
157129
- suit-send-sysinfo-success
158130
- suit-send-sysinfo-failure
159131
{% endif %}
160-
{%- if app_recovery_img is defined and sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY'] %}
132+
{%- if app_recovery_img is defined %}
161133
- suit-directive-set-component-index: {{ app_img_component_index }}
162134
- suit-directive-invoke:
163135
- suit-send-record-failure
@@ -176,7 +148,7 @@ SUIT_Envelope_Tagged:
176148
suit-install:
177149
{%- endif %}
178150
{%- if rad_recovery is defined %}
179-
- suit-directive-set-component-index: {{ cand_mfst_component_index }}
151+
- suit-directive-set-component-index: 1
180152
- suit-directive-override-parameters:
181153
suit-parameter-uri: '#{{ rad_recovery['name'] }}'
182154
suit-parameter-image-digest:
@@ -202,7 +174,6 @@ SUIT_Envelope_Tagged:
202174
- suit-send-sysinfo-failure
203175
{%- endif %}
204176
{%- if app_recovery_img is defined %}
205-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY']%}
206177
- suit-directive-set-component-index: 0
207178
- suit-directive-override-parameters:
208179
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI' in app_recovery_img['config'] and app_recovery_img['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE_URI'] != '' %}
@@ -231,32 +202,6 @@ SUIT_Envelope_Tagged:
231202
- suit-send-record-failure
232203
- suit-send-sysinfo-success
233204
- suit-send-sysinfo-failure
234-
{%- elif sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3'] %}
235-
- suit-directive-set-component-index: 0
236-
- suit-directive-override-parameters:
237-
suit-parameter-uri: '#{{ app_recovery_img['name'] }}'
238-
suit-parameter-image-digest:
239-
suit-digest-algorithm-id: cose-alg-sha-256
240-
suit-digest-bytes:
241-
envelope: {{ artifacts_folder ~ app_recovery_img['name'] }}.suit
242-
- suit-directive-fetch:
243-
- suit-send-record-failure
244-
- suit-condition-image-match:
245-
- suit-send-record-success
246-
- suit-send-record-failure
247-
- suit-send-sysinfo-success
248-
- suit-send-sysinfo-failure
249-
- suit-condition-dependency-integrity:
250-
- suit-send-record-success
251-
- suit-send-record-failure
252-
- suit-send-sysinfo-success
253-
- suit-send-sysinfo-failure
254-
- suit-directive-process-dependency:
255-
- suit-send-record-success
256-
- suit-send-record-failure
257-
- suit-send-sysinfo-success
258-
- suit-send-sysinfo-failure
259-
{%- endif %}
260205
{%- endif %}
261206
suit-manifest-component-id:
262207
- INSTLD_MFST
@@ -268,11 +213,7 @@ SUIT_Envelope_Tagged:
268213
'#{{ rad_recovery['name'] }}': {{ artifacts_folder ~ rad_recovery['name'] }}.suit
269214
{%- endif %}
270215
{%- if app_recovery_img is defined %}
271-
{%- if sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY']%}
272216
{%- if 'CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE' not in app_recovery_img['config'] or app_recovery_img['config']['CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE'] == '' %}
273217
'#{{ app_recovery_img['name'] }}': {{ app_recovery_img['binary'] }}
274218
{%- endif %}
275-
{%- elif sysbuild['config']['SB_CONFIG_SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3'] %}
276-
'#{{ app_recovery_img['name'] }}': {{ artifacts_folder ~ app_recovery_img['name'] }}.suit
277-
{%- endif %}
278219
{%- endif %}

subsys/suit/mci/src/suit_mci_nrf54h20.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,14 @@ suit_mci_manifest_process_dependency_validate(const suit_manifest_class_id_t *pa
640640
}
641641

642642
if ((parent_role == SUIT_MANIFEST_APP_RECOVERY) &&
643-
(child_role == SUIT_MANIFEST_RAD_RECOVERY)) {
643+
((child_role == SUIT_MANIFEST_RAD_RECOVERY) ||
644+
((child_role >= SUIT_MANIFEST_APP_LOCAL_1) &&
645+
(child_role <= SUIT_MANIFEST_APP_LOCAL_3)) ||
646+
((child_role >= SUIT_MANIFEST_RAD_LOCAL_1) &&
647+
(child_role <= SUIT_MANIFEST_RAD_LOCAL_2)))) {
644648
return SUIT_PLAT_SUCCESS;
645649
}
650+
646651
break;
647652

648653
case EXECUTION_MODE_INSTALL_FOREGROUND_DFU:

sysbuild/Kconfig.suit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ config SUIT_RECOVERY_APPLICATION_PATH
112112

113113
config SUIT_ENVELOPE_APP_RECOVERY_TEMPLATE_FILENAME
114114
string "Name of the default root envelope template"
115-
default "app_recovery_envelope.yaml.jinja2"
115+
default "app_recovery_envelope_app_local.yaml.jinja2" if SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_LOCAL_3
116+
default "app_recovery_envelope_direct.yaml.jinja2" if SUIT_RECOVERY_APPLICATION_IMAGE_MANIFEST_APP_RECOVERY
116117
help
117118
Name of the default application recovery envelope template. This also has a role of the
118119
recovery firmware root envelope template.

0 commit comments

Comments
 (0)