diff --git a/emulator/setup.c b/emulator/setup.c index f994916d3..2ea8f9219 100644 --- a/emulator/setup.c +++ b/emulator/setup.c @@ -48,6 +48,10 @@ void setup(void) { setup_flash(); } +void __attribute__((noreturn)) shutdown(void) { + for(;;); +} + void emulatorRandom(void *buffer, size_t size) { ssize_t n = read(urandom, buffer, size); if (n < 0 || ((size_t) n) != size) { diff --git a/firmware/bl_check.c b/firmware/bl_check.c index 1e53497f2..0d6b3bba0 100644 --- a/firmware/bl_check.c +++ b/firmware/bl_check.c @@ -47,7 +47,7 @@ void check_bootloader(void) if (!known_bootloader(r, hash)) { layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Unknown bootloader", "detected.", NULL, "Unplug your TREZOR", "contact our support.", NULL); - system_halt(); + shutdown(); } if (r == 32 && 0 == memcmp(hash, bl_hash, 32)) { @@ -55,6 +55,11 @@ void check_bootloader(void) return; } +#if 0 + // ENABLE THIS AT YOUR OWN RISK + // ATTEMPTING TO OVERWRITE BOOTLOADER WITH UNSIGNED FIRMWARE MAY BRICK + // YOUR DEVICE. + // unlock sectors memory_write_unlock(); @@ -71,5 +76,6 @@ void check_bootloader(void) // show info and halt layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Update finished"), _("successfully."), NULL, _("Please reconnect"), _("the device."), NULL); - system_halt(); + shutdown(); +#endif } diff --git a/script/cibuild b/script/cibuild index 023969661..b8dc11226 100755 --- a/script/cibuild +++ b/script/cibuild @@ -19,6 +19,7 @@ if [ "$FASTFLASH" = 1 ]; then make -C fastflash fi +make -C bootloader make -C vendor/nanopb/generator/proto make -C firmware/protob diff --git a/util.h b/util.h index 04fb637c2..8b6a9f2eb 100644 --- a/util.h +++ b/util.h @@ -43,13 +43,14 @@ void data2hex(const void *data, uint32_t len, char *str); // read protobuf integer and advance pointer uint32_t readprotobufint(uint8_t **ptr); +extern void __attribute__((noreturn)) shutdown(void); + #if !EMULATOR // defined in memory.ld extern uint8_t _ram_start[], _ram_end[]; // defined in startup.s extern void memset_reg(void *start, void *stop, uint32_t val); -extern void __attribute__((noreturn)) shutdown(void); #define FW_SIGNED 0x5A3CA5C3 #define FW_UNTRUSTED 0x00000000