mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-12 18:49:07 +00:00
tools: add pretty format to sigmask field
This commit is contained in:
parent
2abc29f70d
commit
17ff61459d
8
Makefile
8
Makefile
@ -28,15 +28,11 @@ vendorheader: ## construct default vendor header
|
||||
./tools/build_vendorheader 'db995fe25169d141cab9bbba92baa01f9f2e1ece7df4cb2ac05190f37fcc1f9d:2152f8d19b791d24453242e15f2eab6cb7cffa7b6a5ed30097960e069881db12:22fc297792f0b6ffc0bfcfdb7edb0c0aa14e025a365ec0e342e86e3829cb74b6' 1 0.0 SatoshiLabs assets/satoshilabs_120.toif micropython/firmware/vendorheader.bin
|
||||
./tools/binctl micropython/firmware/vendorheader.bin -s
|
||||
|
||||
binctl:
|
||||
binctl: ## print info about binary files
|
||||
./tools/binctl micropython/loader/build/loader.bin
|
||||
./tools/binctl micropython/firmware/vendorheader.bin
|
||||
./tools/binctl micropython/firmware/build/firmware.bin
|
||||
|
||||
sign:
|
||||
./tools/binctl micropython/loader/build/loader.bin -s
|
||||
./tools/binctl micropython/firmware/build/firmware.bin -s
|
||||
|
||||
## emulator commands:
|
||||
|
||||
run: ## run unix port
|
||||
@ -62,9 +58,11 @@ build_bootloader: ## build bootloader
|
||||
|
||||
build_loader: ## build loader
|
||||
$(MAKE) -f Makefile.loader $(TREZORHAL_PORT_OPTS)
|
||||
./tools/binctl micropython/loader/build/loader.bin -s
|
||||
|
||||
build_firmware: res build_cross ## build firmware with frozen modules
|
||||
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
|
||||
./tools/binctl micropython/firmware/build/firmware.bin -s
|
||||
|
||||
build_unix: ## build unix port
|
||||
$(MAKE) -f ../../../micropython/unix/Makefile -C vendor/micropython/unix $(UNIX_PORT_OPTS)
|
||||
|
@ -22,6 +22,11 @@ def get_sig(data):
|
||||
return sigmask, sig
|
||||
|
||||
|
||||
def format_sigmask(sigmask):
|
||||
bits = [ str(b + 1) if sigmask & (1<<b) else '.' for b in range(8) ]
|
||||
return '0x%02x = [%s]' % (sigmask, ' '.join(bits))
|
||||
|
||||
|
||||
# loader/firmware headers specification: https://github.com/trezor/trezor-core/blob/master/docs/bootloader.md
|
||||
|
||||
|
||||
@ -64,7 +69,7 @@ class BinImage:
|
||||
print(' * expiry :', self.expiry)
|
||||
print(' * codelen :', self.codelen)
|
||||
print(' * version : %d.%d.%d.%d' % (self.vmajor, self.vminor, self.vpatch, self.vbuild))
|
||||
print(' * sigmask :', self.sigmask)
|
||||
print(' * sigmask :', format_sigmask(self.sigmask))
|
||||
print(' * sig :', binascii.hexlify(self.sig).decode('ascii'))
|
||||
print(' * total : %d bytes' % total_len)
|
||||
print()
|
||||
@ -160,7 +165,7 @@ class VendorHeader:
|
||||
print(' * vpub #%d :' % (i + 1), binascii.hexlify(self.vpub[i]).decode('ascii'))
|
||||
print(' * vstr :', self.vstr.decode('ascii'))
|
||||
print(' * vimg : (%d bytes)' % len(self.vimg))
|
||||
print(' * sigmask :', self.sigmask)
|
||||
print(' * sigmask :', format_sigmask(self.sigmask))
|
||||
print(' * sig :', binascii.hexlify(self.sig).decode('ascii'))
|
||||
|
||||
def serialize_header(self, sig=True):
|
||||
|
Loading…
Reference in New Issue
Block a user