Skip to content

Commit 43f9776

Browse files
committed
Merge branch 'recovery-RC3' into secure_boot
2 parents fe90fe1 + 162e2eb commit 43f9776

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

cli/main.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,10 @@ static int fw_update(int argc, char **argv)
13141314
int ret;
13151315
int type;
13161316
const char *desc = "Flash the firmware with a new image";
1317+
int bl2 = 0;
1318+
int key = 0;
1319+
int cfg_part = 0;
1320+
int fw = 0;
13171321

13181322
enum switchtec_boot_phase phase_id;
13191323
enum mrpc_cmd rpc_cmd = MRPC_FWDNLD;
@@ -1405,6 +1409,27 @@ static int fw_update(int argc, char **argv)
14051409
progress_finish();
14061410
printf("\n");
14071411

1412+
if ((phase_id == SWITCHTEC_BOOT_PHASE_BL2) && !cfg.dont_activate) {
1413+
if (type == SWITCHTEC_FW_TYPE_BL2)
1414+
bl2 = 1;
1415+
else if (type == SWITCHTEC_FW_TYPE_CFG)
1416+
cfg_part = 1;
1417+
else if (type == SWITCHTEC_FW_TYPE_IMG)
1418+
fw = 1;
1419+
else if (type == SWITCHTEC_FW_TYPE_KEY)
1420+
key = 1;
1421+
1422+
ret = switchtec_fw_toggle_active_partition(cfg.dev,
1423+
bl2,
1424+
key,
1425+
fw,
1426+
cfg_part);
1427+
if (ret) {
1428+
switchtec_perror("firmware update");
1429+
return ret;
1430+
}
1431+
}
1432+
14081433
print_fw_part_info(cfg.dev);
14091434
printf("\n");
14101435

0 commit comments

Comments
 (0)