-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
106 lines (85 loc) · 4.28 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
100
101
102
103
104
105
106
#*******************************************************************************
#* (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 check_python show_info_recovery_mode
LEDGER_SRC=$(CURDIR)/src/ledger
DOCKER_IMAGE=zondax/ledger-docker-bolos
DOCKER_BOLOS_SDK=/project/deps/nanos-secure-sdk
DOCKER_IMAGE2=zondax/ledger_bolos2
DOCKER_BOLOS_SDK2=/project/deps/nano2-sdk
SCP_PUBKEY=049bc79d139c70c83a4b19e8922e5ee3e0080bb14a2e8b0752aa42cda90a1463f689b0fa68c1c0246845c2074787b649d0d8a6c0b97d4607065eee3057bdf16b83
SCP_PRIVKEY=ff701d781f43ce106f72dc26a46b6a83e053b5d07bb3d4ceab79c91ca822a66b
all: build
check_python:
@python -c 'import sys; sys.exit(3-sys.version_info.major)' || (echo "The python command does not point to Python 3"; exit 1)
deps: check_python
@echo "Install dependencies"
$(CURDIR)/src/install_deps.sh
build: check_python
docker run -i --rm \
-e BOLOS_SDK=$(DOCKER_BOLOS_SDK) -e BOLOS_ENV=/opt/bolos \
-e TESTNET_ENABLED \
-u $(shell id -u) -v $(shell pwd):/project \
$(DOCKER_IMAGE) \
make -C /project/src/ledger
build2: check_python
docker run -i --rm \
-e BOLOS_SDK=$(DOCKER_BOLOS_SDK2) -e BOLOS_ENV=/opt/bolos \
-e TESTNET_ENABLED \
-u $(shell id -u) -v $(shell pwd):/project \
$(DOCKER_IMAGE2) \
make -C /project/src/ledger
clean: check_python
BOLOS_SDK=$(CURDIR)/deps/nanos-secure-sdk BOLOS_ENV=/opt/bolos \
make -C $(LEDGER_SRC) clean
load: check_python build
SCP_PRIVKEY=$(SCP_PRIVKEY) \
BOLOS_SDK=$(CURDIR)/deps/nanos-secure-sdk BOLOS_ENV=/opt/bolos \
make -C $(LEDGER_SRC) load
load2: check_python build2
SCP_PRIVKEY=$(SCP_PRIVKEY) \
BOLOS_SDK=$(CURDIR)/deps/nano2-sdk BOLOS_ENV=/opt/bolos \
make -C $(LEDGER_SRC) load
delete: check_python
SCP_PRIVKEY=$(SCP_PRIVKEY) \
BOLOS_SDK=$(CURDIR)/deps/nanos-secure-sdk BOLOS_ENV=/opt/bolos \
make -C $(LEDGER_SRC) delete
show_info_recovery_mode:
@echo "This command requires a Ledger Nano S in recovery mode. To go into recovery mode, follow:"
@echo " 1. Settings -> Device -> Reset all and confirm"
@echo " 2. Unplug device, press and hold the right button, plug-in again"
@echo " 3. Navigate to the main menu"
@echo "If everything was correct, no PIN needs to be entered."
# This target will initialize the device with the primary integration testing mnemonic (Alice)
dev_init: check_python show_info_recovery_mode
@echo "Initializing device with primary 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 initialize the device with the secondary integration testing mnemonic (Bob)
dev_init_secondary: check_python show_info_recovery_mode
@echo "Initializing device with secondary test mnemonic! WARNING TAKES 2 MINUTES AND REQUIRES RECOVERY MODE"
@python -m ledgerblue.hostOnboard --apdu --id 0 --prefix "" --passphrase "" --pin 5555 --words "elite vote proof agree february step sibling sand grocery axis false cup"
# This target will setup a custom developer certificate
dev_ca: check_python
@python -m ledgerblue.setupCustomCA --targetId 0x31100004 --public $(SCP_PUBKEY) --name zondax
dev_ca_delete: check_python
@python -m ledgerblue.resetCustomCA --targetId 0x31100004
# This target will setup a custom developer certificate
dev_ca2: check_python
@python -m ledgerblue.setupCustomCA --targetId 0x33000004 --public $(SCP_PUBKEY) --name zondax
dev_ca_delete2: check_python
@python -m ledgerblue.resetCustomCA --targetId 0x33000004
dev_read_icon: check_python
@python ./deps/nanos-secure-sdk/icon.py src/ledger/nanos_icon.gif hexbitmaponly
@echo