@@ -2,31 +2,42 @@ TEST_UPDATE_VERSION?=2
22WOLFBOOT_VERSION? =0
33EXPVER =tools/test-expect-version/test-expect-version
44SPI_CHIP =SST25VF080B
5- SIGN_TOOL =/bin/false
6-
75SPI_OPTIONS=SPI_FLASH =1 WOLFBOOT_PARTITION_SIZE=0x80000 WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x00000 WOLFBOOT_PARTITION_SWAP_ADDRESS=0x80000
6+ SIGN_ARGS =
7+
8+ ifneq ("$(wildcard ./tools/keytools/keygen) ","")
9+ KEYGEN_TOOL=./tools/keytools/keygen
10+ else
11+ KEYGEN_TOOL=python3 ./tools/keytools/keygen.py
12+ endif
13+
14+ ifneq ("$(wildcard ./tools/keytools/sign) ","")
15+ SIGN_TOOL=./tools/keytools/sign
16+ else
17+ SIGN_TOOL=python3 ./tools/keytools/sign.py
18+ endif
819
920ifeq ($(SIGN ) ,ED25519)
10- SIGN_TOOL =tools/keytools/sign.py --ed25519
21+ SIGN_ARGS+ = --ed25519
1122endif
1223
1324ifeq ($(SIGN ) ,ECC256)
14- SIGN_TOOL =tools/keytools/sign.py --ecc256
25+ SIGN_ARGS+ = --ecc256
1526endif
1627
1728ifeq ($(SIGN ) ,RSA2048)
18- SIGN_TOOL =tools/keytools/sign.py --rsa2048
29+ SIGN_ARGS+ = --rsa2048
1930endif
2031
2132ifeq ($(SIGN ) ,RSA4096)
22- SIGN_TOOL =tools/keytools/sign.py --rsa4096
33+ SIGN_ARGS+ = --rsa4096
2334endif
2435
2536ifeq ($(HASH ) ,SHA256)
26- SIGN_TOOL + = --sha256
37+ SIGN_ARGS + = --sha256
2738endif
2839ifeq ($(HASH ) ,SHA3)
29- SIGN_TOOL + = --sha3
40+ SIGN_ARGS + = --sha3
3041endif
3142
3243$(EXPVER ) :
@@ -86,7 +97,7 @@ test-tpm-on: FORCE
8697
8798test-update : test-app/image.bin FORCE
8899 @dd if=/dev/zero bs=131067 count=1 2> /dev/null | tr " \000" " \377" > test-update.bin
89- @python3 $(SIGN_TOOL ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
100+ @$(SIGN_TOOL ) $( SIGN_ARGS ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
90101 @dd if=test-app/image_v$(TEST_UPDATE_VERSION ) _signed.bin of=test-update.bin bs=1 conv=notrunc
91102 @printf " pBOOT" >> test-update.bin
92103 @make test-reset
@@ -100,20 +111,20 @@ test-self-update: wolfboot.bin test-app/image.bin FORCE
100111 @make clean
101112 @rm src/* _pub_key.c
102113 @make factory.bin RAM_CODE=1 WOLFBOOT_VERSION=$(WOLFBOOT_VERSION ) SIGN=$(SIGN )
103- @python3 $(SIGN_TOOL ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
114+ @$(SIGN_TOOL ) $( SIGN_ARGS ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
104115 @st-flash --reset write test-app/image_v2_signed.bin 0x08020000 || \
105116 (make test-reset && sleep 1 && st-flash --reset write test-app/image_v2_signed.bin 0x08020000) || \
106117 (make test-reset && sleep 1 && st-flash --reset write test-app/image_v2_signed.bin 0x08020000)
107118 @dd if=/dev/zero bs=131067 count=1 2> /dev/null | tr " \000" " \377" > test-self-update.bin
108- @python3 $(SIGN_TOOL ) --wolfboot-update wolfboot.bin private_key.old $(WOLFBOOT_VERSION )
119+ @$(SIGN_TOOL ) $( SIGN_ARGS ) --wolfboot-update wolfboot.bin private_key.old $(WOLFBOOT_VERSION )
109120 @dd if=wolfboot_v$(WOLFBOOT_VERSION ) _signed.bin of=test-self-update.bin bs=1 conv=notrunc
110121 @printf " pBOOT" >> test-self-update.bin
111122 @st-flash --reset write test-self-update.bin 0x08040000 || \
112123 (make test-reset && sleep 1 && st-flash --reset write test-self-update.bin 0x08040000) || \
113124 (make test-reset && sleep 1 && st-flash --reset write test-self-update.bin 0x08040000)
114125
115126test-update-ext : test-app/image.bin FORCE
116- @python3 $(SIGN_TOOL ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
127+ @$(SIGN_TOOL ) $( SIGN_ARGS ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
117128 @ (dd if=/dev/zero bs=1M count=1 | tr ' \000' ' \377' > test-update.rom)
118129 @dd if=test-app/image_v$(TEST_UPDATE_VERSION ) _signed.bin of=test-update.rom bs=1 count=524283 conv=notrunc
119130 @printf " pBOOT" | dd of=test-update.rom obs=1 seek=524283 count=5 conv=notrunc
0 commit comments