@@ -22,26 +22,32 @@ TESTS_JS_PACKAGE?=
2222TESTS_JS_DIR? =
2323
2424LEDGER_SRC =$(CURDIR ) /app
25- DOCKER_APP_SRC =/project
25+ DOCKER_APP_SRC =/app
2626DOCKER_APP_BIN =$(DOCKER_APP_SRC ) /app/bin/app.elf
2727
28- DOCKER_BOLOS_SDKS =/project/deps/nanos-secure-sdk
29- DOCKER_BOLOS_SDKX =/project/deps/nanox-secure-sdk
30- DOCKER_BOLOS_SDKS2 =/project/deps/nanosplus-secure-sdk
28+ DOCKER_BOLOS_SDKS = NANOS_SDK
29+ DOCKER_BOLOS_SDKX = NANOX_SDK
30+ DOCKER_BOLOS_SDKS2 = NANOSP_SDK
31+
32+ TARGET_S = nanos
33+ TARGET_X = nanox
34+ TARGET_S2 = nanos2
3135
3236# Note: This is not an SSH key, and being public represents no risk
3337SCP_PUBKEY =049bc79d139c70c83a4b19e8922e5ee3e0080bb14a2e8b0752aa42cda90a1463f689b0fa68c1c0246845c2074787b649d0d8a6c0b97d4607065eee3057bdf16b83
3438SCP_PRIVKEY =ff701d781f43ce106f72dc26a46b6a83e053b5d07bb3d4ceab79c91ca822a66b
3539
3640INTERACTIVE: =$(shell [ -t 0 ] && echo 1)
3741USERID: =$(shell id -u)
42+ GROUPID: =$(shell id -g)
3843$(info USERID : $(USERID ) )
44+ $(info GROUPID : $(GROUPID ) )
3945$(info TESTS_ZEMU_DIR : $(TESTS_ZEMU_DIR ) )
4046$(info EXAMPLE_VUE_DIR : $(EXAMPLE_VUE_DIR ) )
4147$(info TESTS_JS_DIR : $(TESTS_JS_DIR ) )
4248$(info TESTS_JS_PACKAGE : $(TESTS_JS_PACKAGE ) )
4349
44- DOCKER_IMAGE_ZONDAX =zondax/builder-bolos :latest
50+ DOCKER_IMAGE_ZONDAX =zondax/ledger-app-builder :latest
4551DOCKER_IMAGE_LEDGER =ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
4652
4753ifdef INTERACTIVE
@@ -63,17 +69,17 @@ endif
6369define run_docker
6470 docker run $(TTY_SETTING ) $(INTERACTIVE_SETTING ) --rm \
6571 -e SCP_PRIVKEY=$(SCP_PRIVKEY ) \
66- -e BOLOS_SDK =$(1 ) \
67- -e BOLOS_ENV=/opt/bolos \
68- -u $(USERID ) \
69- -v $(shell pwd ) :/project \
72+ -e SDK_VARNAME =$(1 ) \
73+ -e TARGET= $( 2 ) \
74+ -u $(USERID ) : $( GROUPID ) \
75+ -v $(shell realpath . ) :/app \
7076 -e SUPPORT_SR25519=$(SUPPORT_SR25519 ) \
7177 -e SUBSTRATE_PARSER_FULL=$(SUBSTRATE_PARSER_FULL ) \
7278 -e DISABLE_PREVIOUS=$(DISABLE_PREVIOUS ) \
7379 -e DISABLE_CURRENT=$(DISABLE_CURRENT ) \
7480 -e COIN=$(COIN ) \
7581 -e APP_TESTING=$(APP_TESTING ) \
76- $(DOCKER_IMAGE_ZONDAX ) "$(2 ) "
82+ $(DOCKER_IMAGE_ZONDAX ) "$(3 ) "
7783endef
7884
7985define run_docker_ledger
@@ -83,12 +89,9 @@ define run_docker_ledger
8389endef
8490
8591all :
86- @$(MAKE ) clean_output
87- @$(MAKE ) clean_build
92+ @$(MAKE ) clean
8893 @$(MAKE ) buildS
89- @$(MAKE ) clean_build
9094 @$(MAKE ) buildX
91- @$(MAKE ) clean_build
9295 @$(MAKE ) buildS2
9396
9497.PHONY : check_python
@@ -111,77 +114,74 @@ ledger_lint:
111114
112115.PHONY : build_rustS
113116build_rustS :
114- $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,make -C $(DOCKER_APP_SRC ) rust)
117+ $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,$( TARGET_S ) , make -j $(NPROC ) rust)
115118
116119.PHONY : build_rustX
117120build_rustX :
118- $(call run_docker,$(DOCKER_BOLOS_SDKX ) ,make -C $(DOCKER_APP_SRC ) rust)
121+ $(call run_docker,$(DOCKER_BOLOS_SDKX ) ,$( TARGET_X, ) make -j $(NPROC ) rust)
119122
120123.PHONY : build_rustS2
121124build_rustS2 :
122- $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) ,make -C $(DOCKER_APP_SRC ) rust)
125+ $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) ,$( TARGET_S2 ) , make -j $(NPROC ) rust)
123126
124127.PHONY : convert_icon
125128convert_icon :
126129 @convert $(LEDGER_SRC ) /tmp.gif -monochrome -size 16x16 -depth 1 $(LEDGER_SRC ) /nanos_icon.gif
127130 @convert $(LEDGER_SRC ) /nanos_icon.gif -crop 14x14+1+1 +repage -negate $(LEDGER_SRC ) /nanox_icon.gif
128131
129132.PHONY : buildS
130- buildS : build_rustS
131- $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,make -j $( NPROC ) -C $(DOCKER_APP_SRC ) )
133+ buildS :
134+ $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,$( TARGET_S ) ,make -j $(NPROC ) )
132135
133136.PHONY : buildX
134- buildX : build_rustX
135- $(call run_docker,$(DOCKER_BOLOS_SDKX ) ,make -j $( NPROC ) -C $(DOCKER_APP_SRC ) )
137+ buildX :
138+ $(call run_docker,$(DOCKER_BOLOS_SDKX ) ,$( TARGET_X ) ,make -j $(NPROC ) )
136139
137140.PHONY : buildS2
138- buildS2 : build_rustS2
139- $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) ,make -j $(NPROC ) -C $(DOCKER_APP_SRC ) )
141+ buildS2 :
142+ $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) ,$(TARGET_S2 ) ,make -j $(NPROC ) )
143+
144+ .PHONY : clean_glyphs
145+ clean_glyphs :
146+ @echo " Removing glyphs files"
147+ @rm -f app/glyphs/glyphs.c app/glyphs/glyphs.h || true
140148
141149.PHONY : clean_output
142150clean_output :
143151 @echo " Removing output files"
144152 @rm -f app/output/app* || true
145153
146- .PHONY : clean
154+ .PHONY : clean_build
147155clean_build :
148- $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,make -C $( DOCKER_APP_SRC ) clean)
156+ $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) , $( TARGET_S2 ) ,make clean)
149157
150158.PHONY : clean
151- clean : clean_output clean_build
159+ clean : clean_output clean_build clean_glyphs
152160
153161.PHONY : listvariants
154162listvariants :
155- $(call run_docker,$(DOCKER_BOLOS_SDKS ) ,make -C $( DOCKER_APP_SRC ) listvariants)
163+ $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) , $( TARGET_S2 ) ,make listvariants)
156164
157165.PHONY : shellS
158166shellS :
159- $(call run_docker,$(DOCKER_BOLOS_SDKS ) -t,bash)
167+ $(call run_docker,$(DOCKER_BOLOS_SDKS ) -t,$( TARGET_S ) , bash)
160168
161169.PHONY : shellX
162170shellX :
163- $(call run_docker,$(DOCKER_BOLOS_SDKX ) -t,bash)
171+ $(call run_docker,$(DOCKER_BOLOS_SDKX ) -t,$( TARGET_X ) , bash)
164172
165173.PHONY : shellS2
166174shellS2 :
167- $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) -t,bash)
175+ $(call run_docker,$(DOCKER_BOLOS_SDKS2 ) -t,$( TARGET_S2 ) , bash)
168176
169- .PHONY : load
170- load :
177+ .PHONY : loadS
178+ loadS :
171179 ${LEDGER_SRC} /pkg/installer_s.sh load
172180
173- .PHONY : delete
174- delete :
181+ .PHONY : deleteS
182+ deleteS :
175183 ${LEDGER_SRC} /pkg/installer_s.sh delete
176184
177- .PHONY : loadX
178- loadX :
179- ${LEDGER_SRC} /pkg/installer_x.sh load
180-
181- .PHONY : deleteX
182- deleteX :
183- ${LEDGER_SRC} /pkg/installer_x.sh delete
184-
185185.PHONY : loadS2
186186loadS2 :
187187 ${LEDGER_SRC} /pkg/installer_s2.sh load
@@ -215,11 +215,6 @@ dev_init_secondary: check_python show_info_recovery_mode
215215dev_ca : check_python
216216 @python -m ledgerblue.setupCustomCA --targetId 0x31100004 --public $(SCP_PUBKEY ) --name zondax
217217
218- # This target will setup a custom developer certificate
219- .PHONY : dev_caX
220- dev_caX : check_python
221- @python -m ledgerblue.setupCustomCA --targetId 0x33000004 --public $(SCP_PUBKEY ) --name zondax
222-
223218.PHONY : dev_ca_delete
224219dev_ca_delete : check_python
225220 @python -m ledgerblue.resetCustomCA --targetId 0x31100004
@@ -233,33 +228,6 @@ dev_caS2: check_python
233228dev_ca_deleteS2 : check_python
234229 @python -m ledgerblue.resetCustomCA --targetId 0x33100004
235230
236- # ######################### VUE Section ###############################
237-
238- .PHONY : vue_install_js_link
239- ifeq ($(TESTS_JS_DIR ) ,)
240- vue_install_js_link :
241- @echo " No local package defined"
242- else
243- vue_install_js_link :
244- # First unlink everything
245- cd $(TESTS_JS_DIR ) && yarn unlink || true
246- cd $(EXAMPLE_VUE_DIR ) && yarn unlink $(TESTS_JS_PACKAGE ) || true
247- # # Now build and link
248- cd $(TESTS_JS_DIR) && yarn install && yarn build && yarn link || true
249- cd $(EXAMPLE_VUE_DIR) && yarn link $(TESTS_JS_PACKAGE) && yarn install || true
250- @echo
251- # List linked packages
252- @echo
253- @cd $(EXAMPLE_VUE_DIR) && ( ls -l node_modules ; ls -l node_modules/@* ) | grep ^l || true
254- @echo
255- endif
256-
257- .PHONY : vue
258- vue : vue_install_js_link
259- cd $(EXAMPLE_VUE_DIR ) && yarn install && yarn serve
260-
261- # ######################### VUE Section ###############################
262-
263231.PHONY : zemu_install_js_link
264232ifeq ($(TESTS_JS_DIR ) ,)
265233zemu_install_js_link :
0 commit comments