From 21959996bda33c6ca3e2e6f6fe89b7072cb767d3 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 14 Sep 2023 14:55:03 +0200 Subject: [PATCH] feat(core/bootloader_emu): allow explicit bootloader locking from command line --- core/embed/bootloader/emulator.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/embed/bootloader/emulator.c b/core/embed/bootloader/emulator.c index 68c8f5ab0f..065c465de9 100644 --- a/core/embed/bootloader/emulator.c +++ b/core/embed/bootloader/emulator.c @@ -7,6 +7,9 @@ #include "flash.h" #include "model.h" #include "rust_ui.h" +#ifdef USE_OPTIGA +#include "secret.h" +#endif #include "emulator.h" @@ -40,9 +43,17 @@ __attribute__((noreturn)) int main(int argc, char **argv) { (void)ret; } - if (argc == 2 && argv[1][0] == 's') { - // Run the firmware - stay_in_bootloader_flag = STAY_IN_BOOTLOADER_FLAG; + if (argc == 2) { + if (argv[1][0] == 's') { + // Run the firmware + stay_in_bootloader_flag = STAY_IN_BOOTLOADER_FLAG; + } +#ifdef USE_OPTIGA + else if (argv[1][0] == 'l') { + // write bootloader-lock secret + secret_write_header(); + } +#endif } else if (argc == 4) { display_init(); display_backlight(180);