34 lines
979 B
Makefile
34 lines
979 B
Makefile
IMAGE=./target/riscv32imc-unknown-none-elf/release/ecu-esp32
|
|
|
|
$(IMAGE): $(wildcard ecu-esp32/src/*.rs) Makefile pubkey.bin ecu-esp32/Cargo.toml Cargo.toml keys/device.key keys/client.pub
|
|
echo $<
|
|
cargo build --release
|
|
|
|
.PHONY: build ota install
|
|
build: $(IMAGE) Makefile
|
|
|
|
ota.bin: $(IMAGE)
|
|
espflash save-image --chip esp32c3 $< $@
|
|
|
|
ota: ota.bin
|
|
time python otaclient.py $<
|
|
|
|
install: $(IMAGE)
|
|
espflash flash --erase-parts otadata --partition-table ./partitions.csv --monitor --chip esp32c3 $<
|
|
|
|
# these keys are used during normal operation for signing session requests and
|
|
# OTA updates
|
|
privkey.pem:
|
|
openssl genpkey -algorithm ed25519 -out privkey.pem
|
|
|
|
pubkey.bin: privkey.pem
|
|
openssl pkey -in $< -pubout -text_pub | awk '/^ / {print}' | xxd -r -p > $@
|
|
|
|
# these keys are used during wifi provisioning so we can authenticate
|
|
# the peer
|
|
keys/client.key keys/client.pub:
|
|
python genkeys.py keys/client.key
|
|
|
|
keys/device.key keys/device.pub:
|
|
python genkeys.py keys/device.key
|