1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 19:08:12 +00:00
trezor-firmware/docs/bootloader.md

51 lines
1.9 KiB
Markdown
Raw Normal View History

2016-04-25 18:43:48 +00:00
#TREZOR OS Bootloader
2016-04-27 16:45:00 +00:00
All multibyte integer values are little endian!
2016-04-25 20:02:12 +00:00
##Firmware File Format
2016-04-25 18:43:48 +00:00
TREZOR OS firmware file consists of 3 parts:
1. vendor header
2. firmware header
3. firmware code
###Vendor Header
| offset | length | name | description |
|-------:|-------:|------|-------------|
| 0x0000 | 4 | magic | firmware magic `TRZV` |
2016-04-25 20:02:12 +00:00
| 0x0004 | 4 | hlen | length of the vendor header |
2016-05-09 11:14:55 +00:00
| 0x0008 | 4 | expiry | valid until timestamp |
| 0x000C | 1 | vsig_m | number of signatures needed to run the firmware from this vendor |
| 0x000D | 1 | vsig_n | number of pubkeys vendor wants to use for signing |
| 0x000E | 1 | vstr_len | vendor string length |
| 0x000F | ? | vstr | vendor string |
2016-04-25 18:43:48 +00:00
| ? | ? | vimg | vendor image (in [TOIf format](toif.md)) |
| ? | 32 | vpub1 | vendor pubkey 1 |
| ... | ... | ... | ... |
| ? | 32 | vpubn | vendor pubkey n |
| ? | 64 | slsig1 | SatoshiLabs signature 1 |
| ? | 64 | slsig2 | SatoshiLabs signature 2 |
| ? | 64 | slsig3 | SatoshiLabs signature 3 |
###Firmware Header
| offset | length | name | description |
|-------:|-------:|------|-------------|
| 0x0000 | 4 | magic | firmware magic `TRZF` |
| 0x0004 | 4 | hlen | length of the firmware header |
2016-05-09 11:14:55 +00:00
| 0x0008 | 4 | expiry | valid until timestamp |
| 0x000C | 4 | codelen | length of the firmware code |
| 0x0010 | 1 | vmajor | version (major) |
| 0x0011 | 1 | vminor | version (minor) |
| 0x0012 | 1 | vpatch | version (patch) |
| 0x0013 | 1 | vbuild | version (build) |
| 0x0014 | 1 | vidx1 | vendor signature index 1 |
| 0x0015 | 32 | vsig1 | vendor signature 1 |
| 0x0047 | 1 | vidx2 | vendor signature index 2 |
| 0x0048 | 32 | vsig2 | vendor signature 2 |
2016-04-25 18:43:48 +00:00
| ... | ... | ... | ... |
| ? | 1 | vidxn | vendor signature index n |
| ? | 32 | vsign | vendor signature n |