Build the docker image to have a ready-to-use RISC-V toolchain:
docker build -t riscv .Retrieve jsmn and nanopb git submodule:
git submodule update --initBuild the RISC-V app using the docker.sh script:
$ ./docker.sh riscv
[root:/app] # cmake -Bbuild -H.
[root:/app] # make -C build/Like any other Nano apps. Sources are in the vm/ directory.
cd vm/
make
make loadUsing speculos:
$ speculos.py --model nanox --sdk 2.0.2 vm/bin/app.elf &
$ ./host/stream.py --speculos --app ./app/build/app-swap/app-swapOr using a real device:
$ ./host/stream.py --app ./app/build/app-swap/app-swapRequests can then be entered in hexadecimal on stdin. Clients are also available, for instance for app-swap:
$ ./app/app-swap/swap.py --speculos --app ./app/build/app-swap/app-swapOnce the app is signed, the .zip can be passed as an argument:
$ ./app/app-swap/swap.py --speculos --app /tmp/app.zipWhile everything is done transparently when passing an ELF file to stream.py,
the following commands can be used to sign an app manually. The app is first
signed by a (fake) Ledger HSM, then by the device:
$ python host/hsm.py --elf-path app/build/app-ethereum/app-ethereum --app-path /tmp/app.zip
$ python host/app.py --speculos --app-path /tmp/app.zip