From ac5c3163612a6adcb1a6a6071d3368794e12f6c8 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 16 Sep 2021 15:46:44 +0200 Subject: [PATCH] makefiles/suit.inc.mk: refactor file storage and naming - move all generated manifests under $(BINDIR)/suit_files (this can be overwritten. - rename signed manifests so that they are of the form: ..bin, where is by default riot.suit. This avoids cluterring BINDIR while as well having a naming scheme that allows custom names for manifests addresssing different types of payloads. --- examples/suit_update/README.hardware.md | 8 +++---- makefiles/suit.inc.mk | 31 ++++++++++++------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/examples/suit_update/README.hardware.md b/examples/suit_update/README.hardware.md index 996e5d1f34..e8ec9ba344 100644 --- a/examples/suit_update/README.hardware.md +++ b/examples/suit_update/README.hardware.md @@ -574,10 +574,10 @@ The following variables are defined in makefiles/suit.inc.mk: The following convention is used when naming a manifest - SUIT_MANIFEST ?= $(BINDIR_APP)-riot.suitv3.$(APP_VER).bin - SUIT_MANIFEST_LATEST ?= $(BINDIR_APP)-riot.suitv3.latest.bin - SUIT_MANIFEST_SIGNED ?= $(BINDIR_APP)-riot.suitv3_signed.$(APP_VER).bin - SUIT_MANIFEST_SIGNED_LATEST ?= $(BINDIR_APP)-riot.suitv3_signed.latest.bin + SUIT_MANIFEST ?= $(BINDIR_RIOTBOOT)/riot.suitv3.$(APP_VER).bin + SUIT_MANIFEST_LATEST ?= $(BINDIR_RIOTBOOT)/riot.suitv3.latest.bin + SUIT_MANIFEST_SIGNED ?= $(BINDIR_RIOTBOOT)/riot.suitv3_signed.$(APP_VER).bin + SUIT_MANIFEST_SIGNED_LATEST ?= $(BINDIR_RIOTBOOT)/riot.suitv3_signed.latest.bin The following default values are using for generating the manifest: diff --git a/makefiles/suit.inc.mk b/makefiles/suit.inc.mk index bb196d4240..4aed631084 100644 --- a/makefiles/suit.inc.mk +++ b/makefiles/suit.inc.mk @@ -4,20 +4,24 @@ # makefiles/suit.base.inc.mk # # -SUIT_COAP_BASEPATH ?= fw/$(BOARD) +SUIT_COAP_BASEPATH ?= fw/$(APPLICATION)/$(BOARD) SUIT_COAP_SERVER ?= localhost SUIT_COAP_ROOT ?= coap://$(SUIT_COAP_SERVER)/$(SUIT_COAP_BASEPATH) SUIT_COAP_FSROOT ?= $(RIOTBASE)/coaproot +BINDIR_SUIT = $(BINDIR)/suit_files +$(BINDIR_SUIT): $(CLEAN) + $(Q)mkdir -p $(BINDIR_SUIT) + # SUIT_MANIFEST_BASENAME ?= riot.suit -SUIT_MANIFEST ?= $(BINDIR_APP)-$(SUIT_MANIFEST_BASENAME).$(APP_VER).bin -SUIT_MANIFEST_LATEST ?= $(BINDIR_APP)-$(SUIT_MANIFEST_BASENAME).latest.bin -SUIT_MANIFEST_SIGNED ?= $(BINDIR_APP)-$(SUIT_MANIFEST_BASENAME)_signed.$(APP_VER).bin -SUIT_MANIFEST_SIGNED_LATEST ?= $(BINDIR_APP)-$(SUIT_MANIFEST_BASENAME)_signed.latest.bin +SUIT_MANIFEST ?= $(BINDIR_SUIT)/$(SUIT_MANIFEST_BASENAME)_unsigned.$(APP_VER).bin +SUIT_MANIFEST_LATEST ?= $(BINDIR_SUIT)/$(SUIT_MANIFEST_BASENAME)_unsigned.latest.bin +SUIT_MANIFEST_SIGNED ?= $(BINDIR_SUIT)/$(SUIT_MANIFEST_BASENAME).$(APP_VER).bin +SUIT_MANIFEST_SIGNED_LATEST ?= $(BINDIR_SUIT)/$(SUIT_MANIFEST_BASENAME).latest.bin SUIT_NOTIFY_VERSION ?= latest -SUIT_NOTIFY_MANIFEST ?= $(APPLICATION)-$(SUIT_MANIFEST_BASENAME)_signed.$(SUIT_NOTIFY_VERSION).bin +SUIT_NOTIFY_MANIFEST ?= $(SUIT_MANIFEST_BASENAME).$(SUIT_NOTIFY_VERSION).bin # Long manifest names require more buffer space when parsing export CFLAGS += -DCONFIG_SOCK_URLPATH_MAXLEN=128 @@ -26,14 +30,11 @@ SUIT_VENDOR ?= "riot-os.org" SUIT_SEQNR ?= $(APP_VER) SUIT_CLASS ?= $(BOARD) -ifneq (,$(filter riotboot,$(USEMODULE))) - SUIT_MANIFEST_PAYLOADS ?= $(SLOT0_RIOT_BIN) $(SLOT1_RIOT_BIN) - SUIT_MANIFEST_SLOTFILES ?= $(SLOT0_RIOT_BIN):$(SLOT0_OFFSET) \ - $(SLOT1_RIOT_BIN):$(SLOT1_OFFSET) -endif -# +SUIT_MANIFEST_PAYLOADS ?= $(SLOT0_RIOT_BIN) $(SLOT1_RIOT_BIN) +SUIT_MANIFEST_SLOTFILES ?= $(SLOT0_RIOT_BIN):$(SLOT0_OFFSET) \ + $(SLOT1_RIOT_BIN):$(SLOT1_OFFSET) -$(SUIT_MANIFEST): $(SUIT_MANIFEST_PAYLOADS) +$(SUIT_MANIFEST): $(SUIT_MANIFEST_PAYLOADS) $(BINDIR_SUIT) $(Q)$(RIOTBASE)/dist/tools/suit/gen_manifest.py \ --urlroot $(SUIT_COAP_ROOT) \ --seqnr $(SUIT_SEQNR) \ @@ -55,9 +56,7 @@ $(SUIT_MANIFEST_LATEST): $(SUIT_MANIFEST) $(SUIT_MANIFEST_SIGNED_LATEST): $(SUIT_MANIFEST_SIGNED) $(Q)ln -f -s $< $@ -SUIT_MANIFESTS := $(SUIT_MANIFEST) \ - $(SUIT_MANIFEST_LATEST) \ - $(SUIT_MANIFEST_SIGNED) \ +SUIT_MANIFESTS := $(SUIT_MANIFEST_SIGNED) \ $(SUIT_MANIFEST_SIGNED_LATEST) suit/manifest: $(SUIT_MANIFESTS)