GithubHelp home page GithubHelp logo

bithd / bithd-mcu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trezor/trezor-mcu

34.0 15.0 12.0 30.21 MB

:lock: Sources for BITHD firmware

License: GNU Lesser General Public License v3.0

Makefile 0.71% C 94.51% Python 3.61% Shell 0.62% Assembly 0.13% Perl 0.36% Dockerfile 0.06%

bithd-mcu's Introduction

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.

bithd-mcu's People

Contributors

admin-slush avatar arachnid avatar axic avatar bitcartel avatar daira avatar darkskiez avatar hno avatar jhoenicke avatar jiyajie avatar jpz avatar karelbilek avatar mcudev avatar mruddy avatar nining avatar ondrejsika avatar peterzen avatar prusnak avatar romanz avatar saleemrashid avatar schinzelh avatar wangnan31415926 avatar yiwenlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.