This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
99 lines (78 loc) · 3.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#*******************************************************************************
#* (c) 2019 ZondaX GmbH
#*
#* Licensed under the Apache License, Version 2.0 (the "License");
#* you may not use this file except in compliance with the License.
#* You may obtain a copy of the License at
#*
#* http://www.apache.org/licenses/LICENSE-2.0
#*
#* Unless required by applicable law or agreed to in writing, software
#* distributed under the License is distributed on an "AS IS" BASIS,
#* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#* See the License for the specific language governing permissions and
#* limitations under the License.
#********************************************************************************
.PHONY: all deps build clean load delete
LEDGER_SRC=$(CURDIR)/src/ledger
DOCKER_APP_SRC=/project/src/ledger
DOCKER_IMAGE=zondax/ledger-docker-bolos:latest
DOCKER_BOLOS_SDK=/project/deps/nanos-secure-sdk
DOCKER_BOLOS_SDKX=/project/deps/nano2-sdk
SCP_PUBKEY=049bc79d139c70c83a4b19e8922e5ee3e0080bb14a2e8b0752aa42cda90a1463f689b0fa68c1c0246845c2074787b649d0d8a6c0b97d4607065eee3057bdf16b83
SCP_PRIVKEY=ff701d781f43ce106f72dc26a46b6a83e053b5d07bb3d4ceab79c91ca822a66b
all: build
define run_docker
docker run -it --rm \
--privileged \
-e SCP_PRIVKEY=$(SCP_PRIVKEY) \
-e BOLOS_SDK=$(1) \
-e BOLOS_ENV=/opt/bolos \
-p 1234:1234 \
-p 8001:8001 \
-p 9998-9999:9998-9999 \
-u $(shell id -u) \
-v $(shell pwd):/project \
-e DISPLAY=$(shell echo ${DISPLAY}) \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
$(DOCKER_IMAGE) \
"$(2)"
endef
pull:
docker pull $(DOCKER_IMAGE)
deps:
@echo "Install dependencies"
$(CURDIR)/src/install_deps.sh
build:
@cp $(LEDGER_SRC)/nanos_icon.gif $(LEDGER_SRC)/glyphs/icon_app.gif
$(call run_docker,$(DOCKER_BOLOS_SDK),make -C $(DOCKER_APP_SRC))
buildX:
@cp $(LEDGER_SRC)/nanos_icon.gif $(LEDGER_SRC)/glyphs/icon_app.gif
@convert $(LEDGER_SRC)/nanos_icon.gif -crop 14x14+1+1 +repage -negate $(LEDGER_SRC)/nanox_icon.gif
$(call run_docker,$(DOCKER_BOLOS_SDKX),make -C $(DOCKER_APP_SRC))
clean:
$(call run_docker,$(DOCKER_BOLOS_SDK),make -C $(DOCKER_APP_SRC) clean)
shell:
$(call run_docker,$(DOCKER_BOLOS_SDK) -t,bash)
debug: build
$(call run_docker,$(DOCKER_BOLOS_SDK),/home/test/speculos/speculos.py -d -n -t $(DOCKER_APP_SRC)/bin/app.elf)
emu: build
$(call run_docker,$(DOCKER_BOLOS_SDK),/home/test/speculos/speculos.py -o -z 3 -v 8001 $(DOCKER_APP_SRC)/bin/app.elf)
load:
${LEDGER_SRC}/pkg/zxtool.sh load
delete:
${LEDGER_SRC}/pkg/zxtool.sh delete
# This target will initialize the device with the integration testing mnemonic
dev_init:
@echo "Initializing device with test mnemonic! WARNING TAKES 2 MINUTES AND REQUIRES RECOVERY MODE"
@python -m ledgerblue.hostOnboard --apdu --id 0 --prefix "" --passphrase "" --pin 5555 --words "equip will roof matter pink blind book anxiety banner elbow sun young"
# This target will setup a custom developer certificate
dev_ca:
@python -m ledgerblue.setupCustomCA --targetId 0x31100004 --public $(SCP_PUBKEY) --name zondax
dev_ca_delete:
@python -m ledgerblue.resetCustomCA --targetId 0x31100004
# This target will setup a custom developer certificate
dev_ca2:
@python -m ledgerblue.setupCustomCA --targetId 0x33000004 --public $(SCP_PUBKEY) --name zondax
dev_ca_delete2:
@python -m ledgerblue.resetCustomCA --targetId 0x33000004