feat(core/bootloader_emu): add -W and -R for the wipe and RSOD boot commands [no changelog]
What changed, and why it matters
This change adds two new command-line options to the Trezor bootloader emulator, a software-only testing tool used by developers. The -W option simulates a device wipe request, and -R simulates a red-screen error display. These options only affect the emulator and do not change how real Trezor hardware behaves. There is no indication this fixes or introduces a security vulnerability in actual devices.
No security action required. Treat as normal feature addition to the developer emulator. If reviewing for completeness, verify that the local structs are correctly sized for bootargs_set and that USE_BOOTARGS_RSOD is defined only for appropriate model builds.
Security signals we found
New emulator-only command-line flags for wipe and RSOD boot commands
RSOD path gated by USE_BOOTARGS_RSOD compile-time define
No changes to hardware firmware, cryptographic, or storage code
No input validation, parsing, or memory safety changes beyond local struct initialization
Evidence from the diff
The commit modifies core/embed/projects/bootloader/emulator.c to add getopt cases for -W and -R. -W calls bootargs_set(BOOT_COMMAND_WIPE, …) with a local bootutils_wipe_info_t struct. -R, gated by USE_BOOTARGS_RSOD, calls bootargs_set(BOOT_COMMAND_SHOW_RSOD, …) with a local systask_postmortem_t struct. This is purely emulator-facing functionality; the bootloader emulator is not shipped to end users and does not alter the firmware binary running on hardware.
Changed components
core/embed/projects/bootloader/emulator.cTrezor bootloader emulator (developer/testing tool)Inspect captured patch +28 / −1
### core/embed/projects/bootloader/emulator.c
@@ -23,6 +23,7 @@
#include "emulator.h"
#include "rust_ui_common.h"
+#include <sys/systask.h>
#include <sys/unix/bootutils_emu.h>
LOG_DECLARE(emulator)
@@ -50,6 +51,10 @@ void usage(void) {
printf("Options:\n");
printf(" -a disable animations\n");
printf(" -s stay in bootloader\n");
+ printf(" -W boot with the wipe command (BOOT_COMMAND_WIPE)\n");
+#ifdef USE_BOOTARGS_RSOD
+ printf(" -R boot with the RSOD command (BOOT_COMMAND_SHOW_RSOD)\n");
+#endif
printf(" -B FILE boot with the command and arguments from FILE (the\n");
printf(" format a previous run wrote to trezor.bootargs)\n");
printf(" -w wipe any firmware before booting\n");
@@ -165,14 +170,36 @@ int main(int argc, char **argv) {
uint8_t set_variant = 0xff;
uint8_t color_variant = 0;
uint8_t bitcoin_only = 0;
- while ((opt = getopt(argc, argv, "ahslewc:b:f:i:B:")) != -1) {
+ while ((opt = getopt(argc, argv, "ahslewc:b:f:i:B:WR")) != -1) {
switch (opt) {
case 'a':
disable_animation(true);
break;
case 's':
bootargs_set(BOOT_COMMAND_STOP_AND_WAIT, NULL, 0);
break;
+ case 'W': {
+ bootutils_wipe_info_t info = {
+ .title = "WIPE REQUESTED",
+ .message = "Wipe command set by the emulator command line",
+ .footer = "",
+ };
+ bootargs_set(BOOT_COMMAND_WIPE, &info, sizeof(info));
+ } break;
+#ifdef USE_BOOTARGS_RSOD
+ case 'R': {
+ systask_postmortem_t pminfo = {
+ .reason = TASK_TERM_REASON_ERROR,
+ .error =
+ {
+ .title = "RSOD REQUESTED",
+ .message = "RSOD command set by the emulator command line",
+ .footer = "",
+ },
+ };
+ bootargs_set(BOOT_COMMAND_SHOW_RSOD, &pminfo, sizeof(pminfo));
+ } break;
+#endif
case 'B':
if (!bootargs_emu_load_file(optarg)) {
exit(BOOTUTILS_EMU_EXIT_USAGE);Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.