From patchwork Thu Jul 9 18:14:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1326134 X-Patchwork-Delegate: freifunk@adrianschmutzler.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=adrianschmutzler.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=HhIL9po6; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B2kth5xrYz9sRf for ; Fri, 10 Jul 2020 04:18:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vIdGU0PZcx25bm6Wmfd6U5+lpZhgeuITPaXFTNj/NCQ=; b=HhIL9po6U3r8rAoZrdP4lXL0FY RxKgPeinePaZ950R77XuYm7+ZWtMzBb4YqJ9KWNp/xh2BRzM4xa9vctP/YxSa+KmndC4ZFnj/ShPL sLbtyf6myZgOBy8plbb6Fzfic9c3Eutb0Xp13bjHmysDO8vtfQ0eg4rJV7CCi7UUAEnsGs6qKYRy7 i1VyZ0BTuEtN/56DY8Fn0YM8Ar7m8JsiSPCzDfG9aET4OL6n4cYJi299RTUo8R6d4+BSV93WB1QMI FWNM5yiy9oHV8TlyZmsPxHMPvx4jNJrXjheKp6FIRxl0vyhBJUm0145YV/mqOq7OtX0UTt9sT5wvt /zkAHNpQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtb5R-0000Cp-V6; Thu, 09 Jul 2020 18:15:58 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtb5J-000096-QB for openwrt-devel@lists.openwrt.org; Thu, 09 Jul 2020 18:15:51 +0000 Received: from buildfff.adridolf.com ([188.192.134.246]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MdNTs-1kSvpn2RwO-00ZOMu for ; Thu, 09 Jul 2020 20:15:43 +0200 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/5] build: add DEVICE_COMPAT_VERSION and DEVICE_COMPAT_MESSAGE Date: Thu, 9 Jul 2020 20:14:56 +0200 Message-Id: <20200709181500.10948-2-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709181500.10948-1-freifunk@adrianschmutzler.de> References: <20200709181500.10948-1-freifunk@adrianschmutzler.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:RXjsvQZC4SCxWBzbIVM6l9WvUJQA2t6HkmvWxa4mTgCW6jQQEzk yJ+ftX5BRyL47QAEh4Gs9x5foFsAye/uYyjBTZHWQ7gGAo8tc4lfQpuBOXg/dY2ZwY+y5e4 nnGv0a/YRF4Fnkge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( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_141550_095333_CC9429A7 X-CRM114-Status: GOOD ( 11.33 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.135 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.135 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. Removing SUPPORTED_DEVICES will not really be helpful in most of these cases, as this only helps after a rename. To solve this situation, this patchset introduces a compatibility version for devices. It will be implemented via a per-device Make variable DEVICE_COMPAT_VERSION, which will be set to 1.0 globally by default and then can be overwritten as needed. Furthermore, a variable DEVICE_COMPAT_MESSAGE is added, where a message to be displayed during sysupgrade may be specified optionally. This patch only implements the build variables and adds them to the sysupgrade metadata, the evaluation will be addressed in a subsequent patch. To set it, one would just need to add the following to a device node: define Device/somedevice ... DEVICE_COMPAT_VERSION := 1.1 DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA endef Signed-off-by: Adrian Schmutzler --- include/image-commands.mk | 7 +++++-- include/image.mk | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index e7db7128b4..9da712e733 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -384,13 +384,16 @@ define Build/tplink-v2-image rm -rf $@.new endef +compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0) json_quote=$(subst ','\'',$(subst ",\",$(1))) #")') metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) metadata_json = \ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ "metadata_version": "1.0", \ - "supported_devices":[$(call metadata_devices,$(1))], \ + "compat_version": "$(call json_quote,$(compat_version))", \ + $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \ + "supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))], \ "version": { \ "dist": "$(call json_quote,$(VERSION_DIST))", \ "version": "$(call json_quote,$(VERSION_NUMBER))", \ @@ -401,7 +404,7 @@ metadata_json = \ }' define Build/append-metadata - $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) + $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@) [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ cp "$(BUILD_KEY).ucert" "$@.ucert" ;\ usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ diff --git a/include/image.mk b/include/image.mk index 300f7a6619..dbdc820f4d 100644 --- a/include/image.mk +++ b/include/image.mk @@ -419,6 +419,8 @@ define Device/Init BOARD_NAME := UIMAGE_NAME := + DEVICE_COMPAT_VERSION := 1.0 + DEVICE_COMPAT_MESSAGE := SUPPORTED_DEVICES := IMAGE_METADATA := @@ -435,6 +437,7 @@ DEFAULT_DEVICE_VARS := \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \ IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \ + DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \