From 6d2b73ea868143cc9c4d2e98014c68e60aa90140 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Tue, 20 Dec 2022 10:14:50 +0100 Subject: [PATCH] feat(legacy): add model info to image header --- legacy/Makefile.include | 7 +++++++ legacy/firmware/header.S | 5 ++++- legacy/fw_signatures.h | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/legacy/Makefile.include b/legacy/Makefile.include index 20fd6ae9c..261316957 100644 --- a/legacy/Makefile.include +++ b/legacy/Makefile.include @@ -95,6 +95,13 @@ LDFLAGS += -L$(TOP_DIR) \ ZKP_PATH = $(TOP_DIR)vendor/secp256k1-zkp +# hw_model = T1B1 = 0x31423154 +HW_MODEL = 0x31423154 +CPUFLAGS += -DHW_MODEL=$(HW_MODEL) +CPUFLAGS += -DHW_REVISION=0 +CFLAGS += -DHW_MODEL=$(HW_MODEL) +CFLAGS += -DHW_REVISION=0 + ifeq ($(EMULATOR),1) CFLAGS += -DEMULATOR=1 diff --git a/legacy/firmware/header.S b/legacy/firmware/header.S index 46e4aa375..87a7dba30 100644 --- a/legacy/firmware/header.S +++ b/legacy/firmware/header.S @@ -20,7 +20,10 @@ g_header: .byte FIX_VERSION_MINOR // fix_vminor .byte FIX_VERSION_PATCH // fix_vpatch .byte 0 // fix_vbuild - . = . + 8 // reserved + .word HW_MODEL // type of the designated hardware + .byte HW_REVISION // revision of the designated hardware + .byte 0 // monotonic version placeholder - not used in legacy + . = . + 2 // reserved . = . + 512 // hash1 ... hash16 . = . + 64 // sig1 . = . + 64 // sig2 diff --git a/legacy/fw_signatures.h b/legacy/fw_signatures.h index ffef2192f..e9c76f363 100644 --- a/legacy/fw_signatures.h +++ b/legacy/fw_signatures.h @@ -44,7 +44,10 @@ typedef struct { uint32_t codelen; uint32_t version; uint32_t fix_version; - uint8_t __reserved1[8]; + uint32_t hw_model; + uint8_t hw_revision; + uint8_t monotonic; + uint8_t __reserved1[2]; uint8_t hashes[512]; uint8_t sig1[64]; uint8_t sig2[64];