Skip to content

Latest commit

 

History

History
77 lines (64 loc) · 3.65 KB

README.md

File metadata and controls

77 lines (64 loc) · 3.65 KB

BITHD Firmware

https://bithd.com/

How to build BITHD firmware?

  1. Install Docker
  2. git clone https://github.com/bithd/bithd-mcu.git
  3. cd bithd-mcu
  4. pipenv --python 3 install (set up pipenv)
  5. export VERSION_TAG=v4.1.7
  6. export DEVICE_MODEL=BITHD_RAZOR (where alternative value is BITHD_BITHD)
  7. pipenv run ./build-firmware.sh $VERSION_TAG
  8. pipenv run ./script/prepare_firmware.py -f ./build/razor-$VERSION_TAG-unsigned.bin (prepare the image to sign)

This creates file build/razor-$TAG-unsigned.bin and prints its fingerprint and size at the end of the build log.

Verify signed image exported from App

  1. Get the same version signed firmware image exported from App, eg "razor-v4.1.7-signed.bin"
  2. Compare the unsigned and signed image files, eg v4.1.7
diff <(xxd build/razor-v4.1.7-prepared.bin) <(xxd build/razor-v4.1.7-signed.bin)

The following is the comparison result for v4.1.7. The only differences are the first 256 bytes that the signed image has the signatures.

1c1
< 00000000: 5452 5a52 945f 0600 0000 0001 0000 0000  TRZR._..........
---
> 00000000: 5452 5a52 945f 0600 0304 0501 0000 0000  TRZR._..........
5,16c5,16
< 00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
< 000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
---
> 00000040: 3a68 2f7d 8f3b 9d0a 855c 020c 925a 777d  :h/}.;...\...Zw}
> 00000050: e9f9 ca1d df66 bebc 1692 9fe0 4d21 2b5d  .....f......M!+]
> 00000060: a387 4242 6efb bf92 1baf 7f88 31a0 607a  ..BBn.......1.`z
> 00000070: 70a0 7832 b203 915d c6fe 2b1b c0e9 b051  p.x2...]..+....Q
> 00000080: 7e42 3955 a18b 4d4c 109d edc9 d96c 5f75  ~B9U..ML.....l_u
> 00000090: ab25 510e 477e 0ff1 7402 9610 dd5a b1ad  .%Q.G~..t....Z..
> 000000a0: db9d 87ca d82e d7c4 6215 c238 5c0d 2a9a  ........b..8\.*.
> 000000b0: 1651 0194 0edc 3ccf c2de 1a58 f82c e7ef  .Q....<....X.,..
> 000000c0: d60b 546a bf6c 3791 69b0 1e3c fbea 5bd8  ..Tj.l7.i..<..[.
> 000000d0: d889 7096 540d 28fa ff7e f0de f8ea 641f  ..p.T.(..~....d.
> 000000e0: a47b aaa5 7529 8945 7bc1 e5f3 871a 4c34  .{..u).E{.....L4
> 000000f0: 4270 57cf 09e3 845a 38cc aac1 224d b386  BpW....Z8..."M..

Build signed image

Based on the upper prepared firmware image, anyone can build the same signed image by signatures uploaded in code repository.

  1. Use the build_signed_firmware.py script to generate the signed firmware image
pipenv run ./script/build_signed_firmware.py -f ./build/razor-v4.1.7-prepared.bin -s ./signatures/razor-v4.1.7.csv
  1. shasum -a 256 ./build/bithd-$TAG-signed.bin (calculate sha256 checksum)

How to build BITHD bootloader?

  1. Install Docker
  2. git clone https://github.com/bithd/bithd-mcu.git
  3. cd bithd-mcu
  4. ./build-bootloader.sh TAG (where TAG is bl1.3.2 for example)

This creates file build/bootloader-TAG.bin and prints its fingerprint and size at the end of the build log.